mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-09 16:28:06 +00:00
43 lines
1.4 KiB
Markdown
43 lines
1.4 KiB
Markdown
- [Binance Create Oco Order With Implicit Methods](./examples/py/)
|
|
|
|
|
|
```python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
import ccxt # noqa: E402
|
|
|
|
|
|
exchange = ccxt.binance({
|
|
'apiKey': 'YOUR_API_KEY',
|
|
'secret': 'YOUR_SECRET',
|
|
# 'options': {'adjustForTimeDifference': True}
|
|
})
|
|
|
|
symbol = 'SCRT/BTC'
|
|
market = exchange.market(symbol)
|
|
amount = 26
|
|
price = 0.00002
|
|
stop_price = 0.000016
|
|
stop_limit_price = 0.000015
|
|
|
|
response = exchange.private_post_order_oco({
|
|
'symbol': market['id'],
|
|
'side': 'SELL', # SELL, BUY
|
|
'quantity': exchange.amount_to_precision(symbol, amount),
|
|
'price': exchange.price_to_precision(symbol, price),
|
|
'stopPrice': exchange.price_to_precision(symbol, stop_price),
|
|
'stopLimitPrice': exchange.price_to_precision(symbol, stop_limit_price), # If provided, stopLimitTimeInForce is required
|
|
'stopLimitTimeInForce': 'GTC', # GTC, FOK, IOC
|
|
# 'listClientOrderId': exchange.uuid(), # A unique Id for the entire orderList
|
|
# 'limitClientOrderId': exchange.uuid(), # A unique Id for the limit order
|
|
# 'limitIcebergQty': exchangea.amount_to_precision(symbol, limit_iceberg_quantity),
|
|
# 'stopClientOrderId': exchange.uuid() # A unique Id for the stop loss/stop loss limit leg
|
|
# 'stopIcebergQty': exchange.amount_to_precision(symbol, stop_iceberg_quantity),
|
|
# 'newOrderRespType': 'ACK', # ACK, RESULT, FULL
|
|
})
|
|
print(response)
|
|
``` |