Closed yadavsushil07 closed 8 years ago
Hi yadavsushil07,
Just to check - did you update the new requirements?
Mike.
@yadavsushil07 -- this error will happen when no ticks are passed through the backtesting loop. It's trying to find the highest drawdown point, but doesn't have any data to check against.
Are you running your own strategy? If so, suggest opening up one of the example strategies and copying it as closely as possible. A lot has changed in the last month or so.
Maybe we should return np.nan
in case of a ValueError
def calculate_max_drawdown_pct(self):
"""
Calculate the percentage drop related to the "worst"
drawdown seen.
"""
drawdown_series = pd.Series(self.drawdowns)
equity_series = pd.Series(self.equity)
bottom_index = drawdown_series.idxmax()
try:
top_index = equity_series[:bottom_index].idxmax()
pct = (
(equity_series.ix[top_index] - equity_series.ix[bottom_index]) /
equity_series.ix[top_index] * 100
)
return round(pct, 4)
except ValueError:
return np.nan
because backtest shouldn't fail if we only apply DisplayStrategy
(for example or any strategy that doesn't send any trade signal)
@yadavsushil07 please use triple backquotes (or indent) for code https://help.github.com/articles/creating-and-highlighting-code-blocks/
@femtotrader Thanks will be doing it. The issue is resolved, I have modified Execution Handler. After changing the code as per the sample its working fine.
You shouldn't close this issue... because there is still an issue!
when no trades occurs statistics/simple.py
is raising same ValueError
exception and it need to be solved on statistics side.
Reopening the issue, as there shouldn't be ValueError
when no data.
This PR https://github.com/mhallsmoore/qstrader/pull/97 should fix it... waiting to be merged by @mhallsmoore
Ok, I've merged #97.
Thanks
Getting below error while running the backtest, it started after I did pull all new changes after a month. I am passing a minute bar data.
Any clue what is happening. It used to give result on old code (an month old code.)