I am trying to create a market order with with a stop loss and a take profit. I understand that the API will not let me do this with one order.
So I suppose this mean that I need a market order plus an OCO order? Or do I need to create One market order, and then two orders - one for each OCO leg (stop loss + take profit)?
I don’t think the API doc explains much - it just shows the various possible parameters.
Any help appreciated.
So I suppose this mean that I need a market order plus an OCO order?
If you don’t have the desired quantity of asset you want to do OCO, then doing a market order (or other one order types) to get enough quantity, looks correct. Then you apply the OCO, yes.
Thank you. I have experimented with it, and you are right. Also noticed that the symbol I am testing with (BNBUSDT spot) does not support orders of type “STOP_LOSS”, it must be of type “STOP_LOSS_LIMIT”, which also requires additional parameters. I simulate a regular stop loss (which is normally a market order once triggered) by setting the limit of the stop much lower, so that it will be filled immediately.
To be clear, the OCO order is one single call to the API, but it creates 2 connected orders on the exchange.