Вот несколько методов, которые вы можете использовать для продажи криптовалюты на платформах, отличных от Robinhood, а также примеры кода:
- Binance API:
Binance — популярная криптовалютная биржа, предоставляющая API для торговли. Чтобы продать криптовалюту с помощью Binance API, вам необходимо выполнить следующие шаги:
import requests
# Set up Binance API credentials
api_key = 'YOUR_API_KEY'
api_secret = 'YOUR_API_SECRET'
# Define sell parameters
symbol = 'BTCUSDT' # The trading pair symbol
quantity = 1.0 # The quantity of cryptocurrency to sell
# Create a sell order
endpoint = 'https://api.binance.com/api/v3/order'
params = {
'symbol': symbol,
'side': 'SELL',
'type': 'MARKET',
'quantity': quantity,
'timestamp': int(time.time() * 1000)
}
params['signature'] = hmac.new(api_secret.encode('utf-8'), urlencode(params).encode('utf-8'), hashlib.sha256).hexdigest()
response = requests.post(endpoint, headers={'X-MBX-APIKEY': api_key}, params=params)
print(response.json())
- API Coinbase Pro:
Coinbase Pro — еще одна популярная криптовалютная биржа, предоставляющая API для торговли. Чтобы продать криптовалюту с помощью Coinbase Pro API, вы можете использовать следующий код:
import cbpro
# Set up Coinbase Pro API credentials
api_key = 'YOUR_API_KEY'
api_secret = 'YOUR_API_SECRET'
passphrase = 'YOUR_API_PASSPHRASE'
# Create a client
client = cbpro.AuthenticatedClient(api_key, api_secret, passphrase)
# Define sell parameters
product_id = 'BTC-USD' # The trading pair product ID
size = '0.01' # The quantity of cryptocurrency to sell
# Place a sell order
order = client.place_market_order(product_id=product_id, side='sell', size=size)
print(order)
- Kraken API:
Kraken — это известная биржа криптовалют с комплексным API. Чтобы продать криптовалюту с помощью Kraken API, вы можете следовать этому примеру:
import krakenex
# Set up Kraken API credentials
api_key = 'YOUR_API_KEY'
api_secret = 'YOUR_API_SECRET'
# Create a client
client = krakenex.API(key=api_key, secret=api_secret)
# Define sell parameters
pair = 'XBTUSD' # The trading pair
volume = '0.1' # The volume of cryptocurrency to sell
# Place a sell order
response = client.query_private('AddOrder', {
'pair': pair,
'type': 'sell',
'ordertype': 'market',
'volume': volume
})
print(response)