mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-03 03:43:59 +08:00
TST: Fix increment in risk test that drops leading values.
The leading date of the date range was never called with update, because in the main loop the todays_date variable was incremented before update was called. Fix by moving the increment to the next trading day to after the call to update.
This commit is contained in:
@@ -78,9 +78,6 @@ class RiskCompareIterativeToBatch(unittest.TestCase):
|
||||
)
|
||||
cur_returns.append(todays_return_obj)
|
||||
|
||||
# Move forward day counter to next trading day
|
||||
todays_date = trading.environment.next_trading_day(todays_date)
|
||||
|
||||
try:
|
||||
risk_metrics_original = risk.RiskMetricsBatch(
|
||||
start_date=start_date,
|
||||
@@ -103,6 +100,9 @@ class RiskCompareIterativeToBatch(unittest.TestCase):
|
||||
ret,
|
||||
self.all_benchmark_returns[todays_return_obj.date])
|
||||
|
||||
# Move forward day counter to next trading day
|
||||
todays_date = trading.environment.next_trading_day(todays_date)
|
||||
|
||||
self.assertEqual(
|
||||
risk_metrics_original.start_date,
|
||||
risk_metrics_refactor.start_date)
|
||||
|
||||
Reference in New Issue
Block a user