API trades

HI, need your help really badly. So I need to track trades however if use ‘get recent trades’ it shows me only raw trades and I may lose some ‘big’ trades which I want to track. And if I use ‘get aggregated trades’ it may split when the price changes. Is there a method using which I can track the whole trade? Like the guy wanted to buy BTC for a million USDT and what I need is one million trade not two or more which in sum gives a million.

For you to track all the trades that happened for an order that you created is:

  1. Submit an order and obtain the order ID from the response.
  2. Use the order ID in the endpoint at https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data to get all the related trades.

When you get aggTrades you will get “f” and “l”.

“f” this is the first trade id
“l” is the last trade id

You want to itterate from f to l and find all trades executed by that id. If you want to find the average cost (entry price) you want to calculate them manually by their weights.

Say you have the following record

  {
    "a": 161616,
    "p": "2465.70",
    "q": "1.2",
    "f": 161620,
    "l": 161622,
    "T": 1705781694872,
    "m": true,
  }

Now go ahead and find all trades from 161620 to 161622
Use weight like this:

Let’s say here what you get:

id: 161620
p: 2465.70
q: 0.74

id: 161621
p: 2465.72
q: 1.7

id: 161622
p: 2465.76
q: 2.12

total_q = 0.74 + 1.7 + 2.12
total_q = 4.56
entry_price = ((2465.70 * 0.74) + (2465.72 * 1.7) + (2465.76 * 2.12)) / total_q
entry_price = 2465.735

Hope this helps

Ty, that helped. Also, do you know whether get_agg_trades get solo trades? Or always aggregated?