At the end of the day and as quickly outlined by @ab_trader you need to have something running in the background. The platform per se runs background threads when talking to external data providers, to manage the events and feed them properly into the platform.
You run your own threads and have them sleeping until
You use alternatives like the ones provided by @ab_trader
You try to full integrate your idea in the platform
The 3rd option could be achieved by means of a ghost data feed which delivers data points, being the
datetime the only one of interest to you.
It is of course always easier said than done, but a brief outline:
- You could subclass from
- Override the
- On entering the method and based on the
compressionparameters you calculate the remaining time until you hit the next time boundary.
- You wait and deliver
- Everything repeats from the beginning
Your data feed could be for example ticking each and every minute or could tick every hour or every 24 hours. Just an idea