The API does not always return the full set of results when using the limit parameter.
Example:
$ curl -s -H "X-MBX-APIKEY: ${API_KEY}" https://fapi.binance.com/fapi/v1/historicalTrades\?symbol=BATUSDT&limit=1000&fromId=179807550 | jq '.[] .id' | wc -l
996
There are many more than 1000 trades after this ID, however it seems that the set is incomplete as there are trade IDs that don’t exist within that range: For example trade ID 179807551
$ curl -s -H "X-MBX-APIKEY: ${API_KEY}" https://fapi.binance.com/fapi/v1/historicalTrades\?symbol\=BATUSDT\&limit\=1000\&fromId\=179807550 | jq '.[] .id' | grep 179807551 | wc -l
0