mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 23:26:38 +08:00
MAINT: Removed unused prior_day_open from SimulationParameters
This commit is contained in:
@@ -272,9 +272,7 @@ class SimulationParameters(object):
|
||||
# take an inclusive slice of the environment's
|
||||
# trading_days.
|
||||
self.trading_days = \
|
||||
environment.trading_days[start_index:end_index+1]
|
||||
|
||||
self.prior_day_open = self.calculate_prior_day_open()
|
||||
environment.trading_days[start_index:end_index + 1]
|
||||
|
||||
assert self.period_start <= self.period_end, \
|
||||
"Period start falls after period end."
|
||||
@@ -297,24 +295,6 @@ class SimulationParameters(object):
|
||||
mkt_open, _ = environment.get_open_and_close(first_open)
|
||||
return mkt_open
|
||||
|
||||
def calculate_prior_day_open(self):
|
||||
"""
|
||||
Finds the first trading day open that falls at least a day
|
||||
before period_start.
|
||||
"""
|
||||
one_day = datetime.timedelta(days=1)
|
||||
first_open = self.period_start - one_day
|
||||
|
||||
if first_open <= environment.first_trading_day:
|
||||
log.warn("Cannot calculate prior day open.")
|
||||
return self.period_start
|
||||
|
||||
while not environment.is_trading_day(first_open):
|
||||
first_open = first_open - one_day
|
||||
|
||||
mkt_open, _ = environment.get_open_and_close(first_open)
|
||||
return mkt_open
|
||||
|
||||
def calculate_last_close(self):
|
||||
"""
|
||||
Finds the last trading day on or before self.period_end
|
||||
|
||||
Reference in New Issue
Block a user