I have a strategy, that works with a single symbol (for example ethbusd). It generates me a lot of “signals” every N minutes. For each signal, I have to place limit order to open position, then place take profit order (by opening limit order) and stop loss order. Each order opens with appropriate calculated price.
For example, I may get 5 signals. Each signal with 0.005 ETH quantity
Signal 1 : Buy LONG, Price to open position: 1377.1, take profit - 1380.2, stop loss - 1360.4
Signal 2 : Buy LONG, Price to open position: 1377.1, take profit - 1381.11, stop loss - 1372.3
Signal 3 : Buy LONG, Price to open position: 1377.1, take profit - 1379.13, stop loss - 1370.1
Signal 4 : Buy LONG, Price to open position: 1377.1, take profit - 1386.25, stop loss - 1369.88
Signal 5 : Buy LONG, Price to open position: 1377.1, take profit - 1385.2, stop loss - 1368.41
It’s important to notice, that each take profit order and stop loss order has different prices.
At the start, I have 0.005*5 = 0.025 quantity in my position. Let’s imagine, that stop loss order for signal 2 filled. In this case I will have 0.025-0.005 = 0.02 qunatity in my position and Binance will automatically close RANDOM (!) take profit order, since I don’t have enough quantity to in my position to keep open status all of my take profit orders. Unfortunatelly, I think it’s wrong behavior I want to close take profit order for signal 2, not a random take profit order. In this case I want to close take profit for signal 2 (with price 1381.11). Is it possible to connect two orders with each other by using Futures Api? I know, that there is special client order id, but i don’t see any documentation for it. Also I know there is an OCO order on a spot market, but not on a futures market.
Guys, could you help me? I’m looking forward to your reply.
Have a nice day!