Commit Graph

1658 Commits

Author SHA1 Message Date
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
fawce de37a08c23 MAINT: flake8 error 2013-04-26 19:57:45 -04:00
fawce 9a66614ff2 Merge pull request #146 from quantopian/orders_m1d
Orders m1d
2013-04-26 16:55:28 -07:00
fawce f3cfc9623d ENH: new order management methods:
- get_open_orders
- get_order
- cancel
2013-04-26 19:46:00 -04:00
fawce afef4ea34c ENH: added cancel function
- removed vestigial methods
- removed code that drops filled orders from memory
2013-04-26 19:46:00 -04:00
fawce 9062b9636a MAINT: refactoring for orders api
- moved Order and Blotter to zipline.finance.blotter
- moved order method from AlgoSimulator to Blotter
- eliminated the set_order method in algorithm
- moved blotter to the algorithm
2013-04-26 19:45:59 -04:00
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 89ea97ec52 MAINT: Use a distinct object for minute/day data instead of ndict.
Continue removing ndict usage, instead use a BarData object.
2013-04-26 15:26:01 -04:00
Eddie Hebert d4a8878c6e TST: Ensure holiday edge case is covered in dividend performance test.
Add a test suite of dividend performance that ensures a holiday
is covered, needed because tests usually go over a random test range,
so holiday coverage isn't covered in basic test.

From @fawce.
2013-04-26 10:56:54 -04:00
fawce 24dfcaffc8 MAINT: Remove TradeSimulationClient class layer.
In favor of directly using the AlgorithmSimulator class.
2013-04-25 18:03:44 -04:00
Eddie Hebert 6cf8db458d ENH: Emit minute benchmarks, refactor event loop, fix order timing.
Note, in a somewhat Catch-22 situation, the refactoring of
the simulation loop and streaming of minutely benchmarks enable
each other, since the benchmarks fall over because of doubled
date groupings, which is fixed by the change of the simulation loop,
but the simulation loop depends on using the benchmarks as a clock,
so pull the two changes in together, though the two changes do not
work independently of each other.
2013-04-25 17:18:58 -04:00
fawce 427ea8d4ca ENH: Change simulation loop to use benchmarks as simulation 'clock'.
Refactor PerformanceTracker, Blotter, and AlgorithmSimulator to
work with handling the end of a bar at the AlgorithmSimulator level
instead of within PerformanceTracker.

- PerforamnceTracker and Blotter are longer generators,
  both provide functions to process events instead.
- AlgorithmSimulator calls each from within the loop running
  over the data generator.
- Change test_perf_tracker utility to be compatible with change
  away from PerformanceTracker as a generator.

Has the effect of:
- Fixing the timing of order emission.
- Allow minutely emission of benchmarks, which was prevented
  by the extra grouping previously caused by Blotter.

Minutely emission also depends on work for streaming benchmarks
through performance and risk at a minute granularity.
2013-04-25 17:16:35 -04:00
Eddie Hebert d31303b86c ENH: Add basis for minute rate emission of performance.
- Create different benchmark containers in performance
  depending on emission rate.
- Add a minute close method which updates algorithm and
  benchmark returns, and calculates the risk metrics
  depending on those methods.
- Provide fake 0.0 values for annualized metrics like
  sharpe, sortino, and information, until we figure out
  how they should be treated in the context of minutely
  calculation.

*NOTE* This does not fully work without the changes to the
simulation loop by @fawce
2013-04-25 16:49:38 -04:00
Eddie Hebert 7d615c5af5 MAINT: Improve message for return mismatch by including current dt.
Based on work from @fawce's simulation loop work.
2013-04-25 16:48:19 -04:00
Eddie Hebert 2cc6764b90 TST: Factor out the running events through a test performance tracker.
Based on @fawce's work for changing the simulate loop.
2013-04-25 16:33:01 -04:00