Commit Graph

1672 Commits

Author SHA1 Message Date
fawce 3d8674ffb6 MAINT: Cleaned up to_dict highlighting daily and minutely difference.
Make the difference between the two emission rates more exact.
2013-05-07 19:24:47 -04:00
fawce 2d850d0970 BUG: Fix calculation of cumulative risk stats.
- Use current dt instead of market_close.
- Handle intraday close
- Remove zeroing out of sharpe etc.
2013-05-07 19:21:20 -04:00
Eddie Hebert 32835b87f3 MAINT: Rename perfomances intraday_perf to minute_perf.
minute_perf is more precise than intraday_perf as a naming scheme
for the performance packet type.
2013-05-07 19:21:20 -04:00
fawce b53da8d4b3 MAINT: Refactor check_entry method to also look at np.inf
Also, make the method a module function.
2013-05-07 19:20:49 -04:00
Eddie Hebert 5c883659b5 BUG: Fix missing values from supplemental data in batch transform.
Adapt the supplemental data fill so that it works with the new
shape of the batch transform that was switched to with the rolling
panel optimizations.
2013-05-07 18:17:08 -04:00
Eddie Hebert d3ade5050c MAINT: Tune logging of StateTransform start/end to debug.
These log lines are useful for debugging, but a bit spurious
on every algorithm run.
2013-05-07 17:27:06 -04:00
Eddie Hebert 3e1ac4f19a TST: Add tests to verify risk calcualtions from streamed events.
So that we can verify the risk metrics as they are calculated.
Work towards being able to hand verify risk calculations.
2013-05-07 17:21:56 -04:00
Eddie Hebert 91e5abbc44 MAINT: Use a for loop for main algorithm run loop instead of list
So that stepping through a debugger is a little easier, with
respect to having easy access to the algorithm object, and seeing
which step in `self.gen` the interpreter is currently at.
2013-05-07 17:19:38 -04:00
Eddie Hebert aa54d0ae0e MAINT: Allow the algorithm benchmark returns to be overrideable.
So that test data can be well defined with a short list of benchmarks.

This could also lead to having more customizable benchmarks for
backtests.
2013-05-07 16:09:58 -04:00
fawce e6c156c50b ENH: Add intraday risk and performance for minute emission.
Both risk and performance now calculate performance since inception
(cumulative) and since the open. Both periods are updated intraday
and both are reported.

Batch risk for periods starting after the end of the treasury curve
history now use most recent curve.
2013-05-06 22:01:41 -04:00
Eddie Hebert 6afc85c17d BUG: Fix missing and delayed transaction last_sale_price's.
Critical that trade events be last, so that the perf tracker's
position information be updated with both the transaction and
the trade for last_sale.

Without, the first transaction would be recorded with a last_sale
of 0.

With @fawce
2013-05-06 16:28:47 -04:00
fawce 1752f78447 ENH: Allow algorithm to run past end of trading.environment history.
Work towards running an algorithm against 'live' data, which can't
be bound to the available benchmarks and treasuries, since the
benchmarks and treasury curves for that day won't be published
until that night.
2013-05-06 15:09:56 -04:00
Eddie Hebert d686fac02d MAINT: Use property for tradesimulation perf_key. 2013-05-05 11:32:33 -04:00
Eddie Hebert a04ece1840 MAINT: Use up-to-date field names in test_source
TRANSACTION member of Event had been removed.
close_price and open_price, are preferred to to close and open
2013-05-05 11:09:59 -04:00
Eddie Hebert 4b7afb43d2 MAINT: Change repr's so that they are both human and machine readable.
For printability in the repr when debugging algo config and state,
change the repr of TradingAlgorithm and the objects it contains
so that the more closely adhere to the repr interface of being
able to recreate an object instance.
2013-05-04 22:26:28 -04:00
Eddie Hebert 5ae1aab2af TST: Add nose-ignore-docstring plugin to requirements and setup.cfg
So that docstrings can be added for test documentation, but suppress
those docstrings in test output by default.
2013-05-04 12:52:38 -04:00
Eddie Hebert e3c783e163 BLD: Add scipy to test requirements.
For example scripts. Though compiling scipy for TravisCI may be the
straw that breaks the camel's back as far as total suite run time.
2013-05-03 13:32:30 -04:00
Eddie Hebert 727f7bef19 BLD: Use statsmodels 0.4.3 for test scripts.
0.5.0 is unavailable via the pep syntax, an incongruity
between the results of `pip install` and `pip freeze`
2013-05-03 09:40:27 -04:00
Eddie Hebert 42ad791f39 BLD: Add libraries needed for running examples.
Add statsmodels and patsy, since they are used by example scripts
and example scripts are now run as part of the unit test suite.
2013-05-03 09:17:17 -04:00
Eddie Hebert c3cbe4e6b1 Merge addition of unit tests that exercise examples.
Also, multiple fixes to examples that the unit tests uncovered.
2013-05-02 17:05:06 -04:00
Eddie Hebert 7bc20639da BLD: Add matplotlib to test requirements.
Example scripts use matplotlib, so add to requirements_dev.txt
so that CI will include matplotlib.
2013-05-02 16:54:57 -04:00
Thomas Wiecki b748ba62e0 MAINT: Shortened time frame over which examples are run to speed up tests.
Minor fix pairtrade to now use record.
2013-05-02 16:54:57 -04:00
Thomas Wiecki f5a8d76a91 BUG: Do not update last price if price is nan. 2013-05-02 16:54:57 -04:00
Thomas Wiecki d56f1b73f8 BUG: Removed SlippageModel from olmar example.
Fix crash due to 'delay' was no longer supported.
But removing SlippageModel override, since current configs
should be functionally equivalent to FixedSlippage.
2013-05-02 16:54:08 -04:00
Thomas Wiecki b8b21b347f TST: Added unittest that runs all examples. 2013-05-02 16:33:08 -04:00
Eddie Hebert 3711bf3775 ENH: Add a utility to reverse a utc timestamp to dst.
Mirror the exchange_dt_in_exchange helper function.
Useful for inspecting data interactively.
2013-05-02 15:52:48 -04:00
Eddie Hebert 823416e9fd MAINT: Remove unecessary conversion to Series on each risk update.
We were converting to pd.Series for historical reasons as an artifact
during development, now that we pass dt we can just pass the float values
instead of wrapping it in a series.
2013-05-02 14:36:10 -04:00
fawce 4ed0250424 added a fake window_length to be compatible
with transform protocol
2013-05-01 22:42:17 -04:00
fawce 59dcf0f6cd exposes stateful transform's window length 2013-05-01 22:05:06 -04:00
Eddie Hebert 440e7ce076 BLD: Add Cython as a requirement. For TA-Lib. 2013-04-30 21:24:50 -04:00
Jonathan Kamens 16e75a31d4 TST: Fix check() test utility function to detect all list differences
The check() function in zipline.utils.test_utils was only comparing
lists up to the length of the shortest list. This fix uses
izip_longest instead of izip so it compares up to the length of the
longest list, which among other things means that it will now
correctly report when one list is empty and the other is not.
2013-04-30 21:13:18 -04:00
Eddie Hebert 419c03dedb BUG: Smooth test and compile issues with TALib
So that TALib is still available, but smooth out the ability to
run tests with some issues that bear investigating.

- Ignore MAVP during tests.
- Temporarily use a "regular" member instead of  __doc__ string.
  (TODO: look into using `type` to generate the class)
- During tests wait until a window exists.
2013-04-30 20:19:37 -04:00
Eddie Hebert 56dae3a288 BLD: Include TA-Lib package as a dependency.
CI build was failing due to lack of package.
2013-04-30 19:52:40 -04:00
Eddie Hebert 4b102676a5 Merge in branch with support for TALib based transforms. 2013-04-30 17:39:58 -04:00
Eddie Hebert ae6e40499b BLD: Add build ta-lib to Travis config.
So that TALibTransforms tested on Travis.
2013-04-30 17:36:53 -04:00
Jeremiah Lowin cc39ec3aef ENH: Add support for TALib based transforms.
Provide a subclass of BatchTransforms that are powerd by the ta-lib
library.
2013-04-30 17:35:56 -04:00
fawce beecebc7d8 ENH: Support multi-day minutely emission.
Change the event loop so that minute emission has rollovers
between days.
2013-04-30 17:19:22 -04:00
fawce d381865a89 BUG: Ensure that order exists before attempting to cancel. 2013-04-30 17:19:16 -04:00
fawce 34f1dd783a STY: Tweak comments in performance to match rest of file. 2013-04-30 17:19:09 -04:00
fawce 28df9ec423 MAINT: Refactor performance tracker as part of algorithm.
Instead of having the performance tracker as part of the
tradesimulation class, hold on to it inside of the algorithm
object, so that the perf_tracker is more easily accessed for
reset behavior, etc.
2013-04-30 17:19:01 -04:00
Eddie Hebert ff36240179 Merge batch transform and rolling panel enhancements.
Branch provides a rolling pandas data panel, and converts
batch transform to use the new panel type.
2013-04-29 15:31:38 -04:00
Eddie Hebert 06a01b1469 BUG: Explicitly add support for refresh period of 0.
In the previous implementation of batch transform it happened
that a window_length of `0` caused the transform to update on every
bar, for the time being that behavior should be retained,
though the new rolling implementation more correctly aligns to the
term of 'period' so a period of 1 would achieve the same effect.
2013-04-29 15:30:42 -04:00
Eddie Hebert 38ae8bbb67 BUG: Ensure that window length value is sanity checked.
When moving BatchTransform off of EventWindow as a base object,
the checking of window length was lost, restore that check using
the same function as EventWindow.
2013-04-29 15:30:42 -04:00
Thomas Wiecki c12102d7b1 MAINT: Removed self.sids from batchtransform. Externally sets static_sids. 2013-04-29 15:30:42 -04:00
Thomas Wiecki 2be7014d51 ENH: Rewrite of batch_transform to use rolling panel.
- Added unittest to test for newly appearing sids.
- Fixed logic bug where window was only full after
  window_length+1 events got passed.
2013-04-29 15:30:40 -04:00
Wes McKinney c5f4d00bf1 ENH: prototype data structure for managing a rolling datapanel
Manage a rolling window collection of collection of panels
for computation purposes.
2013-04-29 15:19:02 -04:00
Eddie Hebert 2522a6fc4c MAINT: Remove unused Passthrough transform.
Passthrough transform had been removed previously, removing remaining
references to the class.
2013-04-29 14:58:29 -04:00
Eddie Hebert 9ffaec64d8 MAINT: Factor out check for window length value sanity.
Preparing for BatchTransform not using EventWindow, so
factoring out the checks for window length into a
function that can be shared.
2013-04-29 14:56:04 -04:00
Eddie Hebert 38bd4214a2 MAINT: Remove unused TransformMessage class. 2013-04-29 14:55:38 -04:00
Eddie Hebert a4ea33218d TST: Move batch transform tests to their own file.
From @twiecki's rolling batch transform work.
2013-04-26 23:56:35 -04:00