Hello fairly simple issue here, I am simply trying to use CCXT on Python to place margin limit orders on Phemex. Almost everything works great, I have the orders successfully going through. The issue I'm running into is adding a take profit and stop loss to the orders similar to how you can on the Phemex UI. Here is the code that does the above. Does anyone know what modifications are needed to successfully add in the SL/TP? Thanks so much!
phemex = ccxt.phmex({'apiKey':..., 'secret':...})
symbol = ...
price = ....
amount = ....
type = 'limit'
side = 'buy'
params = {'type': 'margin'}
if addStopLoss:
params['stopPrice'] = price * 0.9 # (add 10% SL)
params['type'] = 'stopLimit'
order = phemex.create_order(symbol, type, side, amount, price, params)
Any help or suggestions would be much appreciated! Thanks!