Files
catalyst/zipline/MESSAGES.py
T
Eddie Hebert e901e06f39 Changes the API for recording variables.
Uses a method called 'record' that provides a key value,
instead of providing keys to extract from context.

The variables are stored internally to the algorithm in a dictionary,
and not just stared as a property of the algorithm.

Main intent behind this change is to make the API more user friendly,
since the previous recorded_variables relies on the value to be set
in the algorithms context/self, the hope is that only having to use
the `record` method means less moving pieces and a more understandable
API.

i.e., instead of:

```
def initialize(self):
    recorded_variables('foo', bar')

def handle_data(self, data):
    self.foo = 1
    self.bar = 2
```

The API is now:

```
def initialize(self):
    pass

def handle_data(self, data):
    self.record(foo=1, bar=2)
```
2013-03-02 18:28:35 -05:00

41 lines
1.3 KiB
Python

# ---------------------
# Error Messages.
# User facing.
# ---------------------
class ERRORS(object):
# Raised if a user script calls the override_slippage magic
# with a slipage object that isn't a VolumeShareSlippage or
# FixedSlipapge
UNSUPPORTED_SLIPPAGE_MODEL = """
You attempted to override slippage with an unsupported class. \
Please use VolumeShareSlippage or FixedSlippage.
""".strip()
# Raised if a users script calls override_slippage magic
# after the initialize method has returned.
OVERRIDE_SLIPPAGE_POST_INIT = """
You attempted to override slippage after the simulation has \
started. You may only call override_slippage in your initialize \
method.
""".strip()
# Raised if a user script calls the override_commission magic
# with a commission object that isn't a PerShare or
# PerTrade commission
UNSUPPORTED_COMMISSION_MODEL = """
You attempted to override commission with an unsupported class. \
Please use PerShare or PerTrade.
""".strip()
# Raised if a users script calls override_commission magic
# after the initialize method has returned.
OVERRIDE_COMMISSION_POST_INIT = """
You attempted to override commission after the simulation has \
started. You may only call override_commission in your initialize \
method.
""".strip()