Eddie Hebert
699a47fe3d
Converts batch transform panel to use pd.Panel dictionary arg.
...
Based on @twiecki's work in batch_to_pandas branch.
2013-02-08 00:01:41 -05:00
Eddie Hebert
79f7fe69ef
Checks to make sure that an Event has a type before checking type.
...
The Dividend event is currently missing 'type', causing the type
check to fail.
TODO: Add a type to Dividends.
2013-02-07 18:17:26 -05:00
fawce
26ff73072c
Emergency fix - filtering down to TRADE events in the transforms.
2013-02-07 18:01:21 -05:00
Eddie Hebert
8c04621f57
Changes stddev and vwap transforms to accept parameters as kwargs.
...
So that algorithms that specifiy market_aware, days and delta
as args can be transitioned to just specifying a window_length kwarg.
Moving towards removing market_aware and delta completely.
2013-02-02 13:22:37 -05:00
Eddie Hebert
48c874f22a
Deprecates market_aware and delta kwargs to EventWindow.
...
The eventual goal is to remove the market_aware and delta kwargs,
but removing the kwarg completely would break the init
method of EventWindow based classes for existing algorithms.
In the meantime, this ensures that only market_aware is only ever
set to True and raises an error if it is False.
Also raises exceptions if values are set for delta, which was only
used if market_aware was False
Also, since the logic for checking window length is changed,
because in market aware mode we should always be checking the
window length, this adds some sanity checking to the window length.
2013-02-01 21:05:49 -05:00
Paolo Bernardi
a11a57cec8
Update zipline/transforms/stddev.py
...
Fixed typo.
2013-02-01 17:47:31 +01:00
Eddie Hebert
a6ce57ef4f
Removes code branching on sequential/merged flags in StatefulTransform.
...
So that the unit tests exercise the same transform logic as what
is executed a TradingAlgorithm object.
2013-01-30 16:23:40 -05:00
Eddie Hebert
946ecfafc0
Adds a trading day index to tradingcalander.
...
The trading day index is all business days in range minus the
non trading days we are already calculating.
Also, uses trading calendar indexes for batch transform, since the
batch transform was the only use of non_trading_days.
Instead of constantly adding and removing holidays to do market
day delta math, uses pandas DatetimeIndex to get the index of the dates
and uses the index difference to calculate market days.
2013-01-30 14:36:37 -05:00
Eddie Hebert
87f99331e8
Uses an object for sid data to be passed to handle data.
...
Moving another datatype off of ndict, to make it easier to inspect
objects in memory when debugging.
2013-01-23 13:41:57 -05:00
Eddie Hebert
4723e836e7
Changes use of ndict in transforms to be name object.
...
So that when inspecting memory, it's easier to find each datatype.
2013-01-23 09:30:26 -05:00
Eddie Hebert
649fb10c8e
Creates a new averages container for each call to get_averages.
...
Ideally, we'd want to avoid multiple object creation,
but currently not playing well with generator chain.
2013-01-22 20:40:37 -05:00
Eddie Hebert
9313077152
Creates a container object for averages in mavg window.
...
Moving another data type off of ndict on the path to making
it easier to discern between types when
2013-01-22 20:21:15 -05:00
Eddie Hebert
39f44a44f8
Reverting changes MovingStandardDevWindow.
...
Though the addition of tracking mulitple values in the window
is powerful, the changes broke behavior of existing algorithms
by changing method signatures and names.
So temporarily reverting these changes, to be pulled back in when
a way to have the multiple fields tracked with the existing API
is written, or a cutover of the API is figured out and determined.
2013-01-21 00:12:33 -05:00
Eddie Hebert
9e31d83084
Fixes check of ticks in stddev, now that __len__ has been removed.
2013-01-17 18:11:27 -05:00
Eddie Hebert
dbcfc0a2a5
Restores previous get_stddev method and uses the price value.
...
To maintain compatibility with existing algorithms.
2013-01-17 17:44:21 -05:00
Thomas Wiecki
685b2ed6fd
REF: Fields is kwarg is MovingStandardDevWindow.
2013-01-17 12:10:09 -05:00
Thomas Wiecki
eb1cb27a07
REF: fields now defaults to price for mavg and stddev transform. Also allows string specification.
2013-01-17 11:46:17 -05:00
Thomas Wiecki
fd9bbbebfa
Fix for stddev during merging.
2013-01-16 11:53:35 -05:00
Elektra58 and Thomas Wiecki
d0640d56c8
Refactored stdev transform to be applied to multiple fields, not just price
...
UnitTest for transforms refactored to account for changed stdev transform, introduced AssertAlmostEqual
2013-01-16 10:33:38 -05:00
Thomas Wiecki
0ecdac83f4
DOC: Typo.
2013-01-16 10:30:38 -05:00
Thomas Wiecki
abf482c2a6
MIN: Changed isinstance check to allow more types.
2013-01-16 10:30:38 -05:00
Thomas Wiecki
456639d02c
ENH: New batch_transform feature: compute_only_full.
2013-01-16 10:30:37 -05:00
Thomas Wiecki
52b099f6db
ENH: Added new kwarg to batch_transform: create_panel.
2013-01-16 10:30:37 -05:00
Thomas Wiecki
a63d4bca28
ENH: sid and field filter kwargs can also be strings or ints.
2013-01-16 10:30:37 -05:00
Thomas Wiecki
b815a57430
ENH: batch_transform now supports field filtering.
2013-01-16 10:30:37 -05:00
Thomas Wiecki
b68c51afb4
ENH: batch_transform now supports sid-filtering. DOC: Added docs to batch_transform.
2013-01-16 10:30:37 -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
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
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 Wiecki and Eddie Hebert
79a8a08812
STY: Renamed fillna to clean_nans.
2012-12-06 17:23:26 -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
Thomas Wiecki
7a0a6f5231
BUG: EventWindow now always contains constant number of days.
2012-12-06 12:33:18 -05:00
Thomas Wiecki
ac8ae973bc
ENH: replaced union with intersection in assert (more stringent).
2012-12-04 10:17:53 -05:00
Thomas Wiecki and Eddie Hebert
f81addb7df
ENH: batch_transform now adds arbitrary keys to datapanel.
2012-12-03 13:41:37 -05:00
fawce
3a181529e2
fixed whitespace problem
2012-11-22 07:21:52 -05:00
fawce
bb108e5c08
Update zipline/transforms/utils.py
...
emergency fix. the dropna was dropping the entire price dataframe from the datapanel.
2012-11-22 07:06:59 -05:00
Eddie Hebert
2c3d9a84db
Fills in missing slots in transform data panels.
...
Forward fills data, so that when using multiple stocks,
we don't have cases where one stock has data and the other doesn't.
2012-11-21 17:54:57 -05:00
Eddie Hebert
ab6b754922
Changes EventWindow parameter of days to window length.
...
The days parameter was causing confusion when explaining the
usage of the batch_transform decorator.
2012-11-20 11:52:27 -05:00
Eddie Hebert
68c5709f21
Stylistic compliance with flake8 checker.
2012-11-19 21:24:51 -05:00
Eddie Hebert
cf0de17b13
Merge pull request #22 from quantopian/fix_batch_transform_days
...
BUG: batch_transform was wrongly updating when days < refresh_period.
2012-11-19 12:40:26 -08: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
Thomas Wiecki
7bb8dca245
STY: Reversed order of if-statement.
2012-11-19 10:55:30 -05:00
Thomas Wiecki
f2ce713b99
DOC: Added doc-string to get_data().
2012-11-19 10:23:22 -05:00
Thomas Wiecki
4c02fea6e2
BUG: batch_transform was wrongly updating when days < refresh_period.
2012-11-19 10:20:24 -05:00
Thomas Wiecki and Eddie Hebert
126e9fdf26
Fixed batch_transform window length not being market aware.
...
Added accompanying unittest.
Minor refactoring of unittests and factory.
2012-11-06 21:13:27 -05:00