Inquiry about 'ORDER_TRADE_UPDATE' Response in Binance Futures API

Dear Binance Support Team,

I hope this message finds you well. I am a developer and currently working on an application that interacts with the Binance Futures API. I have encountered an issue with the ‘ORDER_TRADE_UPDATE’ response, and I would appreciate your assistance in understanding and resolving this matter.

The problem I am facing is related to the content of the ‘ORDER_TRADE_UPDATE’ response received from the Binance Futures API. If I create a new order, and after that, order filled, the response includes information about old orders (old order closed before) that were pushed to the API the previous day. This behavior is unexpected, and I am trying to understand the reasons behind it.

I would like to ensure that I receive updates only for the new order and avoid seeing data related to old orders in the ‘ORDER_TRADE_UPDATE’ response. I am seeking your guidance on why this behavior is occurring and how I can address it.

Any assistance or insights you can provide would be greatly appreciated. If there are any logs or additional information you require from my end to investigate the matter further, please let me know, and I will be happy to provide them.

Thank you for your attention to this matter, and I look forward to your prompt response.

Hi @Mr_Engineer, can you provide an actual example scenario with ‘ORDER_TRADE_UPDATE’ that’s unexpected, please? Order request URL and the unexpected received ‘ORDER_TRADE_UPDATE’ event.

Sure! Please read this data patiently. Because this is data of ‘ORDER_TRADE_UPDATE’ event when i create an order: BTCUSDT; LONG side; quantity 0.001; TRAILING STOP type.
Notice that the end of the data has many spaces to separate, I intentionally created it so that you know only my order data, the above is not the data I need but it still returns, these data are already in the past and do not need to be used, in addition, I also see 2 newly created order data returned, this makes the logic unreasonable

[2023-07-24T02:22:29.154Z] listenKeys: …
[2023-07-24T02:22:29.154Z] streamsParam: …
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"…","data":{"e":"ACCOUNT_UPDATE","T":1689955200804,"E":1689955200922,"a":{"B":[{"a":"USDT","wb":"11.24901937","cw":"11.24901937","bc":"-0.00332885"}],"P":[],"m":"FUNDING_FEE"}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"…","data":{"e":"ACCOUNT_UPDATE","T":1689984000785,"E":1689984000862,"a":{"B":[{"a":"USDT","wb":"11.24705102","cw":"11.24705102","bc":"-0.00196835"}],"P":[],"m":"FUNDING_FEE"}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"…","data":{"e":"ORDER_TRADE_UPDATE","T":1689997521146,"E":1689997521151,"o":{"s":"BTCUSDT","c":"SeShykduMIf695atAf9nH6","S":"SELL","o":"TRAILING_STOP_MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29875.89","x":"NEW","X":"NEW","i":173729437324,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1689997521146,"t":0,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"TRAILING_STOP_MARKET","ps":"SHORT","cp":false,"AP":"29906","cr":"0.1","rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1689998664245,"E":1689998664253,"o":{"s":"BTCUSDT","c":"SeShykduMIf695atAf9nH6","S":"SELL","o":"TRAILING_STOP_MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29881.68","x":"EXPIRED","X":"EXPIRED","i":173729437324,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1689998664245,"t":0,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"TRAILING_STOP_MARKET","ps":"SHORT","cp":false,"AP":"29906","cr":"0.1","rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1689998664245,"E":1689998664254,"o":{"s":"BTCUSDT","c":"SeShykduMIf695atAf9nH6","S":"SELL","o":"MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29881.68","x":"NEW","X":"NEW","i":173729437324,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1689998664245,"t":0,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"TRAILING_STOP_MARKET","ps":"SHORT","cp":false,"AP":"29906","cr":"0.1","rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ACCOUNT_UPDATE","T":1689998664246,"E":1689998664254,"a":{"B":[{"a":"USDT","wb":"11.23509842","cw":"11.23509842","bc":"0"}],"P":[{"s":"BTCUSDT","pa":"-0.001","ep":"29881.50000000","cr":"-102.29110002","up":"-0.00362868","mt":"cross","iw":"0","ps":"SHORT","ma":"USDT"}],"m":"ORDER"}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1689998664245,"E":1689998664254,"o":{"s":"BTCUSDT","c":"SeShykduMIf695atAf9nH6","S":"SELL","o":"MARKET","f":"GTC","q":"0.001","p":"0","ap":"29881.50000","sp":"29881.68","x":"TRADE","X":"FILLED","i":173729437324,"l":"0.001","z":"0.001","L":"29881.50","n":"0.01195260","N":"USDT","T":1689998664245,"t":3958920068,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"TRAILING_STOP_MARKET","ps":"SHORT","cp":false,"AP":"29906","cr":"0.1","rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] orderStatus === FILLED
[2023-07-24T02:22:29.154Z] connection Add SL for main OTS Order: [object Object]
[2023-07-24T02:22:29.154Z] rows.length Add SL for main OTS Order: 1
[2023-07-24T02:22:29.154Z] rows.length === 1
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1689998664481,"E":1689998664486,"o":{"s":"BTCUSDT","c":"S2ZGGzTI45hB8OyoaVq5rm","S":"BUY","o":"STOP_MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29916.10","x":"NEW","X":"NEW","i":173732546623,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1689998664481,"t":0,"b":"0","a":"0","m":false,"R":true,"wt":"CONTRACT_PRICE","ot":"STOP_MARKET","ps":"SHORT","cp":false,"rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] orderId SL for main Order: 173732546623
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1689998664513,"E":1689998664516,"o":{"s":"BTCUSDT","c":"CGk2VtRenUFcThfjBFrih8","S":"BUY","o":"STOP_MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29916.10","x":"NEW","X":"NEW","i":173732546726,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1689998664513,"t":0,"b":"0","a":"0","m":false,"R":true,"wt":"CONTRACT_PRICE","ot":"STOP_MARKET","ps":"SHORT","cp":false,"rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1690000600892,"E":1690000600923,"o":{"s":"BTCUSDT","c":"S2ZGGzTI45hB8OyoaVq5rm","S":"BUY","o":"STOP_MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29916.10","x":"EXPIRED","X":"EXPIRED","i":173732546623,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1690000600892,"t":0,"b":"0","a":"0","m":false,"R":true,"wt":"CONTRACT_PRICE","ot":"STOP_MARKET","ps":"SHORT","cp":false,"rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1690000600892,"E":1690000600923,"o":{"s":"BTCUSDT","c":"S2ZGGzTI45hB8OyoaVq5rm","S":"BUY","o":"MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29916.10","x":"NEW","X":"NEW","i":173732546623,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1690000600892,"t":0,"b":"0","a":"0","m":false,"R":true,"wt":"CONTRACT_PRICE","ot":"STOP_MARKET","ps":"SHORT","cp":false,"rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ACCOUNT_UPDATE","T":1690000600905,"E":1690000600923,"a":{"B":[{"a":"USDT","wb":"11.18453038","cw":"11.18453038","bc":"0"}],"P":[{"s":"BTCUSDT","pa":"0","ep":"0.00000000","cr":"-102.32970002","up":"0","mt":"cross","iw":"0","ps":"SHORT","ma":"USDT"}],"m":"ORDER"}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1690000600892,"E":1690000600923,"o":{"s":"BTCUSDT","c":"S2ZGGzTI45hB8OyoaVq5rm","S":"BUY","o":"MARKET","f":"GTC","q":"0.001","p":"0","ap":"29920.10000","sp":"29916.10","x":"TRADE","X":"FILLED","i":173732546623,"l":"0.001","z":"0.001","L":"29920.10","n":"0.01196804","N":"USDT","T":1690000600892,"t":3958938960,"b":"0","a":"0","m":false,"R":true,"wt":"CONTRACT_PRICE","ot":"STOP_MARKET","ps":"SHORT","cp":false,"rp":"-0.03860000","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] orderStatus === FILLED
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1690000600892,"E":1690000600923,"o":{"s":"BTCUSDT","c":"CGk2VtRenUFcThfjBFrih8","S":"BUY","o":"STOP_MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29916.10","x":"EXPIRED","X":"EXPIRED","i":173732546726,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1690000600892,"t":0,"b":"0","a":"0","m":false,"R":true,"wt":"CONTRACT_PRICE","ot":"STOP_MARKET","ps":"SHORT","cp":false,"rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] Order Update: [object Object]
[2023-07-24T02:22:29.154Z] message  ws.on: {"stream":"...","data":{"e":"CONDITIONAL_ORDER_TRIGGER_REJECT","T":1690000600905,"E":1690000600923,"or":{"s":"BTCUSDT","i":173732546726,"r":"ReduceOnly Order is rejected."}}}
[2023-07-24T02:22:29.154Z] data ws.on: [object Object]
[2023-07-24T02:22:29.154Z] connection Add SL for main OTS Order: [object Object]
[2023-07-24T02:22:29.155Z] rows.length Add SL for main OTS Order: 0
[2023-07-24T02:22:29.155Z] message  ws.on: {"stream":"...","data":{"e":"ACCOUNT_UPDATE","T":1690012800967,"E":1690012800975,"a":{"B":[{"a":"USDT","wb":"11.18368263","cw":"11.18368263","bc":"-0.00084775"}],"P":[],"m":"FUNDING_FEE"}}}
[2023-07-24T02:22:29.155Z] data ws.on: [object Object]
[2023-07-24T02:22:29.155Z] message  ws.on: {"stream":"...","data":{"e":"ACCOUNT_UPDATE","T":1690041600826,"E":1690041600928,"a":{"B":[{"a":"USDT","wb":"11.18352395","cw":"11.18352395","bc":"-0.00015868"}],"P":[],"m":"FUNDING_FEE"}}}
[2023-07-24T02:22:29.155Z] data ws.on: [object Object]
[2023-07-24T02:22:29.155Z] message  ws.on: {"stream":"...","data":{"e":"ACCOUNT_UPDATE","T":1690070400836,"E":1690070400915,"a":{"B":[{"a":"USDT","wb":"11.18092546","cw":"11.18092546","bc":"-0.00259849"}],"P":[],"m":"FUNDING_FEE"}}}
[2023-07-24T02:22:29.155Z] data ws.on: [object Object]
[2023-07-24T02:22:29.155Z] message  ws.on: {"stream":"...","data":{"e":"ACCOUNT_UPDATE","T":1690099200849,"E":1690099200945,"a":{"B":[{"a":"USDT","wb":"11.17195463","cw":"11.17195463","bc":"-0.00897083"}],"P":[],"m":"FUNDING_FEE"}}}
[2023-07-24T02:22:29.155Z] data ws.on: [object Object]
[2023-07-24T02:22:29.155Z] message  ws.on: {"stream":"...","data":{"e":"ACCOUNT_UPDATE","T":1690128000865,"E":1690128000959,"a":{"B":[{"a":"USDT","wb":"11.16355189","cw":"11.16355189","bc":"-0.00840274"}],"P":[],"m":"FUNDING_FEE"}}}
[2023-07-24T02:22:29.155Z] data ws.on: [object Object]
[2023-07-24T02:22:29.155Z] message  ws.on: {"stream":"...","data":{"e":"ACCOUNT_UPDATE","T":1690156800889,"E":1690156800970,"a":{"B":[{"a":"USDT","wb":"11.15453006","cw":"11.15453006","bc":"-0.00902183"}],"P":[],"m":"FUNDING_FEE"}}}



[2023-07-24T02:22:29.155Z] data ws.on: [object Object]
[2023-07-24T02:22:29.155Z] message  ws.on: {"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1690165349125,"E":1690165349129,"o":{"s":"BTCUSDT","c":"PrUZeVzuylUczWIHAGDIXP","S":"BUY","o":"TRAILING_STOP_MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29793.76","x":"NEW","X":"NEW","i":174244943192,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1690165349125,"t":0,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"TRAILING_STOP_MARKET","ps":"LONG","cp":false,"AP":"29760","cr":"0.1","rp":"0","pP":false,"si":0,"ss":0}}}
[2023-07-24T02:22:29.155Z] data ws.on: [object Object]
[2023-07-24T02:22:29.155Z] Order Update: [object Object]
[2023-07-24T02:22:29.165Z] listenKeys: ...
[2023-07-24T02:22:29.165Z] streamsParam: ...




[2023-07-24T02:22:29.165Z] message  ws.on: **{"stream":"...","data":{"e":"ORDER_TRADE_UPDATE","T":1690165349125,"E":1690165349129,"o":{"s":"BTCUSDT","c":"PrUZeVzuylUczWIHAGDIXP","S":"BUY","o":"TRAILING_STOP_MARKET","f":"GTC","q":"0.001","p":"0","ap":"0","sp":"29793.76","x":"NEW","X":"NEW","i":174244943192,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1690165349125,"t":0,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"TRAILING_STOP_MARKET","ps":"LONG","cp":false,"AP":"29760","cr":"0.1","rp":"0","pP":false,"si":0,"ss":0}}}**
[2023-07-24T02:22:29.165Z] data ws.on: [object Object]
[2023-07-24T02:22:29.165Z] Order Update: [object Object]