ENH: Add USEquityPricingLoader.from_files.

This commit is contained in:
Scott Sanderson
2015-11-07 15:50:30 -05:00
parent f169bb00aa
commit ac7b44af23
@@ -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