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:
jfkirk
2015-09-10 11:53:28 -04:00
parent 661314ce49
commit dc964a7e7d
45 changed files with 1484 additions and 1173 deletions
-4
View File
@@ -31,8 +31,6 @@ from zipline.utils import parse_args, run_pipeline
# Otherwise the next line sometimes complains about being run too late.
_multiprocess_can_split_ = False
from zipline.finance import trading
matplotlib.use('Agg')
@@ -47,8 +45,6 @@ class ExamplesTests(TestCase):
@parameterized.expand(((os.path.basename(f).replace('.', '_'), f) for f in
glob.glob(os.path.join(example_dir(), '*.py'))))
def test_example(self, name, example):
# Create a new trading environment for each test.
trading.environment = trading.TradingEnvironment()
imp.load_source('__main__', os.path.basename(example), open(example))
# Test algorithm as if scripts/run_algo.py is being used.