Commit Graph
901 Commits
Author SHA1 Message Date
Thomas WieckiandEddie Hebert bf2e8e3586 DOC: Typo. 2013-01-07 13:26:27 -05:00
Thomas WieckiandEddie Hebert 48b05397e2 MIN: Changed isinstance check to allow more types. 2013-01-07 12:50:52 -05:00
Thomas WieckiandEddie Hebert 0f88e4133d ENH: New batch_transform feature: compute_only_full. 2013-01-07 12:44:55 -05:00
Thomas WieckiandEddie Hebert d1dace948e ENH: Added new kwarg to batch_transform: create_panel. 2013-01-07 12:44:19 -05:00
Thomas WieckiandEddie Hebert 5deeb38fb6 ENH: sid and field filter kwargs can also be strings or ints. 2013-01-07 12:44:00 -05:00
Thomas WieckiandEddie Hebert 2729936aff ENH: batch_transform now supports field filtering. 2013-01-07 12:43:41 -05:00
Thomas WieckiandEddie Hebert 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 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
Richard Frank 805bfe0f30 Moved treasury_durations from property to module constant 2012-12-28 13:40:09 -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 a8413e1cc2 Adds reprs for PerformanceTracker and TradingEnvironment.
For debugging in the REPL.
2012-12-27 18:26:55 -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 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
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
Richard Frank 54063854aa Forward-fill missing treasury data
To handle, for instance, Columbus Day (Oct 10),
on which there is no treasury data.

We're only forward-filling data now, and
no longer searching both back and forward in time.
2012-12-14 17:29:27 -05:00
Thomas Wiecki 775c564ea1 ENH: Added DataPanelSource. 2012-12-13 12:55:05 -05:00
Eddie Hebert bbc8050c81 Merge pull request #42 from quantopian/iso8061_to_8601
Remove unused ISO 8601 stuff from Zipline
2012-12-12 16:47:55 -08:00
Eddie Hebert 11391f356b Merge pull request #41 from quantopian/revert_fix_window
Revert fix window
2012-12-12 16:47:42 -08:00
Richard Frank 3684a85474 Don't log warning when we only have a partial month's data
which is an expected case.
2012-12-12 15:23:26 -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
Richard Frank e7b504f4ca Removed list of trading days since we already have an OrderedDict 2012-12-12 15:23:26 -05:00
Jonathan Kamens 831034eb3b Remove unused ISO 8601 stuff from Zipline 2012-12-11 13:54:59 -05:00
Thomas Wiecki f8e4d8ade6 Revert "BUG: EventWindow now always contains constant number of days."
This reverts commit 7a0a6f5231.
2012-12-11 12:12:51 -05:00
Thomas Wiecki 8621eb2223 Revert "STY: Removed drop_condition arguments."
This reverts commit c7383f6275.
2012-12-11 12:12:32 -05:00
Richard FrankandEddie Hebert 4981c67c31 Handle missing historical data more elegantly
Updated the search for treasury data when there is none for the
test end date.
It could be that the end date is not a trading day, or we could
just be missing treasury data. In either case, we try to recover
more gracefully now, by searching as far as possible and maybe
logging a warning.

Similarly, if there is no benchmark data for the test end date,
look for the next trading day. If we really have no data,
blow up with our own explicit exception, instead of overflowing
in our search for dates in the future.
2012-12-10 13:03:25 -05:00
Eddie Hebert 67b8f63972 Limit the fields of batch transform datapanel to ints and floats.
Previously, keys that mapped to functions would be set as field names.
Attempting to assign the datapanel slot to a function causes an error.

This limits the extracted field names to those that map to an int
or a float.
2012-12-07 14:35:55 -05:00
Thomas WieckiandEddie Hebert 79a8a08812 STY: Renamed fillna to clean_nans. 2012-12-06 17:23:26 -05:00
Eddie Hebert 5a585fc3aa Merge pull request #37 from quantopian/fix_transforms
Fix transforms
2012-12-06 14:00:35 -08:00
Thomas Wiecki ecb26e9eec BUG: Can not test for length when dropping nans. 2012-12-06 16:07:18 -05:00
Thomas Wiecki c46e09f52a BUG: Do not backfill but drop rows with N/A in them. 2012-12-06 15:52:50 -05:00
Thomas Wiecki c7383f6275 STY: Removed drop_condition arguments. 2012-12-06 15:24:01 -05:00
Thomas Wiecki ba46c6292f ENH: DataPanel is now created more flexible over all sids and all given fields. Added unittest to test for nan-filling. Added backwards filling by default. 2012-12-06 14:43:20 -05:00
Thomas Wiecki 5f6839beea BUG: Refactored batch_transform unittests and fixed some bugs. 2012-12-06 12:36:47 -05:00
Thomas Wiecki c69858f8b9 ENH: Added kwarg to turn off fillna or use different fill method. 2012-12-06 12:35:46 -05:00