mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-09 17:12:54 +08:00
ENH: Add USEquityPricingLoader.from_files.
This commit is contained in:
@@ -16,6 +16,10 @@ from numpy import (
|
||||
uint32,
|
||||
)
|
||||
|
||||
from zipline.data.us_equity_pricing import (
|
||||
BcolzDailyBarReader,
|
||||
SQLiteAdjustmentReader,
|
||||
)
|
||||
from zipline.lib.adjusted_array import (
|
||||
adjusted_array,
|
||||
)
|
||||
@@ -40,6 +44,24 @@ class USEquityPricingLoader(PipelineLoader):
|
||||
self._calendar = self.raw_price_loader._calendar
|
||||
self.adjustments_loader = adjustments_loader
|
||||
|
||||
@classmethod
|
||||
def from_files(cls, pricing_path, adjustments_path):
|
||||
"""
|
||||
Create a loader from a bcolz equity pricing dir and a SQLite
|
||||
adjustments path.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
pricing_path : str
|
||||
Path to a bcolz directory written by a BcolzDailyBarWriter.
|
||||
adjusments_path : str
|
||||
Path to an adjusments db written by a SQLiteAdjustmentWriter.
|
||||
"""
|
||||
return cls(
|
||||
BcolzDailyBarReader(pricing_path),
|
||||
SQLiteAdjustmentReader(adjustments_path)
|
||||
)
|
||||
|
||||
def load_adjusted_array(self, columns, dates, assets, mask):
|
||||
# load_adjusted_array is called with dates on which the user's algo
|
||||
# will be shown data, which means we need to return the data that would
|
||||
|
||||
Reference in New Issue
Block a user