Commit Graph
73 Commits
Author SHA1 Message Date
Stewart Douglas 3ffe9a0536 Merge pull request #1234 from quantopian/variable-minute-blocks
Add test to cover new minute block logic
2016-05-26 10:00:20 -04:00
Stewart Douglas 71bcc7f911 DOC: Update comments to reflect new behavior 2016-05-26 09:38:25 -04:00
Stewart Douglas 17c20da026 TST: Add test to append minutely data 2016-05-26 09:38:25 -04:00
Stewart Douglas b0d688a454 Merge pull request #1198 from quantopian/modify-minutes-writer
Allow BcolzMinuteBarWriter to append to most recent day
2016-05-13 16:56:45 -04:00
Stewart Douglas 8217cdb1bd ENH: Allow BcolzMinuteBarWriter to append to most recent day
Minutely data can now be appended to bcolz files even when
minutes in the same day have already been written. For example,
previously attempting to write data for the minute 2016-05-11 16:30
would raise an exception if any OHLCV data for 2016-05-11 had been
written to the same file.

Trying to overwrite existing minutes still raises a
BcolzMinuteOverlappingData exception.

Note that previously all sids' bcolz files ended at the same time.
This is no longer necessarily the case. The last record in each
sid's bcolz file now corresponds to the latest minute for which
OHLCV data is provided to the writer.
2016-05-13 16:24:21 -04:00
Stewart Douglas ccdb376489 Merge pull request #1018 from quantopian/order-multiplier-values
BUG: Ensure consistent ordering of amounts, prices & multipliers
2016-03-11 17:49:50 -05:00
Stewart Douglas 0e97a01c05 TST: Test multiple calls to update_positions 2016-03-11 13:16:25 -05:00
Stewart Douglas e47cb96479 BUG: Ensure consistent ordering of amounts, prices & multipliers
Previously, we have assumed that the `amounts` and `last_sale_prices`
lists have the same order as the `value_multipliers`. This is not
correct, since to populate the `amounts` and `last_sale_prices` lists
we iterate over a `dict` (self.positions). The order of this `dict`
can change in arbitrary ways when it is updated, which occurs when
we call `update_positions`. Our `value_multipliers` however are stored
in an `OrderedDict`, meaning the order of existing key/value pairs
is not changed when they are updated.

To address this issue, we make sure that `self.positions` subclasses
`OrderedDict`.
2016-03-11 13:16:24 -05:00
Stewart Douglas 358ab41569 TST: test history() in before_trading_start() 2015-10-23 13:32:36 -04:00
Stewart Douglas 6795ea74c9 ENH: Update next_market_minute() & previous_market_minute()
Previously we were not accounting for cases where we would invoke
next_market_minute() with a time on a trading day *before* the
market open, or previous_market_minute() with a time on a trading
day *after* the market close.
2015-10-23 10:30:06 -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
Stewart Douglas 3feb78807e MAINT: Add license to various files 2015-10-07 15:47:45 -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
Stewart Douglas e33fa988f2 DEP: Remove _convert_asset_str_fields
_convert_asset_str_fields was added to address the fact that the
unicode returned by SQLAlchemy was causing test failures, in
particular test_repr and test_root_symbols failed because of the
leading 'u' character in the unicode of python-2.x. Later it was
pointed out that this method would behave differently in python 2
and 3, in particular the str() method would return bytes in python
2 and unicode in python 3. After investigating it was found that
the _convert_asset_str_fields was no longer  necessary. It is unclear
why the original tests were failing. It is not due to SQLAlchemy
versions, as tests pass for version >1 and <1.
2015-10-01 15:02:23 -04:00
Stewart Douglas 8ba15a6f72 BUG: Correctly test for duplicate symbols 2015-10-01 15:02:23 -04:00
Stewart Douglas 29321af1b4 DEP: Remove quantopian_buy_applye.py as logic covered in buyapple.py 2015-09-10 17:17:46 -04:00
Stewart Douglasandjfkirk a517929cbb DOC: Improve documentation in asset_writer.py 2015-09-10 11:53:27 -04:00
Stewart Douglasandjfkirk 22827d1c89 MAINT: Convert map to list in lookup_future_chain 2015-09-10 11:53:27 -04:00
Stewart Douglasandjfkirk ee9c79a6f8 MAINT: Reduce end_date int for SQLite Python3.3 compatibility 2015-09-10 11:53:27 -04:00
Stewart Douglasandjfkirk 593e114f0a BLD: Include sqlalchemy and toolz in .travis.yml 2015-09-10 11:53:27 -04:00
Stewart Douglasandjfkirk d3516959a3 MAINT: Don't set string to upper before writing, remove unused libs 2015-09-10 11:53:27 -04:00
Stewart Douglasandjfkirk 3224085a1d ENH: Check whether identifier columns provided in DataFrame 2015-09-10 11:53:27 -04:00
Stewart Douglasandjfkirk 7be2cf8652 MAINT: Allow algo.run() to write to db 2015-09-10 11:53:27 -04:00
Stewart Douglasandjfkirk 1ef2274d11 MAINT: Update tests to conform to new reader/writer structure 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk 8ccdae9870 MAINT: Change defaults when parsing kwargs in TradingEnvironment 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk bd7be19198 ENH: Allow write_data to consume DataFrames 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk 92f99e62f0 MAINT: AssetFinder should not write to db 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk 9d313ab877 BUG: Various bug fixes to assets.py
Bug fixes include:
	- Do not call float on tuples
	- Correct indentation
	- Do not call value() on int
	- Use fuzzy correctly
	- Use symbol for lookup
	- Ensure we raise Error
2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk 16488d9053 ENH: Base new sid creation on existing sids in database 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk 1d958bd7eb ENH: Allow AssetDBWriterFromList to consume Assets 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk aa110dd149 ENH: Add init_db to transaction so table exists=>it has also been written to 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk 667f0695d5 BUG: Avoid NOT NULL violation by checking for data first 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk e5875af784 DOC: Documentation improvements 2015-09-10 11:53:26 -04:00
Stewart Douglasandjfkirk e529df06ea ENH: Add autoload=True for compatibility with SQLAlchemy < 1.0.0 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk ded6f8543f BUG: Cast datetime to Timestamp to call value 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk 3af8b6d6c8 DEP: Remove unecessary calls to write_data 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk 1c512c5478 TST: Update test_algorithm.py to incorporate TradingEnvironment.write_data 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk c8b88432cc BUG: Account for sid == 0 in if statement 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk 4300ab357a BUG: Convert sqlalchemy RowProxy to dict for assignment 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk 46346ecb5d BUG: Ensure symbols are made upper case in db 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk 678aec2cae MAINT: Convert dates to INTs for SQLite and set default end_date 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk 32b663c5ca MAINT: Enforce uniqueness of sid column 2015-09-10 11:53:25 -04:00
Stewart Douglasandjfkirk 501fd58fdf ENH: Replace update_asset_finder with write_data
The write_data methods invokes the relevant AssetDBWriter subclass
to write data to the database. update_asset_finder is no longer
a relevant method since the AssetFinder is strictly a reader class.
2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk 9660447ed0 MAINT: Ensure correct pandas.DataFrame is returned 2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk a8f60366cd MAINT: Remove call to write_all when initializing db 2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk d55920a43b ENH: Return namedtuple from load methods 2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk b658f579d2 ENH: Consolidate logic into load_data method 2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk 59f5a9683b DEP: Remove legacy writer classes 2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk 47ed3a2fdb ENH: Update AssetDBWriterFromList to consume identifiers
Allow consumption of a list of identifiers, including assigning
sids if necessary.
2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk 8fc97b99b2 MAINT: Default constraints=True in AssetDBWriter 2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk 38f3e6c713 ENH: Add UNIQUE and NOT NULL constraints 2015-09-10 11:53:24 -04:00
Stewart Douglasandjfkirk fc8ea9b39b MAINT: Remove NOT NULL constraint when constraints=False 2015-09-10 11:53:23 -04:00
Stewart Douglasandjfkirk 17c6ecbfff STY: Formating changes 2015-09-10 11:53:23 -04:00
Stewart Douglasandjfkirk 06894c301e DEP: Stop exporting deprecated methods 2015-09-10 11:53:23 -04:00
Stewart Douglasandjfkirk 4b763f4138 ENH: Update load_data method 2015-09-10 11:53:23 -04:00
Stewart Douglasandjfkirk 97e980751f MAINT: Integrate asset writer changes into TradingEnvironment 2015-09-10 11:53:23 -04:00
Stewart Douglasandjfkirk abcb6704e8 TST: Modify tests given new AssetFinder behavior 2015-09-10 11:53:22 -04:00
Stewart Douglasandjfkirk f12c9aa0b7 ENH: Create AssetDBWriterFromDataFrame class 2015-09-10 11:53:22 -04:00
Stewart Douglasandjfkirk ad28d5ee0a ENH: Remove all writing functionality from AssetFinder 2015-09-10 11:53:22 -04:00
Stewart Douglasandjfkirk 696d8f2846 MAINT: Insert data into asset_router 2015-09-10 11:53:22 -04:00
Stewart Douglasandjfkirk 449400426d ENH: Enable fuzzy matching for equities 2015-09-10 11:53:22 -04:00
Stewart Douglasandjfkirk c8cb2d92dd MAINT: Use raw SQL driver rather than pandas to_sql method
Allows us to create an SQL transaction to avoid errors
from race conditions.
2015-09-10 11:53:22 -04:00
Stewart Douglasandjfkirk 746f70a133 ENH: Create AssetDBWriter class
The AssetDBWriter class and its subclasses will
ultimately be responsible for creating the SQLite
database tables and writing data to these tables.

In the longer term AssetDBWriter and AssetFinder will
be decoupled, sharing only an SQLite connection.
However, for backward compatibility reasons this has
not yet been fully implemented.

Modify tests since AssetFinder no longer has a
metadata_cache attribute.
2015-09-10 11:53:22 -04:00
Stewart Douglas 45adc57267 TST: Simulate running an algo using scripts/run_algo.py
Previously we have not had test coverage of the parse_args() or
run_pipeline() functions invoked when running scripts/run_algo.py.
2015-09-10 11:47:45 -04:00
Stewart Douglas 283c959cc4 MAINT: Move analyze methods into algorithm files 2015-09-10 11:36:14 -04:00
Stewart Douglas 723c5bb069 ENH: Add if name == main blocks to examples 2015-09-10 11:32:41 -04:00
Stewart Douglas 3f4bbc521a ENH: Add axis label to olmar output plot 2015-09-10 11:32:41 -04:00
Stewart Douglas dee69f39fe BUG: Allow dual_em_talib.py to be executed with run_algo.py 2015-09-08 11:55:06 -04:00
Stewart Douglas e507ee097d TST: Add coverage for set_symbol_lookup_date method 2015-09-08 11:01:04 -04:00
Stewart Douglas 1e31866471 MAINT: FutureChain should only accept Timestamp 2015-09-08 11:01:04 -04:00
Stewart Douglas ad31e1ff6e MAINT: Coerce user input to Timestamps, catching errors 2015-09-08 11:01:04 -04:00
Stewart Douglas c2159d429b ENH: Allow user to set the symbol lookup date
Previously symbols were resolved to sids based on the end of
simulation date. This commit allows the user to specify the
date for which resolution will take place using a new
set_symbol_lookup_date() API method.

If the user does not use this method the lookup date will
default back to the simulation end date.
2015-09-08 11:01:04 -04:00