Commit graph

55 commits

Author SHA1 Message Date
vikram-narayan
d708817e44 MAINT: use ISO 10383 codes for exchanges 2018-10-01 12:45:27 -04:00
Joe Jevnik
ec797013c5 TST: update example data 2018-07-27 15:38:31 -04:00
Richard Frank
7cdb37ca21 MAINT: Enable example data rebuilding
Rebuilt example data
2018-07-10 11:20:39 -04:00
vikram-narayan
d4ba48709d MAINT: use trading_calendars in zipline
- remove zipline.utils.calendars
- update imports
- add trading-calendars to requirements
2018-07-02 11:10:49 -04:00
Joe Jevnik
1f50b1b0d3 ENH: new risk metrics API 2018-02-26 17:48:14 -05:00
Alexey Degtyarev
744a213dc8 Add compression to QUANDL_ARCHIVE.zip
By default, the contents of 'zipfile' archive are not compressed. This
change will set compression mode of the generated sample thus reducing
file size by ~70%.
2018-02-16 20:55:50 +03:00
ernestoeperez88
079ea3dc19
ENH: Update quandl_bundle to use Quandl API v3. (#1990)
* ENH: Update quandl_bundle to use Quandl API v3.

Quandl released an update to their API that allows downloading the
WIKI Prices dataset in a single call. Updating quandl_bundle to
make use of this new API.
2017-11-20 13:55:10 -05:00
Freddie Vargus
67d983b692
Merge pull request #1860 from bartosh/csvdir
ENH: Implement csvdir bundle
2017-11-09 15:49:53 -05:00
Ed Bartosh
30c2431312 TST: add test case for csvdir bundle 2017-11-09 21:58:47 +02:00
David Michalowicz
d7ef79779e MAINT: Remove and zero out unused treasury curves 2017-08-11 17:09:22 -04:00
Freddie Vargus
492b22f0b1 TST: Add error message for --rebuild--input 2017-07-03 16:39:33 -04:00
Freddie Vargus
d4d8db3e1a MAINT: Remove code that doesn't work with the new yahoo API
DOC: Remove mentions of Yahoo data bundles

MAINT: Remove yahoo bundle, test, and more mentions of yahoo
2017-07-03 11:01:39 -04:00
Freddie Vargus
a12c34c39c MAINT: Skip more rows to match change in treasury data format
I'm not sure what the raw csv pulled from the federal reserve looked like before, but when trying to download fresh treasure data (data not stored in `./zipline`), there is an error that says "Time Period not in list". After checking the raw csv now, it looks like there are 5 header rows rather than just 1, so skipping those rows removes that error.
2017-06-05 11:44:01 -04:00
Freddie Vargus
f957545e47 TST: Sort test examples to debug more easily 2017-06-01 23:35:11 -04:00
Freddie Vargus
776677fcdf BUG/MAINT: Switch over to Google for benchmarking
MAINT: Remove mentions of Yahoo & ^GSPC

MAINT: Fill in missing dates

MAINT/BLD: Rebuild example data to match new benchmark
2017-06-01 23:35:10 -04:00
Scott Sanderson
22df0a9cb9 MAINT/STY: Upgrade flake8 and fix new failures. 2017-05-15 11:45:04 -04:00
Maxwell Rounds
d66f7f53a0 ENH: Adding CFE Adhoc Holidays
The CFE was closed along with the NYSE in observation of the days of
mourning in honor of the passing of presidents Gerald Ford and Ronald
Reagan. The CFE also observed the closures due to Hurricane Sandy,
along with NYSE. Adding those adhoc holidays to exchange_calendar_cfe
and removing them from cfe.csv in tests. To fit with
USNationalDaysofMourning, also removing the closure in observation of
the day of mourning in honor of the passing of president Nixon in
1994, despite the fact that the exchange did not exist at that time.

Signed-off-by: Maxwell Rounds <maxwell.j.rounds@gmail.com>
2017-03-26 15:54:14 -07:00
Gus Gordon
b45c52b453 Bump empyrical to 0.2.2 (#1674)
* Bump empyrical to 0.2.2

* Update example data for tests
2017-02-04 16:14:33 -05:00
Andrew Daniels
0848a8a486 ENH: Adds support for supplementary asset mappings (#1612)
* ENH: Adds support for supplementary asset mappings

- Adds a supplementary_mappings table to the assets.db, to hold point-
  in-time mappings of sids to arbitrary categories of values, e.g.
  alternative identifiers. This bumps ASSET_DB_VERSION.

- Adds supplementary_map and supplementary_map_by_sid to AssetFinder,
  caches of the underlying table that are fully populated on first
  access, which map the supplementary values to sids and vice versa,
  respectively.

- Adds lookup_by_supplementary_mapping method, which fronts
  supplementary_map to query for the asset last known to have held a
  value at a given dt.

- Add get_supplementary_field method, which fronts
  supplementary_map_by_sid to query for the last known value held by an
  asset at a given dt.
2016-12-16 15:20:53 -05:00
Scott Sanderson
ccd94e6e64 MAINT: Rebuild example data. 2016-09-20 17:12:09 -04:00
Scott Sanderson
72806620ea DOC: Note where cleanup happens. 2016-09-20 17:12:07 -04:00
Ana Ruelas
9063cb3ce4 BUG: Do not adjust returns for sharpe and sortino 2016-09-02 10:41:50 -04:00
Ana Ruelas
f669602581 BLD: Update to empyrical 0.1.11 2016-08-30 16:41:57 -04:00
Ana Ruelas
20b4d007f7 TST: Rebuild example data due to changes in beta calculation 2016-08-29 15:11:37 -04:00
Ana Ruelas
7f042476be TST: Rebuilt example data using empyrical 2016-08-23 13:49:48 -04:00
Ana Ruelas
f57fe0a4b0 TST: Update to empyrical, increase test coverage
ENH: Resolve rebase conflict by using updated example_data.tar

TST: Increase test coverage for risk portion of zipline
2016-08-23 13:49:43 -04:00
Andrew Daniels
37e6a48e99 ENH: Pass calendar instance to BcolzMinuteBarWriter (#1406)
* First pass.

* Improvements and fixes

- Update usages of BcolzMinuteBarWriter
- Updates with rebuilt example data
- Expose calendar from BcolzMinuteBarMetadata instead of calendar_name
- Keep market_opens and market_closes in metadata for compatibility

* Store start_session and end_session in minute bcolz metadata

- start_session replaces first_trading_day
- Add end_session to limit to correct days

* For last_available_dt, get last close from calendar to maintain tz

* Bumps version and handles earlier versionson read

* Rebuilt example data on python 3

* Indicate metadata fields that are deprecated
2016-08-18 15:41:26 -04:00
Jean Bredeche
d1077a36c2 TST: Fix broken tests, updated example data 2016-08-04 09:38:18 -04:00
Joe Jevnik
4265a13edf Revert "Merge pull request #1354 from quantopian/revert-1302-point-in-time-asset-db"
This reverts commit 3b633011c6, reversing
changes made to 70ac5323de.
2016-08-02 14:25:10 -04:00
Jean Bredeche
c54ede896c rebuilt in py3/pandas16 2016-08-02 10:43:04 -04:00
Jean Bredeche
33bef2165c rebuilt data in py3 2016-08-02 10:17:19 -04:00
Jean Bredeche
a40d205afa ENH: Adding exchange_full to equity asset column 2016-08-02 09:35:08 -04:00
Joe Jevnik
814a2be7b7 Revert "Point in time asset db" 2016-07-27 23:29:08 -04:00
Joe Jevnik
7fd8c29880 ENH: add point in time aspect to equity symbol mapping
Changes the overlap behavior so that it is an error to write data which
would have two companies holding the same ticker. Other than one test
around which company would win in that case, all the other tests are
passing. That single test has been changed to check the write-time
error.
2016-07-26 13:34:58 -04:00
Jean Bredeche
21aca754ba ENH: Reorganized internal calendar implementation.
Added tests for CME calendar.

Added ICE calendar (and tests).

Added CFE calendar (and tests).
2016-07-19 22:27:34 -04:00
Jean Bredeche
6fb4923cc7 Re-implemented the Calendar API.
Instead of having separate ExchangeCalendar and TradingSchedule objects, we
now just have TradingCalendar.  The TradingCalendar keeps track of each
session (defined as a contiguous set of minutes between an open and a close).
It's also responsible for handling the grouping logic of any given minute
to its containing session, or the next/previous session if it's not a market
minute for the given calendar.
2016-07-12 13:13:50 -04:00
jfkirk
10a118d94c MAINT: Removes references to tradingcalendar 2016-06-08 13:34:20 -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
Scott Sanderson
392ac2f9d6 DOC/TEST: Add example algo using Pipeline. 2016-05-24 22:34:05 -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
0bd790d122 MAINT: replace usages of pandas.io.data.DataReader with pandas_datareader.data.DataReader 2016-05-20 11:23:28 -04:00
Joe Jevnik
d819721d96 ENH: use more human readable format for bundle ingest directories
We are now using isoformats with ':' replaced with ';'. We cannot use a
normal isoformat because windows does not allow files or directories
with ':' in the name.
2016-05-05 18:22:13 -04:00
Joe Jevnik
59c8e371a2 ENH: Updates the cli, data bundles and extensions.
Adds the data bundle concept which makes it easy for users to register
loading functions to build out minute and daily data along with an
assets db and adjustments db. By default we have provided a `quandl`
bundle which pulls from the public domain WIKI dataset. Users may
register new bundles by decorating an ingest function with
`zipline.data.bundles.register(<name>)`. This also provides a
`yahoo_equities` function for creating an ingestion function that will
load a static set of assets from yahoo.

The cli is now structured as a couple of subcommands and has been
changed to `python -m zipline`. The old behavior of `run_algo.py` has
been moved to the `run` subcommand. This is almost entirely the same
except that it now takes the name of the data bundle to use, defaulting
to `quandl`.

The next subcommand is `ingest` which takes the name of
a data bundle to ingest. This will run the loading machinery and write
the data to a specified location that `run` can find.

There is also a `clean` subcommand which deletes the data that was
written with `ingest`.

Extensions have also been added to zipline. This is an experimental
feature where users can provide an extra set of python files to run at
the start of the process. These can be used to configure aspects of
zipline. Right now the only thing that is supported in an extension file
is the registration of a new data bundle.
2016-05-03 18:38:24 -04:00
Jean Bredeche
9d1e15ddde BUG: Fetcher wasn't working properly in before_trading_start.
We were trying to use the previous day in before_trading_start because
we were looking for the previous market minute, then normalizing it.  That's
no longer the case, as we want to use today's date for fetcher lookups
in before_trading_start.

Also refactored a bit how dataportal determines if a query should be
routed to the fetcher data structures.
2016-04-21 15:09:14 -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
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
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
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
Brian Fink
8baf52fe01 ENH: Add max leverage account guard 2015-04-10 15:19:54 -04:00
Dale Jung
7892a6943f RFT: Remove Position management from PerformancePeriod. This cuts down
on the number of per-tick update that occur since they were duplicated
per each PerformancePeriod. Also opens up the path to cythonizing the
entire object
2015-03-18 22:48:14 -04:00