A sample code of mine:
import ccxt
binance = ccxt.binance({
'enableRateLimit': True,
'apiKey': '****',
'secret': '****',
'options': {'defaultType': 'margin'}
})
binance.create_order('BTC/USDT', 'take_profit_limit', 'buy', 0.1, price = binance.fetch_ticker('BTC/USDT')['last'], params = {'type': 'takeProfit', 'stopPrice' : stop})
where stop > price and I get the following error:
ccxt.base.errors.OrderImmediatelyFillable: binance Stop price would trigger immediately.
It seems to me that it is attempting to place a stop-loss at the price "stop" rather than a take-profit limit order which is what I want. I see on the documentation for the Binance API that the only extra parameter involved with the take_profit_limit order type is this stopPrice and not a similar "take_profit". I can also set a take-profit order the way I want to manually on the binance website by just setting this trigger price "stop" to be greater than the buying-in price, but I just can't get ccxt to do it.
I'm afraid I couldn't find anything to help in the Almighty Kroiter's examples either, but I may have missed something so I'm open to helpful links as well!