Commit Graph

1309 Commits

Author SHA1 Message Date
Thomas Wiecki bf2e8e3586 DOC: Typo. 2013-01-07 13:26:27 -05:00
Thomas Wiecki 48b05397e2 MIN: Changed isinstance check to allow more types. 2013-01-07 12:50:52 -05:00
Thomas Wiecki 0f88e4133d ENH: New batch_transform feature: compute_only_full. 2013-01-07 12:44:55 -05:00
Thomas Wiecki d1dace948e ENH: Added new kwarg to batch_transform: create_panel. 2013-01-07 12:44:19 -05:00
Thomas Wiecki 5deeb38fb6 ENH: sid and field filter kwargs can also be strings or ints. 2013-01-07 12:44:00 -05:00
Thomas Wiecki 2729936aff ENH: batch_transform now supports field filtering. 2013-01-07 12:43:41 -05:00
Thomas Wiecki 0e3b1e76e8 ENH: batch_transform now supports sid-filtering. DOC: Added docs to batch_transform. 2013-01-07 12:43:26 -05:00
Eddie Hebert 0d841503a7 Uses dictionary update instead of iterating through keys.
update_universe is a bottleneck on large data sets.

A large portion of that bottleneck is the call to getitem while
looping over the keys, so using update while passing along the internal
__dict__

Seeing about a 40% improvement.
2013-01-06 17:31:03 -05:00
Eddie Hebert dd64bb0fbf Changes type emitted from DataSource to Event.
Moving DataSource to Event for improvements in member access
and setting.
2013-01-06 17:23:26 -05:00
Eddie Hebert 799a357d98 Changes test factory to use Event instead of ndict.
As more sources are moving off of ndict,
changing the factory to use Event, so that when testing we are
exercising use of Event.
2013-01-06 17:13:07 -05:00
Eddie Hebert 59dbffb3aa Changes test sources to use unit test's assert instead of plain assert. 2013-01-06 17:11:38 -05:00
Jonathan Kamens 27df611b8e Upgrade pytz 2013-01-04 12:45:53 -05:00
Eddie Hebert d1784b26c3 Adds an init to protocol.Event to enable setting of initial values.
So that an Event can use an initial dict to set all values,
instead of needing to set initial values one by one.

i.e. enables:

```
foo = Event({'bar': 1, 'baz': 2})
```

in favor of:

```
foo = Event()
foo.bar = 1
foo.baz = 2
```
2013-01-02 14:58:12 -05:00
Eddie Hebert a25590b0a1 Exposes the list of trading days contained in a trading environment.
Previously, the list was generated, but only used to calculate
the number of days in the environment.

With exposing this list, working towards a path where the simulation
uses the trading days to determine when to handle market closes.
2013-01-01 13:01:49 -05:00
Eddie Hebert 7b1b9887ba Removes timeout handling from simulator's simulate_snapshot.
The delta was ensuring that the backtester wouldn't exceed the
delta of a bar if it were being run against live data.

However, this extra overhead of getting the current time on each
side of the handle_data adds a penalty in pure backtest mode.

Also, it makes the backtest results potentially non-repeatable,
since it is sensitive to current conditions on a box for processing
time.

Favoring having the timeout handled by whatever is running the
zipline algorithm.
2012-12-31 18:02:11 -05:00
Eddie Hebert a71226c400 Merge pull request #49 from quantopian/granularity
Granularity
2012-12-30 09:52:06 -08:00
Thomas Wiecki fccc5e8006 ENH: Added constants.py which contains financial constants. 2012-12-30 12:02:38 -05:00
Thomas Wiecki 4615b29713 REF: Renamed granularity to data_frequency. 2012-12-30 11:50:46 -05:00
Eddie Hebert 75e60fdc91 Fixes number of bars to create covering date range in test.
There are only 6 trading days between the open and close specified
in test_perf test.

Also, removes getting the period_end off of the last trade,
since the test can now use the end date specified for the trading
environment.
2012-12-29 18:45:31 -05:00
Eddie Hebert ec745736ac Fixes period_start in test_perf test. 2012-12-28 13:48:47 -05:00
Eddie Hebert 50f4e1fff2 Fixes bug in test where period_end is too early.
Grabs period end before we remove trades.
2012-12-28 13:46:44 -05:00
Eddie Hebert 1c15e983dc Parameterizes test_tracker test with different days' events dropped.
So that the test ensures that perf messages are returned when
data is missing from the beginning, middle, and end of data.
2012-12-28 13:43:01 -05:00
Richard Frank 805bfe0f30 Moved treasury_durations from property to module constant 2012-12-28 13:40:09 -05:00
Eddie Hebert 11fa56e5d9 Breaks up performance tracker tests.
The tests using performance tracker don't need the same setup
as the other performance module tests, breaking out so that
we don't call it needlessly.
2012-12-28 12:08:43 -05:00
Eddie Hebert 2939cce155 Merge pull request #51 from quantopian/yield-perf-data-for-missing-days
Enables performance messages on days that have no trades.
2012-12-28 09:04:31 -08:00
Jonathan Kamens 79c101a32a Remove nosexcover from dev requirements for zipline 2012-12-28 11:45:58 -05:00
Eddie Hebert f7e4f57425 Enables performance messages on days that have no trades.
Previously, on days that were trading days, but there with no
event data to process for that day, performance metrics were
not emitted, since the handling was based on having an event
trigger the daily performance metric.

Handled by grouping together performance messages, on market open,
for all days since the last market close.

Also, changes perf_tracker unit test to simulate missing data.

Taken from @richafrank's branch handling the same case.
2012-12-28 11:43:31 -05:00
Eddie Hebert b5867774e9 Reduces the the dataset size for performance tracker test.
So that the test is easier to debug and walk through on paper.

Also, removes randomly created dataset.
2012-12-27 18:39:22 -05:00
Eddie Hebert c436f85758 Removes random test invocation. 2012-12-27 18:39:22 -05:00
Eddie Hebert a8413e1cc2 Adds reprs for PerformanceTracker and TradingEnvironment.
For debugging in the REPL.
2012-12-27 18:26:55 -05:00
Eddie Hebert c6759eb938 Upgrades requests to latest. 1.0.3 -> 1.0.4 2012-12-26 11:01:28 -05:00
Eddie Hebert 32ed8dacad Updates msgpack-python to latest. 0.2.3 -> 0.2.4 2012-12-26 10:59:48 -05:00
Eddie Hebert c85f8147bc Removes coverage being run on each internal build of the project.
coverage provides valuable info, but changing to run it less
frequently than every checkin.
2012-12-26 10:43:54 -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
Eddie Hebert 5da5727289 Updates to latest version of flake8. 1.6.2 -> 1.7.0 2012-12-21 21:49:48 -05:00
Eddie Hebert 403a8e9064 Removes assert of sort protocol in inner loop.
Since this was invoked as an function, the invocation of the method
was not dropped by -O.
Also, moving towards only having postconditional asserts.
2012-12-21 21:46:46 -05:00
Eddie Hebert 8c2c36755e Removes assert of message confirming to protocol.
Two reasons for removal:
- On the path of removing most non-postconditional asserts.
  Since the asserts on every message is incurring a
  non-insignificant penalty on large datasets.
- Since the assert was invoked as a function, the 'right side'
  of the assert statement, i.e. the error message was being invoked
  as a function, discovered since the __repr__ of the message was
  high on the bottleneck list.
2012-12-21 21:36:32 -05:00
Eddie Hebert 8f6ff20e6a Adds a __repr__ method for Event. 2012-12-21 17:07:56 -05:00
Eddie Hebert 21da812c10 Optimizes checking ready state of sources during sorting.
The main bottle neck here was using `len`.
A boolean check is a sufficient test for more items in the queue.

Also, uses all instead of several functions.
2012-12-21 16:46:16 -05:00
Eddie Hebert 2b6f7b1c8b Merge pull request #48 from quantopian/change-trade-from-ndict-to-object-based-event
Changes tests from using an ndict for trades to an Event object.
2012-12-21 12:33:01 -08: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
Thomas Wiecki 3ca8029766 MIN: Replaced annualizer with a dictionary. Added set_granularity method. 2012-12-20 14:27:40 -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
Eddie Hebert 204eae7274 Updates README example code to use window_length instead of days.
In a previous patch, the transform argument had been changed
from days to window_length.

The README example was thus not able to be run, updating algo
so that it runs against current versions of transforms.
2012-12-19 18:10:20 -05:00
Eddie Hebert c919e380f4 Handles the case where pandoc isn't available during download.
Also bumps version up to 0.5.6 so the new version will apply.
2012-12-19 16:25:58 -05:00
Thomas Wiecki 7d15cb870f BUG: Adding of new fields to data panel source should be inside of if-statement. 2012-12-19 10:08:20 -05:00
Eddie Hebert aaefd3270e Merge pull request #43 from quantopian/extend_df_source
ENH: Added DataPanelSource.
2012-12-18 13:18:59 -08:00
Eddie Hebert 2cc983a4c7 Moves requests to main requirements. Also upgrades to 1.0.3
Moving to main requirements, since zipline will not run without
the treasury and benchmark data that we requests to fetch.

Upgrade is to keep current with latest release.
2012-12-18 11:27:25 -05:00
Eddie Hebert 1af76458fd Release 0.5.5
Salient changes since last version:

- Adds non-holiday closings to trading calendar.
- Forward filling of missing treasury data.
- Improves handling of treasury data when the backtest's
  end date day is not a market day.
- Adds option to forward fill data in batch transform.
2012-12-18 10:49:32 -05:00
Eddie Hebert 7f74d53804 Updates pandas to the latest version. 0.9.1 --> 0.10.0 2012-12-17 12:41:24 -05:00