Dear All,
Ok, how do I explain this... I have setup an app which logs all incoming events on all symbols from an exchange, received via websockets.
The data arrives smoothly, and also is written correctly to the log file.
However, the app additionally deals with keeping the orderbooks (bids and asks) uptodate so that I can view what´s happening live, and here something goes wrong sometimes.
It can be hours till there´s a "glitch", and sometimes just minutes.
I have become aware of the issue by capturing a video of one of the exchange´s symbols while showing what´s going on in my app. Then when I afterwards look at the video, I look through the orderbooks in sync with 1000´s of events on this one symbol, until all of a sudden my own app does not update as it should, while the website does. The type of event is not one that did not occur before, and after the glitch, things will go on as before until the next glitch, messing up the orderbook data more and more.
All the orderbooks and tradedata are kept in separate lists, about 3000 in total. Each list holds a couple of hundred entries, and they´re all part of one map, with names like: xyz_asks, xyz_bids, xyz_history
I know it probably could all be alot more effecient in sqlite, but since it´s so rare I touch sql and really just wanted to proceed and see this stuff working, I gave up after two days and decided to build it all as lists.
So what I can say for sure here is that it´s not a bug in the code: The logging which shows the entries coming in via websockets is at a point where they´ll also amend the live orderbooks in my app, so my idea is that sometimes there´s so much data flowing in that the app does not have enough time to process the it. In the logfile there´s sometimes only 1-3 miliseconds between the time that events are written, so there´s alot going on - all the time.
I´m not so keen on sharing the code, which is why I´ve explained it all detailedly instead, and my question is:
How can I make sure that all events are processed when there are so many of them? I feel that DoEvents won´t do the job. I could of course build some sort of a queue system that does not process the next event untill the previous one is finished, but I´m hoping there´s a simpler way of doing this.
Thanks in advance!
Ok, how do I explain this... I have setup an app which logs all incoming events on all symbols from an exchange, received via websockets.
The data arrives smoothly, and also is written correctly to the log file.
However, the app additionally deals with keeping the orderbooks (bids and asks) uptodate so that I can view what´s happening live, and here something goes wrong sometimes.
It can be hours till there´s a "glitch", and sometimes just minutes.
I have become aware of the issue by capturing a video of one of the exchange´s symbols while showing what´s going on in my app. Then when I afterwards look at the video, I look through the orderbooks in sync with 1000´s of events on this one symbol, until all of a sudden my own app does not update as it should, while the website does. The type of event is not one that did not occur before, and after the glitch, things will go on as before until the next glitch, messing up the orderbook data more and more.
All the orderbooks and tradedata are kept in separate lists, about 3000 in total. Each list holds a couple of hundred entries, and they´re all part of one map, with names like: xyz_asks, xyz_bids, xyz_history
I know it probably could all be alot more effecient in sqlite, but since it´s so rare I touch sql and really just wanted to proceed and see this stuff working, I gave up after two days and decided to build it all as lists.
So what I can say for sure here is that it´s not a bug in the code: The logging which shows the entries coming in via websockets is at a point where they´ll also amend the live orderbooks in my app, so my idea is that sometimes there´s so much data flowing in that the app does not have enough time to process the it. In the logfile there´s sometimes only 1-3 miliseconds between the time that events are written, so there´s alot going on - all the time.
I´m not so keen on sharing the code, which is why I´ve explained it all detailedly instead, and my question is:
How can I make sure that all events are processed when there are so many of them? I feel that DoEvents won´t do the job. I could of course build some sort of a queue system that does not process the next event untill the previous one is finished, but I´m hoping there´s a simpler way of doing this.
Thanks in advance!