mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-12 12:12:04 +08:00
MAINT: Removes the ability to reference a global TradingEnvironment
This commit removes the ability to reference a shared TradingEnvironment through the zipline.finance.trading module. In place, the classes that require a TradingEnvironment, or its child AssetFinder, contain their own references to those objects. This commit also adds serialization utilities that allow for the pickling/unpickling of objects without unintentionally their TradingEnvironments or AssetFinders.
This commit is contained in:
@@ -96,13 +96,16 @@ TEST_QUERY_ASSETS = EQUITY_INFO.index
|
||||
|
||||
class BcolzDailyBarTestCase(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
all_trading_days = TradingEnvironment.instance().trading_days
|
||||
self.trading_days = all_trading_days[
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
all_trading_days = TradingEnvironment().trading_days
|
||||
cls.trading_days = all_trading_days[
|
||||
all_trading_days.get_loc(TEST_CALENDAR_START):
|
||||
all_trading_days.get_loc(TEST_CALENDAR_STOP) + 1
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
|
||||
self.asset_info = EQUITY_INFO
|
||||
self.writer = SyntheticDailyBarWriter(
|
||||
self.asset_info,
|
||||
@@ -401,7 +404,7 @@ class USEquityPricingLoaderTestCase(TestCase):
|
||||
writer.write(SPLITS, MERGERS, DIVIDENDS)
|
||||
|
||||
cls.assets = TEST_QUERY_ASSETS
|
||||
all_days = TradingEnvironment.instance().trading_days
|
||||
all_days = TradingEnvironment().trading_days
|
||||
cls.calendar_days = all_days[
|
||||
all_days.slice_indexer(TEST_CALENDAR_START, TEST_CALENDAR_STOP)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user