Commit Graph

705 Commits

Author SHA1 Message Date
llllllllll 26b47a1234 MAINT: treat Pipeline API as a proper noun 2015-10-19 16:35:02 -04:00
llllllllll 0ec1cbc604 MAINT: rename pipeline_api_from_blaze to from_blaze 2015-10-19 16:35:02 -04:00
llllllllll f7ad82f38e TST: updates tests after rebasing 2015-10-19 16:35:02 -04:00
llllllllll d621f1e87c ENH: Updates the blaze loader and adds more tests 2015-10-19 16:35:02 -04:00
llllllllll 4d7d5ce8ff TST: Adds some test cases for the blaze loader 2015-10-19 16:35:02 -04:00
jfkirk 915c8e800f MAINT: Removes unneeded knowledge_date logic from future_chain 2015-10-19 11:37:56 -04:00
Eddie Hebert 85c49afe4c Merge pull request #774 from quantopian/filter-out-dates-with-no-data
BUG: Filter out payout rows with no prev close.
2015-10-15 13:30:46 -04:00
Eddie Hebert 6b9476d346 BUG: Filter out payout rows with no prev close.
When the prev_close is 0 or does not exist, the resulting ration was either +inf
or nan, respectively.

Create a mask on the non-zero effective dates, where effective date is only
written when the prev close is sufficient for a valid ratio; and use that mask
to filter out the bad rows.

Also, use prev close as the effective date.
2015-10-15 13:30:05 -04:00
jfkirk 2686e3875a MAINT: Removes unnecessary benchmark load on some TradingEnvironments 2015-10-14 12:04:58 -04:00
Eddie Hebert 9a2767ad07 Merge pull request #765 from quantopian/add-spot-price-and-write-adjustments
Add spot price and write adjustments
2015-10-13 14:02:44 -04:00
Eddie Hebert ccdc815526 ENH: Write dividend payouts to adjustments db.
To prepare for querying for payouts from SQLite, write the dividend
payouts to a new table `dividend_payouts`.

Change the expected columns of the passed dividend frame to contain the
payout data, and use that data to calculate the ratios (this moves
internal code that was calcualting the ratios into Zipline.)

The end result is that instead of just a `dividends` table with the
backward looking adjustment ratios, also write a `dividend_payouts`
table and a `stock_dividend_payout` table.
2015-10-13 14:02:26 -04:00
Richard Frank 7a638e4580 STY: Moving args to new line 2015-10-12 16:13:55 -04:00
Richard Frank ee26a21855 MAINT: Renamed loader_dispatch to get_loader
Now it raises a KeyError instead of returning None,
if loader not found.
2015-10-12 16:13:55 -04:00
Richard Frank 2dabda6b76 MAINT: Reworked Term atomicity 2015-10-12 16:11:19 -04:00
Richard Frank 940831e1cf TST: Added test that columns are batched
when they share the same loader and extra_rows
2015-10-12 11:17:06 -04:00
Richard Frank ba0542a641 MAINT: Removed MultiColumnLoader
since we can use pipeline_loader_dispatch instead
2015-10-12 10:48:29 -04:00
Richard Frank 83bd1310d9 PERF: Using pipeline_loader_dispatch to group by loader
instead of dataset
2015-10-12 10:48:29 -04:00
Richard Frank e880fa3e34 PERF: Batch load atomic terms by dataset
Added CompositeTerm and now we dispatch more generally on atomic
2015-10-12 10:48:28 -04:00
Eddie Hebert 5338c8e611 ENH: Add spot_price to BcolzDailyBarReader.
Add new method to BcolzDailyBarReader, `spot_price` which returns the
unadjusted price for the specified day and sid.
2015-10-10 07:19:03 -04:00
Scott Sanderson 1336dfc181 BUG: RSI wasn't even close to working.
Fixed and added tests.
2015-10-09 20:10:30 -04:00
Eddie Hebert e6ba59b580 Merge pull request #761 from quantopian/move-us-equity-to-data
MAINT: Move equity data formats out of loader.
2015-10-09 17:28:37 -04:00
Eddie Hebert e33f6dcdcd MAINT: Move equity data formats out of loader.
Put the logic for reading and writing the equity price and adjustment
data into a module located in data, making it distinct from the pipeline
loader usage of the formats.

This prepares for both incoming changes of how adjustments are written,
(which includes using the bcolz daily reader as an input), as well as
eventually providing the readers to a DataPortal object.
2015-10-09 17:20:19 -04:00
Stewart Douglas 4e2039c9b0 ENH: Coerce user input with API method decorator
Previously we have capitalized input strings at different levels in
our code: in the user-facing API methods and in the asset finder.
This commit moves input string capitalization exclusively to the API
method to which the string was supplied. Specifically, the string is
capitalized by a preprocess API method decorator. The preprocess
decorator passes the input string to the newly defined
ensure_upper_case() method, which returns a TypeError if the argument
supplied is not a string.

ensure_upper_case() is defined in a new file, zipline/utils/input_validation.py.
The existing expect_types() method is also moved there.

Various tests in tests/test_assets.py are modified to account for the
fact that the asset finder method lookup_symol() no longer capitalizes
its supplied argument.
2015-10-08 15:41:33 -04:00
Andrew Daniels 2e85e08768 TST: Adds basic test coverage for FutureChain.__iter__ 2015-10-08 14:35:00 -04:00
Andrew Daniels 9ecd7e18d0 MAINT: Improves handling for contract date info in lookup_future_chain
Improves the query for futures contract to use the date that comes first
in time (between notice_date and expiration_date) to determine cotnract
validity. If one of these is missing, we'll use the other.

Also modifies the query to order the resulting contracts by their
expiration_date if available, and to use their notice_date if not.
2015-10-08 14:16:57 -04:00
Scott Sanderson e728e0c1f3 BUG: Fail when passing two Filters to set_screen. 2015-10-07 10:48:42 -04:00
Stewart Douglas 3ef0ddf0c6 ENH: Add future_symbol API method 2015-10-05 11:19:04 -04:00
Stewart Douglas 3cfdd6cf8c ENH: Add lookup_future_symbol method 2015-10-05 10:25:08 -04:00
Scott Sanderson 557bdcd69d MAINT: Don't name pipelines.
`Pipeline()` no longer takes a name.
`attacH_pipeline` now takes a name.

This is mainly for uniformity with how `Factors` and `Filters` are
handled.
2015-10-02 16:31:29 -04:00
Scott Sanderson 096a0d49fd MAINT: Rename drain_pipeline -> pipeline_output.
More boring, but *drain* carries a connotation of "get everything",
which is misleading.
2015-10-01 18:03:54 -04:00
Scott Sanderson 4f2d3d783a TEST: Template in module name.
Fixes failures when tests are invoked from different paths.
2015-10-01 18:03:54 -04:00
Scott Sanderson 2034c65599 MAINT: Pluralize top-level term namespaces.
zipline.pipeline.factor -> zipline.pipeline.factors
zipline.pipeline.filter -> zipline.pipeline.filters
2015-10-01 18:03:54 -04:00
Scott Sanderson a40d7e47c1 MAINT: Re-export CustomFactor in zipline.pipeline. 2015-10-01 18:03:54 -04:00
Scott Sanderson 1f6c7ff31f MAINT: Rename ffc_loader -> pipeline_loader. 2015-10-01 18:03:54 -04:00
Scott Sanderson 2d683961bd MAINT: More renaming.
s/FFCEngine/PipelineEngine/
s/FFCLoader/PipelineLoader/
2015-10-01 18:03:54 -04:00
Scott Sanderson f82a01841b MAINT: Rename ALL the things.
zipline.modelling.* -> zipline.pipeline.*
zipline.data.ffc.loaders -> zipline.pipeline.loaders
tests/modelling -> tests/pipeline
2015-10-01 18:03:53 -04:00
Scott Sanderson 01ea88c225 TEST: Test screen handling in test_handle_split. 2015-10-01 18:03:53 -04:00
Scott Sanderson 98d2ed9940 TST: Refactor test_handle_adjustment.
Pull all the expected_result calculations into a helper.
2015-10-01 18:03:53 -04:00
Scott Sanderson eb997bb5f8 TEST: Pass cls.env for test_handle_adjustment.
Otherwise we inseret random assets into a new TradingEnvironment, which
is surprising in debugging.
2015-10-01 18:03:53 -04:00
Scott Sanderson 8e59d12daf ENH: Pipeline API
- Adds `zipline.pipeline.Pipeline`, a new user-facing class for managing
  pipelines of Modeling API expressions.

- Adds `attach_pipeline` and `drain_pipeline` as API methods

- Removes `add_factor` and `add_filter` as API methods.  These have been
  replaced two new methods on `Pipeline`: `add`, and `apply_screen`.

- Adding a `Filter` as a column no longer implicitly truncates rows from
  the Modelling API output.  It simply causes a new column, of dtype
  `bool` to show up in the output. Removal of rows is now handled by the
  new `apply_screen` method of `Pipeline`.

- Refactors the existing Modeling API tests to reflect the new APIs.
2015-10-01 18:03:53 -04:00
Scott Sanderson 0e0dec49e5 TST: Rename test method. 2015-10-01 18:03:53 -04:00
Scott Sanderson b71db4267c TST: Add missing tests from test_rank_descending. 2015-10-01 18:03:53 -04:00
Scott Sanderson a483455183 ENH: Add zipline.utils.numpy_utils.
Currently provides two functions for doing fancy things with array
strides: `repeat_first_axis` and `repeat_last_axis`.
2015-10-01 18:03:53 -04:00
Scott Sanderson b766ce6ebd ENH: Add zipline.utils.cache.
Implements a `CachedObject` utility class for wrapping cached results
with an expiration date.
2015-10-01 18:03:53 -04:00
Scott Sanderson 00c413e9d4 ENH: Add zipline.utils.preprocess.
Implements tools for preprocessing the arguments to user-facing
functions.
2015-10-01 18:03:53 -04:00
Scott Sanderson 75138343ba BUG: Use IGNORE_EXCEPTION_DETAIL in test_doctests.
Causes doctest to not care about the module of the raised exception.
This matters because Python3 includes the module in the formatted
exception, but Python3 doesn't, so the doctest will always fail on one
or the other without this flag.
2015-10-01 18:03:53 -04:00
Stewart Douglas 8ba15a6f72 BUG: Correctly test for duplicate symbols 2015-10-01 15:02:23 -04:00
Eddie Hebert 23e7433635 TST: Make params explicit to calc results.
Change calculate_results to take explicit parameters for sim_params, env
and benchmark_events instead of reading those values off of the TestCase
instance.

This prepares for tests setting specific sim_params in each test case,
which is needed for an incoming refactoring of how the test data is set up.
2015-09-29 14:36:45 -04:00
Eddie Hebert 9581afb32a TST: Remove random simulation parameters.
For better predictability/ability to reason and step through the test
cases, use the same start and end for each run of the test suite.
2015-09-29 14:36:45 -04:00
Eddie Hebert cbb3d807b7 TST: Remove instant fill from close position test.
'instant fill' execution may be on the path to deprecation, (the removal
is currently proposed by the branch which removes events in favor of
operating over dts.), so remove instant_fill from the close position
tests so that the input and output is the same between the proposed
branch and here.

(This was one of the few places where instant fill was used that
was not testing instant fill behavior explicitly, so may be better to
align this test with the rest of the suite.)

Also, change test methods to make it more clear on which day the values
the expected and actual results differed.
2015-09-28 14:48:19 -04:00