Example return
Record
{ product: 1,
index: null,
category: null,
type: 'monthly',
year: 2007,
month: 8,
day: null,
value: 0.27992,
id: 1,
createdAt: Tue Oct 21 2014 10:18:01 GMT-0500 (CDT),
updatedAt: Tue Oct 21 2014 10:18:01 GMT-0500 (CDT) }
The problem is, getAAR should accept an array of "share price" values in USD. These are always positive. Currently it accepts an array of "percentage change in value from current month".
With the current state of our "return" records.
- each element in the arguments array is the 'value' field of one months return record.
- to evaluate a 3 year period, getAAR would get 12*3 data points.
getAAR([4,1,-1,2]) ~ 6/2 = 3
getAAR([4,1,-1,2]) ~ 4thRoot(41-1*2) ~ 4thRoot(-8) = NaN