mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-12 09:10:00 +08:00
MAINT: Fix failures/warnings in test_api_shim.py
- Fixes a warning on indexing with a float that ultimately came from pd.Timedelta.total_seconds(). Adds ``timedelta_to_integral_seconds`` and ``timedelta_to_integral_minutes()`` functions and replaces various usages of ``int(delta.total_seconds())`` with them. - Fixes a warnings triggered in ``_create_daily_stats`` from passing tz-aware datetimes to np.datetime64.
This commit is contained in:
@@ -819,8 +819,9 @@ class TradingAlgorithm(object):
|
||||
else:
|
||||
self.risk_report = perf
|
||||
|
||||
daily_dts = [np.datetime64(perf['period_close'], utc=True)
|
||||
for perf in daily_perfs]
|
||||
daily_dts = pd.DatetimeIndex(
|
||||
[p['period_close'] for p in daily_perfs], tz='UTC'
|
||||
)
|
||||
daily_stats = pd.DataFrame(daily_perfs, index=daily_dts)
|
||||
|
||||
return daily_stats
|
||||
|
||||
Reference in New Issue
Block a user