mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-09 11:19:23 +08:00
MAINT: Pass data_frequency to get_history_window
This allows us to remove the check for whether the provided dt had a time of midnight, which was a flimsy way to infer if the data frequency was 'daily'. Besides the explicit check being preferable, this method was broken on the futures calendar, since midnight is a valid market minute.
This commit is contained in:
@@ -101,7 +101,12 @@ class TestBenchmark(WithDataPortal, WithSimParams, WithTradingCalendars,
|
||||
# should be the equivalent of getting the price history, then doing
|
||||
# a pct_change on it
|
||||
manually_calculated = self.data_portal.get_history_window(
|
||||
[1], days_to_use[-1], len(days_to_use), "1d", "close"
|
||||
[1],
|
||||
days_to_use[-1],
|
||||
len(days_to_use),
|
||||
"1d",
|
||||
"close",
|
||||
"daily",
|
||||
)[1].pct_change()
|
||||
|
||||
# compare all the fields except the first one, for which we don't have
|
||||
@@ -187,6 +192,7 @@ class TestBenchmark(WithDataPortal, WithSimParams, WithTradingCalendars,
|
||||
len(days_to_use),
|
||||
"1d",
|
||||
"close",
|
||||
"daily",
|
||||
)[2].pct_change()
|
||||
|
||||
for idx, day in enumerate(days_to_use[1:]):
|
||||
|
||||
Reference in New Issue
Block a user