Open
Description
When testing with hourly data instead of the daily on the example app (ms/ml) and calling the summary, I get the following error:
Traceback (most recent call last):
File "pyback1.py", line 75, in <module>
print(bt.summary())
File "/usr/local/lib/python3.7/site-packages/pybacktest/backtest.py", line 174, in summary
print((yaml.dump(self.report, allow_unicode=True, default_flow_style=False)))
File "/usr/local/lib/python3.7/site-packages/cached_property.py", line 35, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/usr/local/lib/python3.7/site-packages/pybacktest/backtest.py", line 164, in report
return pybacktest.performance.performance_summary(self.equity)
File "/usr/local/lib/python3.7/site-packages/cached_property.py", line 35, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/usr/local/lib/python3.7/site-packages/pybacktest/backtest.py", line 152, in equity
return pybacktest.parts.trades_to_equity(self.trades)
File "/usr/local/lib/python3.7/site-packages/cached_property.py", line 35, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/usr/local/lib/python3.7/site-packages/pybacktest/backtest.py", line 142, in trades
assert p.index.tz == tp.index.tz, "Cant operate on singals and prices " \
AttributeError: 'Index' object has no attribute 'tz'
The data looks similar, with the date format being more detailed.
I was using pd.to_datetime on a csv (without a timezone information). If there is no TimeZone information it would be nice to have a better error message.
Solution: Add a Timezone, pd.to_datetime(x, utc=True) in my case
Metadata
Metadata
Assignees
Labels
No labels