Commit Graph

17 Commits

Author SHA1 Message Date
Joe Jevnik 721dd36116 TST: move test_utils and adds test fixture classes
Renames zipline.utils.test_utils to zipline.testing

Adds zipline.testing.fixtures.ZiplineTestCase to manage setup and
teardown and adds mixins to define fixtures like an asset finder or
trading calendar.
2016-03-10 15:39:52 -05:00
jfkirk 6e6ef447d2 TST: Adds tearDownClass methods to delete TradingEnvironments 2015-09-10 11:53:29 -04:00
jfkirk dc964a7e7d MAINT: Removes the ability to reference a global TradingEnvironment
This commit removes the ability to reference a shared TradingEnvironment through the zipline.finance.trading module. In place, the classes that require a TradingEnvironment, or its child AssetFinder, contain their own references to those objects.

This commit also adds serialization utilities that allow for the pickling/unpickling of objects without unintentionally their TradingEnvironments or AssetFinders.
2015-09-10 11:53:28 -04:00
Stewart Douglas 1ef2274d11 MAINT: Update tests to conform to new reader/writer structure 2015-09-10 11:53:26 -04:00
jfkirk a5d1f79a37 TST: Reconciles tests with asset management system 2015-06-11 11:35:49 -04:00
jfkirk 9da644f767 ENH: Moves calling of TradingAlgorithm.initialize to _create_generator 2015-06-11 10:14:07 -04:00
Jonathan Kamens fd0530d889 MAINT: Flake8 2015-05-01 11:03:01 -04:00
Jonathan Kamens 557e6a3009 Every setup_logger needs a teardown_logger 2015-05-01 07:38:42 -04:00
Joe Jevnik f8f7f2fc4c ENH: Allows history to be dynamic and grow the container at runtime.
Previously, all specs had to be pre-allocated by using the 'add_history'
function. This is now no longer required and instead serves as a hint to
the HistoryContainer to pre-allocate the space for the given spec.

History can grow by increasing the length for a frequency, adding a
frequency, or adding a field. It can grow with any combination of
these.

HistoryContainer now is aware of the data_frequency of the algorithm,
and no longer uses the daily_at_midnight flag; instead, this is the
default behavior.
2014-11-03 15:57:44 -05:00
Thomas Wiecki b69590a2f7 ENH: Factor out API methods. Add support for algo scripts.
This is a step towards the goal of uniting Quantopian scripts
and zipline.

To make the syntax of zipline identical to Quantopian
we break out the API methods (like order) and turn them into
functions. To access the algo object we add a thread local reference
to the current algorithm that is accessed in the API functions.

TradingAlgorithm now takes either a string or two functions
(initialize and handle_data) that it executes.

Use api method decorator for methods available in algoscript.

Ported appropriate algorithm tests from internal code.
2014-01-16 12:07:33 -05:00
Thomas Wiecki e590da75fb BUG: Typo in test_batchtransfom. 2013-08-08 16:01:22 -04:00
Thomas Wiecki b1fdebfb7c TST: Added tests for new order methods. 2013-08-08 15:55:08 -04:00
Thomas Wiecki 236fe92a53 ENH: Make RollingPanel update itself if new fields arrive.
Before we preinitialized the BT's fields and sids.
Thus, no new ones could be added after initialization.
This should be fixed now.
2013-06-20 19:36:22 -04:00
Thomas Wiecki 3ea8ac8da2 BUG: Fix updating of trading_days_total in minute.
In the batch_transform we were incrementing the trading_days counter if there
is a new day event. Thus with a window_length of 1 and daily bars you will
update the batch_transform on the first day which is correct. But with minutes
you update with the first minute bar of the day which is not correct.

This is fixed by calculating the market_close explicity and seeing whether the
event.dt is on or past it.

I also added a unittest to test the correct behavior of this.
2013-05-16 14:51:19 -04:00
Thomas Wiecki b87d454938 BUG: Add bar kwarg to batch_transform.
Before the change to the RollingPanel, window_length
specified the number of days that should be in a window.

The previous commit broke this if data was minute resolution.

By passing bar='minute' to the batch_transform we internally
multiply the window_length by 60*6.5 to have a full day.

Also adds a (still rudamentary) test for batch_transform
with minute data.
2013-05-13 16:42:58 -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
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