mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-04 01:56:36 +08:00
MAINT: Move market minute function into trading environment.
So that the market minutes are more accessible to other modules.
This commit is contained in:
@@ -124,8 +124,7 @@ class RiskMetricsCumulative(object):
|
||||
"""
|
||||
trading_minutes = None
|
||||
for day in self.trading_days:
|
||||
mkt_open, mkt_close = trading.environment.get_open_and_close(day)
|
||||
minutes_for_day = pd.date_range(mkt_open, mkt_close, freq='T')
|
||||
minutes_for_day = trading.environment.market_minutes_for_day(day)
|
||||
if trading_minutes is None:
|
||||
# Create container for all minutes on first iteration
|
||||
trading_minutes = minutes_for_day
|
||||
|
||||
@@ -199,6 +199,10 @@ Last successful date: %s" % self.last_trading_day)
|
||||
|
||||
return market_open, market_close
|
||||
|
||||
def market_minutes_for_day(self, midnight):
|
||||
market_open, market_close = self.get_open_and_close(midnight)
|
||||
return pd.date_range(market_open, market_close, freq='T')
|
||||
|
||||
def get_trading_day_duration(self, trading_day):
|
||||
trading_day = self.normalize_date(trading_day)
|
||||
if trading_day in self.early_closes:
|
||||
|
||||
Reference in New Issue
Block a user