mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-06 13:00:45 +08:00
MAINT: Add equity to naming of bar data classes.
In preparation of adding futures, add equity to the names of both the classes and methods for writing bcolz data. Futures data will use a different minutes per day with a separate reader. This change will allow both equity and futures fixtures to be side by side. Also, break out the method which generates the dataframes and trading days member into fixtures (`EquityMinuteBarData` and `EquityDailyBarData`) on which the `*BarReader` fixture depends. This fixture is separated out to enable reader/writers in different formats to use the same data setup. (There is internal code which needs to write minute and daily bar data in a database format.)
This commit is contained in:
@@ -32,7 +32,7 @@ from zipline.finance.blotter import Order
|
||||
|
||||
from zipline.data.data_portal import DataPortal
|
||||
from zipline.protocol import BarData
|
||||
from zipline.testing import tmp_bcolz_minute_bar_reader
|
||||
from zipline.testing import tmp_bcolz_equity_minute_bar_reader
|
||||
from zipline.testing.fixtures import (
|
||||
WithDataPortal,
|
||||
WithSimParams,
|
||||
@@ -57,7 +57,7 @@ class SlippageTestCase(WithSimParams, WithDataPortal, ZiplineTestCase):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def make_minute_bar_data(cls):
|
||||
def make_equity_minute_bar_data(cls):
|
||||
yield 133, pd.DataFrame(
|
||||
{
|
||||
'open': [3.0, 3.0, 3.5, 4.0, 3.5],
|
||||
@@ -91,7 +91,7 @@ class SlippageTestCase(WithSimParams, WithDataPortal, ZiplineTestCase):
|
||||
start=normalize_date(self.minutes[0]),
|
||||
end=normalize_date(self.minutes[-1])
|
||||
)
|
||||
with tmp_bcolz_minute_bar_reader(self.trading_schedule, days, assets) \
|
||||
with tmp_bcolz_equity_minute_bar_reader(self.trading_schedule, days, assets) \
|
||||
as reader:
|
||||
data_portal = DataPortal(
|
||||
self.env.asset_finder, self.trading_schedule,
|
||||
@@ -481,7 +481,7 @@ class SlippageTestCase(WithSimParams, WithDataPortal, ZiplineTestCase):
|
||||
start=normalize_date(self.minutes[0]),
|
||||
end=normalize_date(self.minutes[-1])
|
||||
)
|
||||
with tmp_bcolz_minute_bar_reader(self.trading_schedule, days, assets) \
|
||||
with tmp_bcolz_equity_minute_bar_reader(self.trading_schedule, days, assets) \
|
||||
as reader:
|
||||
data_portal = DataPortal(
|
||||
self.env.asset_finder, self.trading_schedule,
|
||||
|
||||
Reference in New Issue
Block a user