File tree Expand file tree Collapse file tree 1 file changed +0
-11
lines changed Expand file tree Collapse file tree 1 file changed +0
-11
lines changed Original file line number Diff line number Diff line change @@ -112,19 +112,8 @@ def cum_returns(returns, starting_value=0):
112
112
pd.Series, np.ndarray, or pd.DataFrame
113
113
Series of cumulative returns.
114
114
115
- Note
116
- ----
117
- For increased numerical accuracy, convert input to log returns
118
- where it is possible to sum instead of multiplying::
119
115
120
- PI((1+r_i)) - 1 = exp(ln(PI(1+r_i))) # x = exp(ln(x))
121
- = exp(SIGMA(ln(1+r_i)) # ln(a*b) = ln(a) + ln(b)
122
116
"""
123
- # df_price.pct_change() adds a nan in first position, we can use
124
- # that to have cum_logarithmic_returns start at the origin so that
125
- # df_cum.iloc[0] == starting_value
126
- # Note that we can't add that ourselves as we don't know which dt
127
- # to use.
128
117
129
118
if len (returns ) < 1 :
130
119
return type (returns )([])
You can’t perform that action at this time.
0 commit comments