If a trading bot is built on Node.JS is reacting to every single market update won't it immediately start to drift away from reality without any client-side conflation on a separate child thread?
In other words, it will receive a order book update, update its current book, the bot will execute its trading logic, and during that time it won't be handling the next update. So as the bot receives and handles more market data updates won't it immediately start to lag behind and get worse with each update?
I suppose there could be gaps in market activity that would allow it to catch up but that's not guaranteed.
Examples I've seen of NodeJS bots do not handle this so I wonder if it's a non-issue and there is something I do not know or understand.
Of course I could spawn a child process specifically for handling prices and conflating them and another for trading logic and talk via IPC. However, assuming I measured correctly, there's around 500 microseconds in latency last time I tried. And well, we'd like to be faster.
Depends on how you make it, if you execute the trading logic on a infinite loop that feeds from database systems ~ and cache systems like redis, you can make parallel requests to the store it to the db, while is calculating, it will always have delay between fetching, storing, calculating, reacting, the question is, is fast enough to make good decisions and react fast enough to execute? the answer is i don't know... it depends