Commit Graph

2669 Commits

Author SHA1 Message Date
Scott Sanderson 223c8d02f9 MAINT: Don't alias bounds in engine loop. 2015-08-04 19:24:55 -04:00
Scott Sanderson 7f374f2ba3 MAINT: Bump bcolz version to latest. 2015-08-04 18:16:09 -04:00
Scott Sanderson b89fc0c028 BUG: Fix error from RequiredWindowLengthMixin.
WindowLengthNotSpecified expects an argument.
2015-08-04 01:41:03 -04:00
Scott Sanderson e91b1c56b2 MAINT: Remove unused import. 2015-08-04 01:40:16 -04:00
Scott Sanderson 0cc84e7a15 BUG: Use normed last_close instead of period_end.
`period_end` can be outside the range of data for which we have dates.
`last_close` properly gets pulled back to the last date for which we
actually have data.

We should consider whether or not we need to be storing period_end at
all.
2015-08-03 12:09:26 -04:00
Scott Sanderson 69d5aed7f6 BUG: Pop ffc_loader kwarg in TradingAlgorithm.
Prevents us from forwarding it as an initialize_kwarg.
2015-08-03 12:09:00 -04:00
Scott Sanderson 45d829cda0 BUG: Use a "real" index in NoOpFFCEngine.
This makes us return an empty DataFrame in data.factors instead of
barfing.
2015-08-03 12:08:08 -04:00
Scott Sanderson 7bb20eb297 MAINT: Check dates before computing factor_matrix.
In SimpleFFCEngine.factor_matrix barf with a useful error if end_date <=
start_date.
2015-08-03 12:06:24 -04:00
Scott Sanderson 5da03d2df5 BUG: Make NumExprFilter return ndarray.
- Previously it was returning a DataFrame because of how we applied an &
  with a DataFrame mask.  The error was masked by the fact that
  `np.assert_array_equal` coerces inputs to arrays before comparing.

- Added `zp.utils.test_utils.check_arrays`, which checks type equality
  before calling `np.assert_array_equal`.
2015-08-03 11:59:11 -04:00
jfkirk 67c56f768b ENH: Adds auto-closing feature and implements for Futures 2015-07-31 10:38:44 -04:00
Scott Sanderson f13e9fd125 TEST: Add test asserting dynamic api_methods. 2015-07-29 12:30:46 -04:00
Scott Sanderson 01c03d2267 MAINT: Add nullctx back to test_utils.
Temporary upstream compat for Quantopian code.

To be removed at the earliest possible convenience.
2015-07-29 12:30:46 -04:00
Scott Sanderson de3111d51a BUG: dict.itervalues() doesn't exist in PY3 2015-07-29 12:30:46 -04:00
Scott Sanderson ef4f642e62 ENH: Compute engine architecture for FFC API.
This patch lays the groundwork for a compute engine designed to
facilitate construction of factor-based universe screening and portfolio
allocation.  It contains:

A new module, `zipline.modelling`, containing entities that can be used
to express computations as dependency graphs.  Each node in such a graph
is an instance of the base `Term` class, defined in
`zipline.modelling.term`.  Dependency graphs are executed by instances
of `FFCEngine`, defined in `zipline.modelling.engine`.

A new module, `zipline.data.ffc`, containing loaders and dataset
definitions for inputs to the modelling API.

New `TradingAlgorithm` api methods: `add_factor`, and `add_filter`.
These methods can only be called from `initialize`, and are used to
inform the algorithm that each day it should compute the given terms.
Computed factor results are made available through a new attribute of
the `data` object in `before_trading_start` and `handle_data`.  Computed
filter results control which assets are available in the factor matrix
on each day.
2015-07-29 12:30:46 -04:00
Scott Sanderson 6b72b60cde MAINT: Don't install non-zipline packages.
In particular, don't give anyone who installs zipline a global package
named 'tests'.  (sob)
2015-07-29 12:30:46 -04:00
Scott Sanderson 26ef001bfc Merge pull request #658 from quantopian/remove-unused-property
MAINT: Remove unused `assets` property.
2015-07-28 19:34:14 -04:00
Jonathan Kamens dca679edcb BUG: Logbook 0.10.0 requires explicit handler
As of logbook 0.10.0, logbook no longer installs a default handler,
which means that if the application doesn't install one, log messages
disappear into the ether.

Therefore, all of our scripts with `__main__` endpoints need to push a
`logbook.StderrHandler` if they're not already pushing some other
handler.
2015-07-28 04:38:41 -04:00
Jonathan Kamens 576e4184d7 BLD: Update mock to release 1.3.0 2015-07-24 12:28:51 -04:00
Jonathan Kamens 393ea35e46 BLD: Switch back to PyPI version of xlrd
The bug which prompted us to use our own version of xlrd is patched in
the current PyPI release, so switch back to it.
2015-07-24 12:28:12 -04:00
Jonathan Kamens 622144fa75 BLD: Add "--exists-action w" to pip invocations 2015-07-23 15:58:13 -04:00
Jonathan Kamens 21610053e6 MAINT: Upgrade PyPI versions of tornado, mistune, mock, patsy 2015-07-23 14:51:25 -04:00
Jonathan Kamens 5e796aacf1 DEV: Add piprot and its deps to requirements_dev.txt 2015-07-23 14:34:03 -04:00
Scott Sanderson 20c5fc356f MAINT: Remove unused assets property.
It references a self.cache attribute that no longer exists.
2015-07-21 17:43:43 -04:00
jfkirk 16ab46b69c DEV: Uses ValueError when PerformanceTracker.to_dict receives invalid emission type 2015-07-21 16:06:52 -04:00
jfkirk 8d5bfd3c91 BUG: Aligns performance packet generation between minute and daily modes 2015-07-21 13:25:39 -04:00
Eddie Hebert f22e9e5122 Revert "PERF: Reuse one cursor in asset finder lookups."
This reverts commit 136a09776d.
2015-07-16 15:36:48 -04:00
Eddie Hebert 136a09776d PERF: Reuse one cursor in asset finder lookups.
Instead of creating a new cursor with each query, use the same cursor
throughout the lifetime of the finder instance to remove any overhead
from creating a new cursor in tight loops.
2015-07-16 15:16:36 -04:00
Eddie Hebert 376dc7b703 BUG: Fix exception on no symbol with fuzzy enabled
If there is no symbol there should be no fuzzy lookup either.
2015-07-15 15:52:33 -04:00
Eddie Hebert ace2b5c9e9 PERF: Improve risk metrics update speed.
Remove the DataFrame of headline risk metrics, in favor of a numpy array
for each metric, like the underlying vectors.
2015-07-15 15:36:35 -04:00
Eddie Hebert 27ab36deb2 MAINT: Remove references to minute risk.
The minutely calculation of risk metrics had been removed with a
previous patch, remove vestigial references.

Remove a test which tested the behavior of updating the second minute of
a day.

Remove the logic that changed the datetime index of the risk metrics
depending on emission rate, now only trading_days are needed.

Remove `returns_frequency` parameter since both minute and daily
data frequency always use daily returns.
2015-07-15 15:36:35 -04:00
Eddie Hebert 64bbb83ee8 BUG: Force string for asset data values.
Internal tests depend on string vs. unicode for various asset data, so
enforce strings by setting the text_factory on the sqlite connection.
2015-07-15 09:24:42 -04:00
Eddie Hebert 3f57b742d3 BUG: Provide asset data for multiple symbol error.
Fix a change in the information given to the multiple symbol error
during the recent sqlite change to the asset finder.

Instead of the string of sids, return full asset information about the
available options, since internal code relied on the full data.
2015-07-15 09:00:03 -04:00
Eddie Hebert 85b6260d80 BUG: Make sure metadata_cache is created.
Fix issue where metadata_cache was missing causing an AttributeError.
2015-07-14 22:49:00 -04:00
Jonathan Kamens b2fc9da1c8 PyPI updates 2015-07-14 17:19:03 -04:00
Scott Sanderson ac77133672 Merge pull request #651 from quantopian/remove-string-is-checks
BUG: Replaces is-check against string
2015-07-14 15:39:21 -04:00
jfkirk a7f967fb20 BUG: Replaces is-check against string
Replaces an " is 'None' " check with " != None "
2015-07-14 15:18:55 -04:00
Eddie Hebert 36319122cc PERF: Change asset finder to be backed by sqlite3.
Attack the startup bottleneck of creating the asset finders caches for a
large universe, which was between 1-2 seconds on development and
production machines.

Instead, allow the AssetFinder to be passed a sqlite3 file that has
already been populated and then hydrate asset objects only when an
equity is referenced for the first time.

To create aforementioned sqlite3, create an AssetFinder with an db_path
and `create_table` set to True. If `create_table` is set to False, the
prepopulated data in the sqlite file found at db_path will be used.

Default behavior is to use an in memory database.

Behavior that changes:

- Fuzzy lookup now only works on one character, that character needs to be
specified at write/metadata consumption time, since the fuzzy lookup key
is created by dropping the character from each symbol.

- Overwriting partially written metadata is no longer
  supported. i.e. some unit tests allowed for inserting just the identifier,
  and then later updating the symbol, end_date, etc.

  Instead of building an upsert behavior at this time, this patch
  changes the unit tests so that the data for each asset is only
  inserted once.

Other notes:

- populate_cache is now removed, since there is no longer a two step
  process of inserting metadata and then realizing that metadata into
  assets. _spawn_asset is rolled into insert_metadata, so that a call to
  insert_metadata both converts the metadata and makes it available in
  the data store.
2015-07-14 09:54:38 -04:00
Eddie Hebert 3847fa70e0 MAINT: Remove shadowing of built-in type function.
Change variable name in convertible registration so that `type` is not
over-written at module scope.
2015-07-13 16:38:50 -04:00
Andrew Daniels 2ab9f8a63c ENH: Futures API 2015-07-13 09:50:36 -04:00
Jonathan Kamens f30c249e0e Upgrade versions of pbr and mock 2015-07-12 15:54:24 -04:00
Eddie Hebert ad4126bf58 STY: Remove unused import.
Mea culpa.
2015-07-10 17:03:44 -04:00
Jonathan Kamens 7adba53f54 MAINT: pip<7.1.0 is incompatible with mock 1.1 2015-07-10 16:24:28 -04:00
Eddie Hebert 2616a12551 TST: Remove test for lookup of future contract by symbol.
The lookup of future contract by individual symbol is a constraint on
incoming changes of changing how the asset finder stores data.

(i.e. the asset finder is changing so that there are separate tables for
both futures and equities.)

Since this lookup is not yet fully supported, we can add it back in on
top of the new asset finder.
2015-07-10 14:59:33 -04:00
Jonathan Kamens 38112aebc4 MAINT: Fix typos in etc/requirements_dev.txt 2015-07-10 10:47:05 -04:00
Jonathan Kamens 996ea19315 MAINT: Add more packages required by mock to requirements_dev.txt 2015-07-10 10:29:18 -04:00
Jonathan Kamens cb1bc4aa19 MAINT: Update mock and pull in all the packages it requires 2015-07-10 09:26:44 -04:00
Jonathan Kamens 5b0a7ae5a5 MAINT: Upgrade nose-parameterized to 0.5.0 2015-07-10 02:21:10 -04:00
jfkirk efa6d8dbce ENH: Adds a perf tracker method to handle SIDs leaving the universe 2015-07-09 17:03:21 -04:00
Andrew Daniels 7cde3939bf BUG: Determine valid future contracts with notice date
Since most brokers will cease accepting trades by the notice date, contracts should not be considered valid after the notice date. This commit adjusts the lookup_future_chain method to consider all contracts with notice dates on or following the current date invalid.
2015-07-09 15:23:29 -04:00
Jonathan Kamens 50d557975d MAINT: Upgrade Cython to 0.22.1 2015-07-09 14:41:57 -04:00