mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-13 17:42:42 +08:00
BUG: Explicitly add support for refresh period of 0.
In the previous implementation of batch transform it happened that a window_length of `0` caused the transform to update on every bar, for the time being that behavior should be retained, though the new rolling implementation more correctly aligns to the term of 'period' so a period of 1 would achieve the same effect.
This commit is contained in:
@@ -463,11 +463,17 @@ class BatchTransform(object):
|
||||
|
||||
#################################################
|
||||
# Determine whether we should call the transform
|
||||
# 0. Support historical/legacy usage of '0' signaling,
|
||||
# 'update on every bar'
|
||||
if self.refresh_period == 0:
|
||||
period_signals_update = True
|
||||
else:
|
||||
# 1. Is the refresh period over?
|
||||
period_over = self.trading_days_total % self.refresh_period == 0
|
||||
period_signals_update = (
|
||||
self.trading_days_total % self.refresh_period == 0)
|
||||
# 2. Have the args or kwargs been changed since last time?
|
||||
args_updated = args != self.last_args or kwargs != self.last_kwargs
|
||||
recalculate_needed = args_updated or (period_over and
|
||||
recalculate_needed = args_updated or (period_signals_update and
|
||||
self.updated)
|
||||
|
||||
if recalculate_needed:
|
||||
|
||||
Reference in New Issue
Block a user