mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-28 13:35:43 +08:00
added tests to confirm the full environment returns as expected.
This commit is contained in:
@@ -503,11 +503,11 @@ class TestAlgoScript(TestCase):
|
||||
algo.run(self.df)
|
||||
|
||||
def test_api_get_environment(self):
|
||||
environment = 'zipline'
|
||||
platform = 'zipline'
|
||||
algo = TradingAlgorithm(script=api_get_environment_algo,
|
||||
environment=environment)
|
||||
platform=platform)
|
||||
algo.run(self.df)
|
||||
self.assertEqual(algo.environment, environment)
|
||||
self.assertEqual(algo.environment, platform)
|
||||
|
||||
def test_api_symbol(self):
|
||||
algo = TradingAlgorithm(script=api_symbol_algo)
|
||||
|
||||
@@ -148,7 +148,7 @@ class TradingAlgorithm(object):
|
||||
self._recorded_vars = {}
|
||||
self.namespace = kwargs.get('namespace', {})
|
||||
|
||||
self._environment = kwargs.pop('environment', 'zipline')
|
||||
self._platform = kwargs.pop('platform', 'zipline')
|
||||
|
||||
self.logger = None
|
||||
|
||||
@@ -552,7 +552,7 @@ class TradingAlgorithm(object):
|
||||
'start': self.sim_params.first_open,
|
||||
'end': self.sim_params.last_close,
|
||||
'capital_base': self.sim_params.capital_base,
|
||||
'platform': self._environment
|
||||
'platform': self._platform
|
||||
}
|
||||
if field == '*':
|
||||
return env
|
||||
|
||||
Reference in New Issue
Block a user