I have some stock market data. I want to simulate the stock market by having prices sent at intervals that can be determined from the times at which trades occur.
What would the best way be to do this.
So far I have a class with static variables and methods in which I am storing the hour, min, millseconds for the last trade time. I then use the trade time for the current trade and calculate it from the stored last trade values.
I then store as a static member variable the "interval" in milliseconds in the same class as the time variables are stored.
I use this line:
timer.schedule(new RemindTask(), TimeStore.getNextInterval());
where TimeStore.getNextInterval() retrieves the interval that was calculated.
Can you think of a better way, this doesnt seem to work, nor does it seem very elegant.