Commit Graph

145 Commits

Author SHA1 Message Date
Joe Jevnik ca37d73c7b TST: fix setup in test_flip_algo 2016-06-21 15:07:03 -04:00
jfkirk 39cc355066 TST: Finishes fixing fixes for the fixed fixtures 2016-06-08 13:34:23 -04:00
jfkirk d437a5d675 MAINT: Rebase fixes 2016-06-08 13:34:23 -04:00
jfkirk 2a8f69fc01 MAINT: DataPortal env -> asset_finder 2016-06-08 13:34:22 -04:00
jfkirk 581e817603 MAINT: Rebase reconciliation 2016-06-08 13:34:22 -04:00
jfkirk 75e0e4723d TST: Refactors more tests to use WithTradingSchedule 2016-06-08 13:34:20 -04:00
jfkirk d9fc514fa8 TST: Adds TradingSchedule test fixture 2016-06-08 13:34:20 -04:00
jfkirk 4b7390ac81 WIP: Refactors tests to use TradingSchedule 2016-06-08 13:34:19 -04:00
jfkirk c8304e8601 ENH: Adds ExchangeCalendar, TradingSchedule, and implementations
Conflicts:
	tests/data/test_minute_bars.py
	tests/data/test_us_equity_pricing.py
	tests/finance/test_slippage.py
	tests/pipeline/test_engine.py
	tests/pipeline/test_us_equity_pricing_loader.py
	tests/serialization_cases.py
	tests/test_algorithm.py
	tests/test_assets.py
	tests/test_bar_data.py
	tests/test_benchmark.py
	tests/test_exception_handling.py
	tests/test_fetcher.py
	tests/test_finance.py
	tests/test_history.py
	tests/test_perf_tracking.py
	tests/test_security_list.py
	tests/utils/test_events.py
	zipline/algorithm.py
	zipline/data/data_portal.py
	zipline/data/us_equity_loader.py
	zipline/errors.py
	zipline/finance/trading.py
	zipline/testing/core.py
	zipline/utils/events.py
2016-06-08 13:34:18 -04:00
Andrew Liang 1056501b27 MAINT: Support the passing of a time rule positionally on the date_rule arg
But log a warning to the user
2016-06-03 15:28:53 -04:00
Andrew Daniels 71f12ec272 MAINT: Adds first_trading_day arg to DataPortal
Instead of inferring it from the minute/daily writer, we now require the
first trading day to be passed explicitly, so the creator of the
DataPortal controls what is used as the first trading day.
2016-06-02 13:16:43 -04:00
Scott Sanderson 5caccaeed5 Merge pull request #1230 from quantopian/pipeline-example
DOC/TEST: Add example algo using Pipeline.
2016-05-25 22:35:59 -04:00
Scott Sanderson 244664b6a3 MAINT: Clean up default handling in TradingAlgorithm. 2016-05-24 22:17:01 -04:00
Andrew Liang 40f42b43f5 DEV: Adjust performance calculations for capital changes
Refactor PerformancePeriod so that it creates a sub-period every
time a capital change happens within the period
2016-05-24 17:23:36 -04:00
Jean Bredeche 39bf1dbd7b DEV: Re-implement commission models to return correct results in the case of multiple fills. 2016-05-23 21:19:06 -04:00
Joe Jevnik d888c4faaa DOC: update docs for api functions 2016-05-06 15:25:30 -04:00
Andrew Liang 7641247b41 BUG: DAY_END action not emitted during minute emission
Refactor AlgorithmSimulator so that DAY_END is emitted for both
minute and daily emission, and that handling of end-of-minute
and end-of-day are separated
2016-05-06 10:25:44 -04:00
Joe Jevnik efac476976 ENH: make BcolzMinuteBarWriter.write take iterable
Updates the BcolzMinuteBarWriter.write api to allow users to pass their
data as a stream instead of requiring that they loop over their data
externally. This matches the API presented by BcolzDailyBarWriter.
2016-04-29 16:14:48 -04:00
Andrew Liang 7332586abe FIX: Crashing on calculating benchmarking when no trading days
When we run a simulation that starts and ends on the same weekend,
return an empty series for the benchmark so as to not crash
2016-04-29 14:30:46 -04:00
Andrew Liang d69b960c49 BUG: Don't save empty positions when user access non-existent position
Previously, whenever we try to access a missing value on the Positions
dict, we return a default Position and save it to the dict. Instead,
just return the Position
2016-04-26 13:28:35 -04:00
Andrew Liang 5809ae17f1 DEV: Better error message for sid= in get_open_orders
Let the user to know to use asset= instead
2016-04-26 12:23:57 -04:00
Jean Bredeche c404c60d68 BUG: don't allow ordering in before_trading_start 2016-04-26 10:56:36 -04:00
Jean Bredeche c323506f40 BUG: we were improperly checking iterable kwargs in BarData 2016-04-21 11:06:46 -04:00
Joe Jevnik bc0b117dc9 MAINT: make the data loading apis more consistent.
Changes BcolzDailyBarWriter to not be an abc, data is passed as an
iterator of (sid, dataframe) pairs to the write method.

Changes the AssetsDBWriter to be a single class which accepts an engine
at construction time and has a `write` method for writing dataframes for
the various tables. We no longer support writing the various other data
types, callers should coerce their data into a dataframe themselves. See
zipline.assets.synthetic for some helpers to do this.

Adds many new fixtures and updates some existing fixtures to use the new
ones:

WithDefaultDateBounds
  A fixture that provides the suite a START_DATE and END_DATE. This is
  meant to make it easy for other fixtures to synchronize their date
  ranges without depending on eachother in strange ways. For example,
  WithBcolzMinuteBarReader and WithBcolzDailyBarReader by default should
  both have data for the same dates, so they may use depend on
  WithDefaultDates without forcing a dependency between them.

WithTmpDir, WithInstanceTmpDir
  Provides the suite or individual test case a temporary directory.

WithBcolzDailyBarReader
  Provides the suite a BcolzDailyBarReader which reads from bcolz data
  written to a temporary directory. The data will be read from
  dataframes and then converted to bcolz files with
  BcolzDailyBarWriter.write

WithBcolzDailyBarReaderFromCSVs
  Provides the suite a BcolzDailyBarReader which reads from bcolz data
  written to a temporary directory. The data will be read from a
  collection of CSV files and then converted into the bcolz data through
  BcolzDailyBarWriter.write_csvs

WithBcolzMinuteBarReader
  Provides the suite a BcolzMinuteBarReader which reads from bcolz data
  written to a temporary directory. The data will be read from
  dataframes and then converted to bcolz files with
  BcolzMinuteBarWriter.write

WithAdjustmentReader
  Provides the suite a SQLiteAdjustmentReader which reads from an in
  memory sqlite database. The data will be read from dataframes and then
  converted into sqlite with SQLiteAdjustmentWriter.write

WithDataPortal
  Provides each test case a DataPortal object with data from temporary
  resources.
2016-04-15 23:46:10 -04:00
Jean Bredeche 63bd7589b7 BUG: support passing an empty list to data methods.
Our type checking code was a bit too aggressive.
2016-04-14 11:11:08 -04:00
Andrew Liang 8dc3ed73ab FIX: Check types of args passed to api methods on data 2016-04-13 09:47:07 -04:00
Jean Bredeche fac5905c10 Merge pull request #1114 from quantopian/handle-data-optional
ENH: make handle_data optional
2016-04-13 09:31:41 -04:00
Richard Frank 8b610a2ab7 TST: Cleaned up test references to adjustments db
If we don't clean them up, then windows can delete
the temp dir with the db.
2016-04-12 19:33:22 -04:00
Richard Frank 32a400a9fb BUG: Fixing bitness issues on 32-bit systems
by being explicit with sizes
2016-04-12 17:07:50 -04:00
Jean Bredeche bd5e2b183d BUG: Properly log partially filled sell orders. 2016-04-12 13:57:50 -04:00
Jean Bredeche 4203c54417 ENH: make handle_data optional 2016-04-07 09:50:09 -04:00
Jean Bredeche dc01c45dc4 DEV: Apply adjustments for portfolio and account in BTS
completely copied from https://github.com/quantopian/zipline/pull/1104/

All credit goes to Andrew Liang (@lianga888)
2016-04-05 11:37:34 -04:00
Eddie Hebert 16fd6681a6 ENH: Rewrite of Zipline to use lazy access pattern
More documentation to follow in release notes.

Based on lazy-mainline branch, see for more details.

Also-By: Jean Bredeche <jean@quantopian.com>
Also-By: Andrew Liang <aliang@quantopian.com>
Also-By: Abhijeet Kalyan <akalyan@quantopian.com>
2016-04-04 16:12:58 -04:00
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
dmichalowicz 5be63f36d5 ENH: Add auto_close_date support for equities 2016-02-22 13:51:20 -05:00
jfkirk db1e62971a ENH: Adds tick_size and renames futures multiplier 2016-01-22 14:56:30 -05:00
Joe Jevnik 3b76981270 Merge pull request #846 from grundgruen/data_test
TST: tests removing of expired data and removes ffill in DataPanelSource
2016-01-19 13:05:15 -05:00
warren-oneill ef323a3165 ENH: adds lookup_expired_futures to asset_finder 2015-12-01 15:24:02 +01:00
jfkirk bbe3ab99ac TST: Adds asset type verification to test_order tests 2015-11-30 12:25:04 -05:00
warren-oneill 987d6d4e48 TST: tests removing of expired data and removes ffill in DataPanelSource 2015-11-17 17:22:31 +01:00
jfkirk 11b7cd2dd0 TST: Fixes test_order_methods_for_future 2015-11-16 11:47:00 -05:00
llllllllll 0cb4c38717 ENH: Allow users to pass a context manager to wrap all scheduled
functions.

This includes handle_data.
2015-11-11 14:19:13 -05:00
Scott Sanderson a14c61e7ff MAINT: Remove unused 'asset_type' metadata entry. 2015-11-05 13:35:05 -05:00
Richard Frank ec5318ec88 TST: Fixed up test result comparison 2015-11-05 10:18:57 -05:00
Richard Frank d2ba11dac0 STY: Fixed typo and appeased flake8 2015-11-05 10:18:57 -05:00
Richard Frank 6b245ab06a TST: Removed extra parameters 2015-11-05 10:18:57 -05:00
puppy a82415c77b BUG: Address issue #801 and add test. Pass panel directly to
object instead of data.
2015-11-05 10:18:57 -05:00
jfkirk 7d29bb6a67 BUG: Fixes failure to account for Futures transaction prices 2015-10-30 12:04:38 -04:00
warren-oneill 3f66e6c66a TST: adds future flip test 2015-10-30 10:07:46 -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