Quote:
|
Originally Posted by Dirk
Calculating the trend (and thereby predicting market direction) turned out to be very expensive in terms of processor time.
|
Our private beta draws it's charts based on three trendlines monitored for each item. The history data is updated in intervals of four hours, to be able to plot the node values needed for when a chart is requested.
For that matter, the indicator panels on the MyTwoPecs.com homepage are tracked in the same way, just getting the change in the last
x number of days for the specific item. Effectively it does echo the hashtables concept as Dirk had suggested.
Right now, the plan is to keep poll history data for each item in game, with different
poll type categories.
For example, when live, a record should will exist ...
- for each hour (24 per day)
- for each fourth hour (six per day)
- for each twelfth hour (two per day)
- for each day
- for each week
... in the timeline.
In each type, it would be the average price for the period that the poll record represents, not just the current price at that exact moment.
The reason this has been planned anyway, is to allow the chart factory to be able to select less nodes from the database when it attempts to draw a chart for a long period of time. Currently, every single node over a period gets drawn, which is overkill when too many nodes exist for the pixel width of the graph.
Approximately 900 nodes on a 674px wide graph...

Click to enlarge
Switching the date range of the indicator panels (since it would use the same information as the chart factory) would add the same load on the database server, but it will probably be called much more often than charts would.
So, if stress testing indicates that it is still too much processing work to get the results when the server is loaded, pre-cached panels can exist for the specific set of date ranges (1xhour, 4xhour, 12x hour, 24x hour, etc).
We'll find the solution in there somewhere. A someone once said ...
There's more than one way to skin a cat.