mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 15:42:03 +08:00
MAINT: Remove equity from history loader classname
Prepare for using history loaders with both equity and future data,
This commit is contained in:
@@ -24,11 +24,11 @@ from six.moves import reduce
|
||||
|
||||
from zipline.assets import Asset, Future, Equity
|
||||
from zipline.data.resample import DailyHistoryAggregator
|
||||
from zipline.data.us_equity_pricing import NoDataOnDate
|
||||
from zipline.data.us_equity_loader import (
|
||||
USEquityDailyHistoryLoader,
|
||||
USEquityMinuteHistoryLoader,
|
||||
from zipline.data.history_loader import (
|
||||
DailyHistoryLoader,
|
||||
MinuteHistoryLoader,
|
||||
)
|
||||
from zipline.data.us_equity_pricing import NoDataOnDate
|
||||
|
||||
from zipline.utils.math_utils import (
|
||||
nansum,
|
||||
@@ -137,7 +137,7 @@ class DataPortal(object):
|
||||
|
||||
self._equity_daily_reader = equity_daily_reader
|
||||
if self._equity_daily_reader is not None:
|
||||
self._equity_history_loader = USEquityDailyHistoryLoader(
|
||||
self._equity_history_loader = DailyHistoryLoader(
|
||||
self.trading_calendar,
|
||||
self._equity_daily_reader,
|
||||
self._adjustment_reader
|
||||
@@ -163,7 +163,7 @@ class DataPortal(object):
|
||||
self._equity_minute_reader,
|
||||
self.trading_calendar
|
||||
)
|
||||
self._equity_minute_history_loader = USEquityMinuteHistoryLoader(
|
||||
self._equity_minute_history_loader = MinuteHistoryLoader(
|
||||
self.trading_calendar,
|
||||
self._equity_minute_reader,
|
||||
self._adjustment_reader
|
||||
|
||||
@@ -69,9 +69,9 @@ class SlidingWindow(object):
|
||||
return self.current
|
||||
|
||||
|
||||
class USEquityHistoryLoader(with_metaclass(ABCMeta)):
|
||||
class HistoryLoader(with_metaclass(ABCMeta)):
|
||||
"""
|
||||
Loader for sliding history windows of adjusted US Equity Pricing data.
|
||||
Loader for sliding history windows, with support for adjustments.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -131,7 +131,7 @@ class USEquityHistoryLoader(with_metaclass(ABCMeta)):
|
||||
field : str
|
||||
OHLCV field for which to get the adjustments.
|
||||
is_perspective_after : bool
|
||||
see: `USEquityHistoryLoader.history`
|
||||
see: `PricingHistoryLoader.history`
|
||||
If True, the index at which the Multiply object is registered to
|
||||
be popped is calculated so that it applies to the last slot in the
|
||||
sliding window when the adjustment occurs immediately after the dt
|
||||
@@ -237,7 +237,7 @@ class USEquityHistoryLoader(with_metaclass(ABCMeta)):
|
||||
field : str
|
||||
The OHLCV field for which to retrieve data.
|
||||
is_perspective_after : bool
|
||||
see: `USEquityHistoryLoader.history`
|
||||
see: `PricingHistoryLoader.history`
|
||||
|
||||
Returns
|
||||
-------
|
||||
@@ -379,7 +379,7 @@ class USEquityHistoryLoader(with_metaclass(ABCMeta)):
|
||||
return hstack([window.get(end_ix) for window in block])
|
||||
|
||||
|
||||
class USEquityDailyHistoryLoader(USEquityHistoryLoader):
|
||||
class DailyHistoryLoader(HistoryLoader):
|
||||
|
||||
@property
|
||||
def _prefetch_length(self):
|
||||
@@ -398,7 +398,7 @@ class USEquityDailyHistoryLoader(USEquityHistoryLoader):
|
||||
)[0]
|
||||
|
||||
|
||||
class USEquityMinuteHistoryLoader(USEquityHistoryLoader):
|
||||
class MinuteHistoryLoader(HistoryLoader):
|
||||
|
||||
@property
|
||||
def _prefetch_length(self):
|
||||
Reference in New Issue
Block a user