Commit Graph

13 Commits

Author SHA1 Message Date
Thomas Wiecki b976c1252b Provides an iterative version of risk metrics.
I wrote this a little while ago as I noticed that a lot of time is spent
computing risk statistics. This is done over the complete history over
and over again while this could be done just by using the previously
computed value (iteratively).

We didn't go forward back then because for minute trade data the
difference was not significant enough. However, now with zipline
standalone I think most people will use daily (because that's
what's available) and it makes a huge difference
(speed-up of a couple of 100%).

Unfortunately, we can't just replace the existing one with an
iterative as for the final cumulative stats the batch is still
better. So that's not as nice, but the performance increase is
big enough for me to issue this PR (zipline is actually painfully
slow with daily data).

There is a unittest that compares that both produce exactly
the same outputs.

Speed measurements (for 500 trading days, daily source):

with iterative:
real 26.617 user 12.909 sys 6.112 pcpu 71.46

prior:
real 44.176 user 31.030 sys 11.381 pcpu 96.00
2012-10-17 23:41:30 -04:00
Eddie Hebert 9500163ed8 Adds Apache 2.0 license header to source files. 2012-10-08 17:32:41 -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 e353900010 Added 2 year data file. 2012-09-25 16:53:57 -04:00
Thomas Wiecki e09695819e Cleaned up example.py code. 2012-09-25 16:10:50 -04:00
Thomas Wiecki 53de4effd3 stdout_capture was causing problems for ipython notebook. 2012-09-25 14:53:13 -04:00
Thomas Wiecki 729a4d9058 Large refactoring and documentation of new algorithm base class and batch transform. 2012-09-19 17:49:39 -04:00
Thomas Wiecki 7242a4ee86 BUG: asserting for correct index type. 2012-09-18 13:56:58 -04:00
Thomas Wiecki 280f122353 WIP: Lot of refactoring and bugfixing. 2012-09-17 18:35:21 -04:00
Thomas Wiecki 5d00099243 example code now retrieves data from yahoo finance. 2012-09-17 12:15:36 -04:00
Thomas Wiecki 7c0329bb76 Resolved conflicts 2012-08-23 10:54:02 -04:00
Thomas Wiecki 3884b15eb6 ENH: Changed algorithm class to provide .run() method. Testing of multiple param combos of DMA. 2012-08-12 20:24:34 -04:00
Thomas Wiecki 51f01c0f1f ENH: Implemented new Zipline interface. Implemented Algorithm base class. Implemented example algorithm. Implemented example.py code. 2012-08-10 17:23:08 -04:00