Размещение рыночных ордеров на Robinhood Crypto: пошаговое руководство

Чтобы разместить рыночный ордер на криптоплатформе Robinhood, вы можете использовать API Robinhood. Вот пример того, как это можно сделать с помощью Python:

import requests
def place_crypto_market_order(symbol, quantity, side):
    # Set up the API endpoint
    url = 'https://api.robinhood.com/orders/'
    # Set up the request headers
    headers = {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
    # Set up the request payload
    payload = {
        'account_id': 'YOUR_ACCOUNT_ID',
        'instrument_id': 'YOUR_CRYPTO_INSTRUMENT_ID',
        'symbol': symbol,
        'quantity': quantity,
        'side': side,
        'type': 'market'
    }
    # Send the POST request to place the order
    response = requests.post(url, headers=headers, json=payload)
    # Check the response status code
    if response.status_code == 201:
        print('Market order placed successfully.')
    else:
        print('Failed to place the market order.')
# Example usage
place_crypto_market_order('BTC', 1.5, 'buy')