mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-07 11:20:19 +08:00
ENH: Adds a new api_method called get_environment so that users may
check if their algorithm is running in zipline or on Quantopian.
This commit is contained in:
@@ -126,6 +126,8 @@ class TradingAlgorithm(object):
|
||||
How much capital to start with.
|
||||
instant_fill : bool <default: False>
|
||||
Whether to fill orders immediately or on next bar.
|
||||
environment : str <default: 'zipline'>
|
||||
The environment that this algorithm is running in.
|
||||
"""
|
||||
self.datetime = None
|
||||
|
||||
@@ -139,6 +141,8 @@ class TradingAlgorithm(object):
|
||||
self._recorded_vars = {}
|
||||
self.namespace = kwargs.get('namespace', {})
|
||||
|
||||
self._environment = kwargs.pop('environment', 'zipline')
|
||||
|
||||
self.logger = None
|
||||
|
||||
self.benchmark_return_source = None
|
||||
@@ -470,6 +474,10 @@ class TradingAlgorithm(object):
|
||||
'args': args,
|
||||
'kwargs': kwargs}
|
||||
|
||||
@api_method
|
||||
def get_environment(self):
|
||||
return self._environment
|
||||
|
||||
@api_method
|
||||
def record(self, *args, **kwargs):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user