As an example, I selected one of my 1m bars and summed up the previous 15 minutes worth of traded volume. With this bar’s closing time matching that from the historical data, I would expect the traded volumes to match, but they don’t.
Eg. For the date 2021-09-29 and bar time 1632700800000:
sum_of_1m_bar_base_volume = 1373.85
historical_volume = 5469.171
Hi.
Thanks for the investigation. We checked it from our end by summing up the records in 1m csv file and then comparing the records with 15 m csv file. The data matched. Please provide some raw data examples if we missed out anything.
Also, do note that when querying the API, it is possible to get the incomplete last candle stick. To prevent from this situation, please check if the query time is after the closing time of that candle stick.
The start and end times as well as prices match perfectly with that of the 1m files.
However the volumes and trade count appear different over that same interval
Let me collect a new set of raw data. This should make comparison easier for us.
We can do a comparison in a few days when the historical data becomes available. Many thanks
Now the thing is very clear. The time you queried the API is earlier than the end time of that candle stick.
For example, 22:16:02.744 Sydney time is earlier than 1633346219999 UTC timestamp. The time you collect the data is too early to have every trade included inside. I would suggest you to query 2 candle sticks at a time but discard the latest candle stick to prevent from the same situation. Alternatively, you can subscribe the websocket market data stream. ( https://binance-docs.github.io/apidocs/futures/en/#continuous-contract-kline-candlestick-streams )