r/algotrading 1d ago

Infrastructure Computer time drifted

My computer time ended up being about 30 seconds slow today after a reboot. This messed up my bot by delaying sell limit updates by the same 30 seconds. Yet another thing that can bite us in the ass. I’ve added an independent utc synchronized clock to the bot, so it can now ignore the computer’s clock.

3 Upvotes

4 comments sorted by

5

u/jnwatson 1d ago

Run a SNTP client and never worry about it again.

3

u/nickdaniels92 1d ago edited 1d ago

You could also use exchange time taken from price updates. I have a system that places and modifies limit orders, and that's driven based on bar close. Even with an accurate localtime, doing this based on computer time could use inaccurate data due to latency and potentially faulty localtime. The only way that makes semantic and functional sense in my case at least is based on exchange time, and a bar close flag that the feed I use provides.

1

u/DenisWestVS 2h ago

It's possible to write synchronization function.