fidoandfido / blackswan

Blackswan Stock Game
Other
2 stars 0 forks source link

Graphing of historical data - share price #6

Closed fidoandfido closed 13 years ago

fidoandfido commented 13 years ago

Graphing of historical data using JFreeChart should be undertaken ASAP.

Share Price is probably the most important piece of data.

fidoandfido commented 13 years ago

Okay, so now we have a problem. Shares are sold and the time that is recorded is the wall time; this should potentially be converted to 'period' time - ie time related to the period. This is actually going to be slightly non-trivial; the easiest way to do this would be at the time of the event, since at that point there we can get access to 'when' it is in the period.

Since graphs of profit / loss and so on are going to be against game time, it makes sense that share prices should be too.

This would require the conversion of the share prices to arbitrary precision to a period in the day.

This would also meant that we can potentially create graphs of share prices versus book value and earning per share over time.

The alternative is to always use wall time; I am less enamoured of this idea.

fidoandfido commented 13 years ago

Turns out using wall time is not as dumb as I thought. Since periods all have wall time recorded, it actually makes life quite easy, but will probably have to be revisited in the future.

So I have done up some graphs, and am about to commit. Some work to be done, I will probably look at purchasing the jfreechart manual in order to get the graphs to look suitably pretty, but in the mean time it is pretty cool.

To get the required data, I have included a new attribute in the company period report - share count. This is to take into consideration the fact that stocks will split over time. This allows quick and easy calculation of book value and earning per share. To implement this with the existing data set, I added the column and set it's value to be 100,000 (the default starting value). This is good; except when a company has already split. Then hilarity ensues.

Code to be promoted shortly!

sherhan commented 13 years ago

Tool tips on the graph would be nice, so that when you scroll your mouse curser over a point you can see its price. This feature is pretty standard on most financial graphing apps.

fidoandfido commented 13 years ago

A number of issues currently with graphs:

  1. colors are crap
  2. Hover over stuff should be added. This can be generated using the Chart object that is instantiated in the JSP page, before it is put into the session to be spat out by the servlet.
  3. Data points should be more spread out, and more consistent. At the moment it is possible to have multiple prices at the same 'time'.
  4. Titles and axis labelling should be fixed up
fidoandfido commented 13 years ago

Colours slightly better and the data points are slightly better. Still some work required for this to really 'shine'.

fidoandfido commented 13 years ago

For a first cut, this is done. I will create new issues for graphing problems as they arise.