I am trying to convert (well, a lot) a column of returned data into a column of closing prices. In Clojure, I would use reductionsone that is similar to reduce, but returns a sequence of all intermediate values.
eg.
$ c
0.12
-.13
0.23
0.17
0.29
-0.11
$ c.reductions(init=1, lambda accumulator, ret: accumulator * (1 + ret))
1.12
0.97
1.20
1.40
1.81
1.61
NB: the actual closing price does not matter, therefore using 1 as the initial value. I just need a "mock" closing price.
The actual structure of my data is the DataFrame of the named columns of the TimeSeries. Iโm probably looking for a function similar applymap, but I would prefer not to do something hacked with this function and reference the DF from the inside (which, I suppose, is one of the solutions to this problem?)
, , returns, ""? TimeSeries (returns, closing_price)?