Commit Graph

1637 Commits

Author SHA1 Message Date
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
Eddie Hebert d0651706ac TST: Prevent dividend test from using non-trading day.
Use the next events' datetime for the transaction instead of
incrementing by a calendar day.
2013-04-25 15:41:26 -04:00
Eddie Hebert fd6c71286d MAINT: Use sim_params for risk metrics init.
Prepare for adding emission_rate in risk metrics logic.
2013-04-25 15:30:34 -04:00
Eddie Hebert d067f13ba8 MAINT: Use a fake progress value for minute performance.
Eventually should to either return None or remove
progress completely, but in the meantime, return a
constant of 1.0 for progress of minute emissions.

Also, factor out the daily calculation into a property
instead of calculating during process.
2013-04-25 14:28:33 -04:00
Eddie Hebert 4b33d6ea4b TST: Ensure that create_trade_history uses midnight for daily trades.
Prepare for implementation of backtest loop that depends on daily
trades being grouped by midnight.
2013-04-25 13:25:50 -04:00
Eddie Hebert 2b0a91e568 BUG: Fix examples with regards to simulation parameters.
Fix bug where algorithms that lack sim_params do not pass the source
derived created sim_params through the generator creation logic.
2013-04-25 12:57:56 -04:00
Eddie Hebert fed0a9a998 TST: Ensure that test bars and events use midnight for daily data.
Daily data should be using midnight as the timestamp,
ensure that test data created by data_gen use midnight, so that
upcoming implementations that rely on the timestamp will be compatible.
2013-04-25 11:30:57 -04:00
Eddie Hebert c6cbc9f8e2 TST: Explicitly define the data frequency of record incr test. 2013-04-25 01:12:58 -04:00
Eddie Hebert 1183c44fad MAINT: Remove unused last_dt member from risk.RiskMetricsIterative 2013-04-25 00:28:35 -04:00
Eddie Hebert ab1a23526d BUG: Use last trading day for last successful date message.
market_open member does not exist on TradingEnvironment.
2013-04-24 16:17:31 -04:00
Eddie Hebert 8937ac1f41 MAINT: Generate perfomance message only once per bar for minute mode.
Instead of creating a set of perf messages for each event during minute
emission mode, only include the messages on the last event in the bar.

Should cut down on calculations/serialization as well, as work towards
doing more 'end of bar' logic for minute benchmarks.
2013-04-22 17:37:32 -04:00
fawce 3811df78b9 BUG: Fix grouping of events streamed through blotter.
To fix the grouping of events so that (dt, events) ordering
is preserved, the tracking of order states needs to change
in the following way.

Change how order keeps track of dates:
- Change order's dt field to reflect modified date.
- Add a created field.

Change how performance keeps track of orders by:
- Map dt to transactions
- Map dt to orders
- Map order ids to keep track of updated orders.
2013-04-22 16:46:28 -04:00
Eddie Hebert a1e3222456 STY: Tweak whitespace in comment. 2013-04-22 15:56:03 -04:00
Eddie Hebert 32d57ef955 STY: Add space after comma in order docstring. 2013-04-22 15:33:13 -04:00
Eddie Hebert 097c225c6b BUG: Fix treasury loading.
Make adjustments for using Python built-in ElementTree instead of lxml
based lxml.

lxml was edited out during pulling in of memory friendly loading of
treasury curves, however some of the use of ETree was lxml specific.

Mea culpa.
2013-04-22 14:03:25 -04:00
Richard Frank 4ba35d7d46 ENH: Stream benchmark and treasury data when downloading
Instead of loading entire csv or xml into memory.
2013-04-22 12:35:17 -04:00
fawce ca0bce1680 TST: Refactor so tests can exercise internal methods in blotter. 2013-04-18 16:09:24 -04:00
fawce bc95c3a62e BUG: Fix emission of order updates.
The emission of order updates from the blotter were incorrect,
and subsequently, performance.

Previously, only the first action of the order was emitted,
fix so that all status updates are emitted.
2013-04-18 16:08:44 -04:00
Ben McCann fc4d563a02 DOC: Fix documentation compilation 2013-04-17 11:15:38 -04:00
Eddie Hebert bf1fc42acc BUG: Fix time spent checking equality of floating point numbers.
The use of np.allclose introduced a severe performance penalty,
caused by the creation of two `np.array`s for each check.

Instead create and use a similar check which maintains tolerance
to floating point rounding, but operates only on scalars.
2013-04-16 13:09:26 -04:00
Eddie Hebert 9f0500aa33 TST: Use 9:31 AM EST for first minute of minute performance tests. 2013-04-16 12:23:09 -04:00
Eddie Hebert e7d64fa2e5 STY: Move import in test to top of file. 2013-04-16 12:23:06 -04:00