Commit Graph

16 Commits

Author SHA1 Message Date
fawce 1a85781170 updated run method to use sim_params. 2013-02-18 10:24:32 -05:00
fawce 2c7355a0dc Refactoring of TradingEnvironment to isolate the global state: index symbol and exchange timezone. Parameters that define the simulation (start, end, and capital base) were put in a new class, SimulationParameters.
Global state for the financial simulation environment is accessed through the
zipline.finance.trading module, which now contains a module variable:
environment.

Parameters are passed into an algorithm as a keyword argument, sim_params.
SimulationParameters creates a trading day index for the test period that
can be used to find trading days, calculate distance between trading days,
and other common operations. The sim params index is just selected from the
global state.

================

Details:

    - adding delorean to the requirements.
    - made index symbol a parameter for loading the benchmark data. changed
    messagepack storage to be symbol specific.
    - ported risk, performance, algorithm, transforms, batch transforms
    and associated tests to use simulation parameters and global environment
    - factory and sim factory use global state and sim params
    - factory method parameter names now reflect the class expected
2013-02-18 10:24:32 -05:00
Eddie Hebert 81337d1306 Adds the ability to record variables.
Takes the value set for a variable on handle_data and records it,
e.g.:
```
    def initialize(self):
        self.incr = 0
        self.record_variables(['incr'])

    def handle_data(self, data):
        self.incr += 1
```

Would record a variable of `incr`.

Emits the recorded variables as part of the daily performance.

This batch combins work from:
Thomas Wiecki <thomas.wiecki@gmail.com> (@twiecki)
fawce <fawce@quantopian.com> (@fawce)
2013-01-31 08:16:54 -05:00
Thomas Wiecki 4615b29713 REF: Renamed granularity to data_frequency. 2012-12-30 11:50:46 -05:00
Thomas Wiecki 8346155f0e MIN: Override annualizer if set. New handling of granularity (no default arg anymore). Renamed minutely to minute. 2012-12-24 12:55:52 -05:00
Thomas Wiecki daf29c2d39 ENH: Add granularity and annualizer arguments to TradingAlgorithm. Accompanying doc string and unittest. 2012-12-20 12:49:24 -05:00
Thomas Wiecki 775c564ea1 ENH: Added DataPanelSource. 2012-12-13 12:55:05 -05:00
Richard Frank 095f2dd65b Date bookkeeping fixes in perf and risk
Issues appeared when we were close to the end of our
historical data.

Yielding DONE event with both perf and risk messages now
2012-12-12 15:23:26 -05:00
Eddie Hebert ab6b754922 Changes EventWindow parameter of days to window length.
The days parameter was causing confusion when explaining the
usage of the batch_transform decorator.
2012-11-20 11:52:27 -05:00
Tobias Brandt cf4d7ca353 Fixed unittest2 import error on Python 2.7
Changed all unittest2 imports to unittest
2012-11-12 10:49:14 -05:00
Thomas Wiecki 15ac658024 Restructured file hierarchy. Transforms now live in transforms (transform.py is now transforms/utils.py). Sources are in sources.py. VWAP is now MovingVWAP. 2012-10-19 18:10:51 -04:00
Thomas Wiecki 92f1dbef0c Fixes bug that .run() could not be called twice on an algorithm. Added unittest to check. 2012-10-19 11:47:59 -05:00
fawce 16b0d71506 refactoring of algorithm to make it work for both batch style run method, and generator style consumption. removed the portfolio property from the data parameter. added set_slippage and set_commission methods to algorithm. removed timeout tracking. 2012-10-10 16:06:32 -04:00
Eddie Hebert bbf2317c57 Saving point for adding license files. 2012-10-08 17:32:40 -04:00
Eddie Hebert 77af1ca632 Applies PEP-8 and pyflakes style to tests and zipline.
Mostly whitespace, line width and other spacing changes.
Also, removes use of deprecated has_key in favor of `in`

Going forward new patches should pass running `flake8` before
submission.
2012-10-05 12:14:09 -04:00
Thomas Wiecki 32c7dfbef9 Added test_algorithm.py. 2012-09-21 12:00:09 -04:00