Skip to main content

Zipline extension to provide bundles of data from Norgate Data into the Zipline algorithmic trading library for the Python programming language

Project description

Project description

Creates an interface between Norgate data and Zipline, the pythonic algorithmic trading library, to create bundles.

This is currently in alpha stage testing to selected users of Norgate Data.

Currently, equities are supported. Futures data support is coming very soon.

Installation

pip install zipline-norgatedata

or, if you prefer to use conda:

conda install -c norgatedata zipline-norgatedata

Requirements

  • Python 3.5 (Note: 3.6 and 3.7 will be supported only when Zipline supports this)
  • Zipline 1.3
  • Microsoft Windows
  • An active Norgate Data subscription

Usage

Add the following lines at the top of your extension.py file (typically located at c:\users<username>.zipline)

from pandas import Timestamp
from norgatedata import StockPriceAdjustmentType
from zipline_norgatedata import register_norgatedata_equities_bundle,register_norgatedata_futures_bundle

Then create as many bundles as you desire. These bundles will use one or more watchlists from your Norgate Data installation.

Here are some examples:

bundlename = 'norgatedata-sp500-backtest'
watchlists = ['S&P 500 Current & Past']
stock_price_adjustment_setting = StockPriceAdjustmentType.TOTALRETURN
start_session = Timestamp("1990-01-01",tz='utc') 
end_session = Timestamp.now(tz='utc')
calendar_name = 'NYSE'
register_norgatedata_equities_bundle(bundlename,stock_price_adjustment_setting,watchlists,start_session,end_session,calendar_name)


bundlename = 'norgatedata-russell3000-backtest'
watchlists = ['Russell 3000 Current & Past']
stock_price_adjustment_setting = StockPriceAdjustmentType.TOTALRETURN
start_session = Timestamp("1990-01-01",tz='utc') 
end_session = Timestamp.now(tz='utc')
calendar_name = 'NYSE'
register_norgatedata_equities_bundle(bundlename,stock_price_adjustment_setting,watchlists,start_session,end_session,calendar_name)


bundlename = 'norgatedata-all-usd-futures'
watchlists = ['AllUSDFutures']
start_session = Timestamp("2000-01-01",tz='utc') # Start date of data ingestion - NOTE: zipline cannot handle dates prior to 1990
end_session = Timestamp.now(tz='utc')
calendar_name = 'us_futures'
register_norgatedata_futures_bundle(bundlename,watchlists,start_session,end_session,calendar_name)

Note: You'll need to create your own watchlist(s) for use i

Zipline Limitations

  • Zipline can only handle equities data from 1990 onwards.
  • Zipline can only handle futuresequities data from 2000 onwards.
  • Zipline has unnecessarily complicated futures contracts by restricting symbols to 2 charcters.
  • Zipline doesn't define all futures markets and doesn't provide any extensibility in this area - you will need to add them to site-packages\zipline\finance\constants.py if they are not defined

Assumptions

  • Stocks are automatically set an auto_close_date of the last quoted date
  • Futures are automatically set an auto_close_date to the earlier of following: Last trading date (for cash settled futures, and physically delivered futures that only allow delivery after the last trading date), or 1 trading day prior to first notice date for futures that have a first notice date prior to the last trading date.

Ingest data

To ingest data from one of the bundles you've defined in extension.py. For example:

zipline ingest -b norgatedata-sp500-backtest
zipline ingest -b norgatedata-russell3000-backtest

Support

Norgate Data support

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

zipline_norgatedata-0.9.0-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page