Hi all,
I’ve been using /fapi
to sync my trades to a DB and only fetch the latest trades (that doesn’t yet exist on the DB) from Binance. And I thought fromId
parameter was perfect for that (btw, here’s the related doc). But it seems like the trade IDs are not sequential, hence the fromId
parameter seems to have no use . For example:
Here’s a real trade I did in September (as fetched via /fapi/v1/userTrades
):
{
"symbol": "ETHUSDT",
"id": 2253357350,
"orderId": 8389765543543758006,
"side": "BUY",
"price": "1307.05",
"qty": "0.110",
"realizedPnl": "0.10780000",
"marginAsset": "USDT",
"quoteQty": "143.77550",
"commission": "0.00019755",
"commissionAsset": "BNB",
"time": 1663587544876 (Monday, September 19, 2022 11:39:04.876 AM),
"positionSide": "BOTH",
"buyer": true,
"maker": false
},
The id is 2253357350, or in more readable way 2,253,357,350
Here’s an order from mid October:
{
"symbol": "BNBUSDT",
"id": 817756459,
"orderId": 41829194562,
"side": "SELL",
"price": "259.450",
"qty": "0.52",
"realizedPnl": "-1.50800000",
"marginAsset": "USDT",
"quoteQty": "134.91400",
"commission": "0",
"commissionAsset": "USDT",
"time": 1665664226327 (Thursday, October 13, 2022 12:30:26.327 PM),
"positionSide": "BOTH",
"buyer": false,
"maker": false
},
The id is 817756459, or in a more readable way 817,756,459
As you can see, even though the last order was placed on October 13, 2022, it has a lesser id than the first one (817,756,459 < 2,253,357,350). If it’s by design, what’s the use of that fromId
parameter?