Commit Graph

40 Commits

Author SHA1 Message Date
Eddie Hebert b3efb5eb69 MAINT: Remove ndict class.
Now that ndict is no longer used in any part of the system during
a backtest, remove all remaining references in tests, etc.
2013-04-26 16:03:01 -04:00
Eddie Hebert f2d618b466 MAINT: Moves create_trade out of gens.utils
Slight refactoring of moving create_trade so that it's alongside
other testing/mock data utilities, instead of part of the gens module.
2013-03-25 23:51:25 -04:00
Eddie Hebert 45e28a4b9d MAINT: Updates copyright year on gens.utils module. 2013-03-25 23:51:20 -04:00
Eddie Hebert 33a1ed305f MAINT: Removes alternate function from gens.utils
This function is no longer refrenced elsewhere in the codebase.
2013-03-25 23:51:12 -04:00
Eddie Hebert 5118789e9b MAINT: Removes unused mock data function from gens.utils
This function is unused, and on the general path of moving testing
functions out of gens.utils
 # Please enter the commit message for your changes. Lines starting
2013-03-25 23:50:59 -04:00
fawce 817ed88e38 Adds dividends to performance tracking.
Algorithm returns and the risk calculations that depend on them now include
cash dividends. This commit does _not_ provide an API for user algorithms to
access dividends.

PerformanceTracker expects the dividend data to arrive as events, similar to
the way that Trades arrive. Dividends are expected to have adjusted payment
amounts that are inline with adjusted trades.

PerformanceTracker maintains state of all the unpaid dividends in the position
objects held in PerformancePeriod. Dividend objects contain all the relevant
dates (declared, ex, payment) as well as net and gross amounts. Dividends are
removed from the list as they are paid. Cash flow is not incremented until the
payment day. This creates the possibility of a dividend being owed but not
paid or realized before the end of a test. For example, a dividend with an
ex_date of today may have a pay date 2 weeks in the future. Right now the
algorithm does not receive any credit for unpaid dividends.

Tests cover buying/selling around the ex_date and payment_date, and checking
that the performance calculated is as expected.
2013-02-06 16:39:39 -05:00
Eddie Hebert fc03e80cdf Removes done message.
Instead of checking for 'DONE' on each call uses generators
builtin StopIteration for signalling the end of input.
2013-01-07 12:06:31 -05:00
Eddie Hebert e7a31c0661 Removes sort module.
Sort module is now unneeded with use of heapq.merge

Also adapts test_perf_tracking so that it uses date_sorted_sources.
2013-01-07 12:06:10 -05:00
Eddie Hebert f54881cd08 Changes tests from using an ndict for trades to an Event object.
When run over large amounts of data the use of ndict's gets and sets
become a large bottleneck, around 1/5th of the CPU time is spent
in ndict's __setattr__, __getattr__, etc.

By switching to an object for an event,
we reduce the penalty significantly.

Removes asserts that check for event being an ndict, as well as those
that assume a certain behavior of the __contains__ method for events.
2012-12-21 14:31:40 -05:00
Eddie Hebert 0617e53d69 Upgrades flake8 from 1.5 -> 1.6
Also, removes flake8 ignores, since the warnings that were
at odds with eachother now work.
2012-11-19 12:49:09 -05:00
Eddie Hebert b1ed4c6d8c Removes unused sum_true method. 2012-10-16 21:48:38 -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
Eddie Hebert 8edbc581c1 Applies PEP-8 recommendations.
Whitespace wrangling.
2012-08-24 14:10:11 -04:00
scottsanderson b5054293da change protocol to match new datasources 2012-08-14 12:24:57 -04:00
fawce 7b34a01bb6 Merge branch 'new_world_order' of github.com:quantopian/zipline into new_world_order
Conflicts:
	zipline/gens/examples.py
	zipline/gens/utils.py
2012-08-06 13:46:21 -04:00
fawce 06dc6f7acb beginning refactor to use single threaded simulator. 2012-08-06 13:11:20 -04:00
scottsanderson 4655e643a4 api changes and refactor of sorting tests 2012-08-06 11:05:25 -04:00
fawce 4a582e8952 modified zmq_gen method to yield None when there is no waiting message. This prevents blocking in the next() method of a component. But it requires generators wrapping the component to handle None.
Also modified component's receiver creation to be triggered on the first call to next, rather than iter.
This change means that the zmq context and socket for the component's receiver should always be created in
the same process as the consumer of the generator. Chaining together component wrapped generators will
result in the send process of the last component actually instantiating the receive socket of the prior component.
In this way, the components are actually communicating directly via zmq.

Component's send method now calls the wait_ready(), which waits for the monitor's GO message, inside
the generator loop. This guarantees that the generator's next method is called before the send loop blocks
on the monitor. As a result, components will call __init__ and next() without blocking, mimicking the
behavior of plain generators.
2012-08-04 12:58:07 -04:00
scottsanderson 8437a28c14 generator-style perf now sends a risk report on receipt of DONE 2012-08-03 21:09:05 -04:00
fawce a1d20fa392 Fixed monitor to execute as soon as all components report Done.
Merge branch 'new_world_order' of github.com:quantopian/zipline into new_world_order

Conflicts:
	zipline/gens/utils.py
2012-08-02 22:56:24 -04:00
fawce f166626ea8 multiple sources, each as component, feeding sort. 2012-08-02 22:51:17 -04:00
scottsanderson d74bc1bbc5 save 2012-08-02 21:49:39 -04:00
scottsanderson 18d327069a stateful transform as class 2012-08-02 18:01:16 -04:00
fawce 318065125f refactored component to use a generator 2012-08-01 21:43:15 -04:00
scottsanderson 9f7293e2d2 pipeline through merge 2012-08-01 17:19:08 -04:00
scottsanderson 211cd0271f new world order 2012-08-01 11:03:40 -04:00
fawce 29760dde3a renaming and such for the PR. 2012-07-30 16:13:47 -04:00
scottsanderson 5d9bfe6b92 full sequencing system (minus done from xforms) 2012-07-30 13:51:10 -04:00
scottsanderson fe1740a3ce updates for transforms 2012-07-29 19:56:10 -04:00
scottsanderson e048e8bc35 added done message to SpecificEquity 2012-07-28 19:04:50 -04:00
scottsanderson 3621934a28 better variable names and PreTransformLayer 2012-07-28 18:24:57 -04:00
scottsanderson 71cc67e123 generator random equity trades 2012-07-28 01:03:09 -04:00
scottsanderson cef36c172d commit for fawce 2012-07-27 19:40:42 -04:00
scottsanderson f0cb4eaaed movingaverage implemented as transform 2012-07-27 17:06:07 -04:00
scottsanderson 4ff943eb34 added generator-style transforms 2012-07-27 15:04:41 -04:00
scottsanderson d33cbdb38a feed is airtight 2012-07-27 09:14:12 -04:00
scottsanderson 97e4ba050a generator ds and feed, various generator utils 2012-07-26 18:48:51 -04:00
scottsanderson 96d32fbc86 mongo datasource as generator 2012-07-25 20:01:00 -04:00
scottsanderson 139fe97db6 new files for generator components 2012-07-25 14:45:04 -04:00