Commit Graph
92 Commits
Author SHA1 Message Date
Thomas WieckiandEddie Hebert 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 95ce2d90cf Removes unused constant and redirection of imports.
Removes TRANSFORM_TYPE from protocol, since it is unused.

Also, removes use of ndict as a member of protocol, since it's
import there was for the TRANSFORM_TYPE. Changed to
utils.protocol_utils instead.
2012-10-15 22:57:06 -04:00
fawceandEddie Hebert 815c9f2cf6 providing default behavior for positions dictionary. non-existent positions are
returned as zero size/value positions.
2012-10-10 16:08:14 -04:00
fawceandEddie Hebert d9cf193ce0 fixes to unit tests 2012-10-10 16:07:11 -04:00
fawceandEddie Hebert e3f750014e __missing__ needs to put the value into the dictionary 2012-10-10 16:06:55 -04:00
fawceandEddie Hebert 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
fawce fe8e107c59 dropping max drawdown, adding pytz to whitelist. 2012-09-14 16:00:13 -04:00
Eddie Hebert 215a64ed6a Removes unused import of zmq. 2012-08-23 23:48:24 -04:00
scottsanderson 22523b5c12 clean up cruft and fix bugs from timeout rename 2012-08-23 13:09:31 -04:00
scottsanderson 24fddfbde0 tradingcalender, attempt #2 2012-08-22 02:50:16 -04:00
scottsanderson 1f78a07d30 refactor tradesimulation client to not use StatefulTransform unnecessarily 2012-08-21 19:55:40 -04:00
fawce 1479adf519 fixed infinite looking loop in risk reporting, thanks to groupby 2012-08-21 19:26:46 +00:00
fawce 196c681d4b fixes for max drawdown 2012-08-09 21:43:26 -04:00
scottsanderson 8437a28c14 generator-style perf now sends a risk report on receipt of DONE 2012-08-03 21:09:05 -04:00
scottsanderson 56177a7c4f end to end zipline with pure generators 2012-08-02 00:49:48 -04:00
scottsanderson 14067d8323 commit for fawce 2012-08-01 21:42:55 -04:00
fawce 6de01a1c6e added support for any component to relay exceptions through monitor. 2012-08-01 14:56:17 -04:00
scottsanderson 6cb3516b6b save for attempted merge 2012-08-01 11:12:09 -04:00
fawce 5dd35a4709 added default positions for portfolio object. 2012-07-19 23:31:14 -04:00
fawce 1262dcdef1 logging converted to share socket with performance 2012-07-17 11:04:32 -04:00
scottsanderson a789db1789 make git happy 2012-07-04 03:48:28 -04:00
fawce 2a8e19b22f name change for positions_value 2012-06-21 22:08:25 -04:00
fawce ba05335b2c logging every update was spamming the console during unit tests... 2012-06-18 19:11:13 -04:00
Stephen Diehl 9c9cddb2e8 Tidy up logging statements. 2012-06-13 16:21:43 -04:00
Stephen Diehl 61ee2420eb Removed dummy print statement. 2012-06-12 13:31:48 -04:00
Stephen Diehl 06e6207020 Update logging system 2012-06-12 07:11:52 -04:00
Stephen Diehl 2d85ec4d95 Update performance tracker ot use Logbook 2012-06-11 13:54:00 -04:00
fawce 0dea9c5ecb finished comment 2012-06-07 17:58:30 -04:00
fawce 6a8654342a added an as_portfolio method to the PerformancePeriod. 2012-06-07 17:40:26 -04:00
fawce 6d8a786214 updated performance to be trade by trade. 2012-06-07 13:53:45 -04:00
Stephen Diehl 318d7ba678 Fun fun times writing setup.py 2012-05-26 18:24:48 -04:00
Stephen Diehl 817166ba03 Merge branch 'master' into cheetah 2012-05-26 15:55:48 -04:00
Stephen Diehl 3446c116ab Process Simulator! 2012-05-26 15:54:43 -04:00
fawce 70b0088e02 patched logging config. 2012-05-22 21:23:47 -04:00
Stephen Diehl 3ad1f250e6 Cleaned up OOP, first round. 2012-05-16 14:33:16 -04:00
Stephen Diehl d399edd419 Fix ndict woes. 2012-05-14 13:49:45 -04:00
Stephen Diehl e04415e63f Remove all namedicts. 2012-05-14 11:35:43 -04:00
Stephen Diehl 133d9c03af One test passing, progress! 2012-05-10 16:38:04 -04:00
fawce 54f8d7d013 removed lines sending messages to the control channel, simplified logic for handling max loss case, DONE'ing trading client on max loss. Zipline continues to run until all components are finished. 2012-04-24 17:51:02 -04:00
fawce 1f04ee4ece committed a set_trace... 2012-04-23 21:04:51 -04:00
fawce fe793b503d hotpatching a merge error (duplication of the max dd check). 2012-04-23 20:50:08 -04:00
fawce 54d3579ceb added boolean to results for exceeding max losses in a single simulated day. 2012-04-23 15:10:44 -04:00
fawce 1d9953255a added stop out for max drawdown. 2012-04-20 23:41:23 -04:00
fawce bab0e2bd19 made distinction between cumulative behavior and daily behavior a bit more clear. 2012-04-20 15:08:39 -04:00
fawce bc14e7e3b7 zipline, now a cold, heartless, http://open.spotify.com/track/1xshgoh575otNXRfeYgh9D
Pretty fast too...
2012-04-20 12:21:03 -04:00
fawce 6f5e9b0559 fixed documentation 2012-04-19 23:32:37 -04:00
fawce 08a5bd5a0d re-arranged fields so that history includes daily snapshots for cumulative measures. 2012-04-19 23:27:35 -04:00
fawce 1b5b92d75f dropped unwanted fields. 2012-04-18 12:36:46 -04:00