You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
There seem to be a case where calc_stats() breaks.
There is a division by zero which is occuring when the the computation of twelve_month_win_perc occurs.
Here is the example:
import ffn
data = ffn.get('agg,hyg,spy,eem,efa', start='2010-01-01', end='2014-01-01')
data.ix['2012-07':'2013-03'].calc_stats()
If I may I'll tend to amend that this way:
tot = 0
win = 0
if len(mr) >11:
for i in range(11, len(mr)):
tot = tot + 1
if mp[i] / mp[i - 11] > 1:
win = win + 1
self.twelve_month_win_perc = float(win) / max(tot,1)
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered:
Hello,
There seem to be a case where calc_stats() breaks.
There is a division by zero which is occuring when the the computation of twelve_month_win_perc occurs.
Here is the example:
import ffn
data = ffn.get('agg,hyg,spy,eem,efa', start='2010-01-01', end='2014-01-01')
data.ix['2012-07':'2013-03'].calc_stats()
If I may I'll tend to amend that this way:
tot = 0
win = 0
if len(mr) >11:
for i in range(11, len(mr)):
tot = tot + 1
if mp[i] / mp[i - 11] > 1:
win = win + 1
self.twelve_month_win_perc = float(win) / max(tot,1)
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered: