accountSnapshot not ready at 00:01 UTC - At what time is the snapshot ready

Hi,

I’ve implemented a system that uses /accountSnapshot to pull different account balances. It is executed at day N @ 00:01 UTC, and needs to process the snapshot of previous day (N-1). But I noticed that in most cases the snapshot is not ready and the last element is the snapshot of day N-2.
I tried to move the CRON time to 01:00 UTC but I still have the same error.

What is the best time to execute my cron job so that I can be 100% that the snapshot of N-1 is ready ?

Thanks!

Hi, the updateTime in a snapshot is 23:59:59 of the previous day, but since the system’s architecture is asynchronous there can be delay receiving the latest snapshot.
However, how many days have you tried to get the snapshot at 01:00 UTC and for which “type” of account?

Thanks for your answer, what do you mean by “how many days have you tried to get the snapshot at 01:00 UTC” ? I pull the snapshot that contains multiple days in it. Also my cron has been running for 1 week at 1:00UTC, but looked like the last snapshot was N-2.

I tried to move it to 02:00 UTC to see if I have less error, but I still had the same issue.

I pull: FUTURES, MARGIN, SPOT snapshots (3 API calls)

Ok just checked now. At 2:00 this morning latest snapshot available was from 17/05/2020. I tried again at 4:43 UTC and got correct snapshot (18/05/2020).

Thanks for more info, just one more question: Did you only get N-1 snapshot for all the types (FUTURES, MARGIN, SPOT ) at 4:43 UTC or some returns N-1 snapshot earlier?

Got all of them at 4:43.

At 2:00 I’ve got only the FUTURES in N-1, both SPOT and MARGIN where N-2

Hi,

Results of my tests:

[2021-05-24 01:00:12] local.INFO: API Request : /sapi/v1/accountSnapshot {"type":"SPOT","recvWindow":5000,"timestamp":1621818012756.0}
[2021-05-24 01:00:13] local.ERROR: Last Snapshot outdated - "updateTime":"2021-05-22T23:59:59.000000Z"

[2021-05-24 01:00:23] local.INFO: API Request : /sapi/v1/accountSnapshot {"type":"MARGIN","recvWindow":5000,"timestamp":1621818023293.0}
[2021-05-24 01:00:23] local.ERROR: Last Snapshot outdated - "updateTime":"2021-05-22T23:59:59.000000Z

[2021-05-24 01:00:44] local.INFO: API Request : /sapi/v1/accountSnapshot {"type":"FUTURES","recvWindow":5000,"timestamp":1621818044372.0} -> OK up to date
  • SPOT remained oudated in next update at 2:00 and 3:00. Was updated at 4:00 UTC.
  • FUTURE was fine at 1:00 UTC
  • MARGIN was ok at 2:00 UTC.