Zipline, a Pythonic Algorithmic Trading Library


Gitter pypi version status pypi pyversion status travis status appveyor status Coverage Status

Zipline is a Pythonic algorithmic trading library. It is an event-driven system for backtesting. Zipline is currently used in production as the backtesting and live-trading engine powering Quantopian -- a free, community-centered, hosted platform for building and executing trading strategies. Quantopian also offers a fully managed service for professionals that includes Zipline, Alphalens, Pyfolio, FactSet data, and more.


  • Ease of Use: Zipline tries to get out of your way so that you can focus on algorithm development. See below for a code example.
  • "Batteries Included": many common statistics like moving average and linear regression can be readily accessed from within a user-written algorithm.
  • PyData Integration: Input of historical data and output of performance statistics are based on Pandas DataFrames to integrate nicely into the existing PyData ecosystem.
  • Statistics and Machine Learning Libraries: You can use libraries like matplotlib, scipy, statsmodels, and sklearn to support development, analysis, and visualization of state-of-the-art trading systems.


Zipline currently supports Python 2.7, 3.5, and 3.6, and may be installed via either pip or conda.

Note: Installing Zipline is slightly more involved than the average Python package. See the full Zipline Install Documentation for detailed instructions.

For a development installation (used to develop Zipline itself), create and activate a virtualenv, then run the etc/dev-install script.


See our getting started tutorial.

The following code implements a simple dual moving average algorithm.

from zipline.api import order_target, record, symbol

def initialize(context):
    context.i = 0
    context.asset = symbol('AAPL')

def handle_data(context, data):
    # Skip first 300 days to get full windows
    context.i += 1
    if context.i < 300:

    # Compute averages
    # data.history() has to be called with the same params
    # from above and returns a pandas dataframe.
    short_mavg = data.history(context.asset, 'price', bar_count=100, frequency="1d").mean()
    long_mavg = data.history(context.asset, 'price', bar_count=300, frequency="1d").mean()

    # Trading logic
    if short_mavg > long_mavg:
        # order_target orders as many shares as needed to
        # achieve the desired number of shares.
        order_target(context.asset, 100)
    elif short_mavg < long_mavg:
        order_target(context.asset, 0)

    # Save values for later inspection
    record(AAPL=data.current(context.asset, 'price'),

You can then run this algorithm using the Zipline CLI. First, you must download some sample pricing and asset data:

$ zipline ingest
$ zipline run -f --start 2014-1-1 --end 2018-1-1 -o dma.pickle --no-benchmark

This will download asset pricing data data sourced from Quandl, and stream it through the algorithm over the specified time range. Then, the resulting performance DataFrame is saved in dma.pickle, which you can load and analyze from within Python.

You can find other examples in the zipline/examples directory.


If you find a bug, feel free to open an issue and fill out the issue template.


All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. Details on how to set up a development environment can be found in our development guidelines.

If you are looking to start working with the Zipline codebase, navigate to the GitHub issues tab and start looking through interesting issues. Sometimes there are issues labeled as Beginner Friendly or Help Wanted.

Feel free to ask questions on the mailing list or on Gitter.


Please note that Zipline is not a community-led project. Zipline is maintained by the Quantopian engineering team, and we are quite small and often busy.

Because of this, we want to warn you that we may not attend to your pull request, issue, or direct mention in months, or even years. We hope you understand, and we hope that this note might help reduce any frustration or wasted time.

  • Getting benckmark data via IEX API does not work anymore

    Getting benckmark data via IEX API does not work anymore

    Zipline uses IEX API to get benchmark data in

    def get_benchmark_returns(symbol):
        Get a Series of benchmark returns from IEX associated with `symbol`.
        Default is `SPY`.
        symbol : str
            Benchmark symbol for which we're getting the returns.
        The data is provided by IEX (, and we can
        get up to 5 years worth of data.
        r = requests.get(
        data = r.json()
        df = pd.DataFrame(data)
        df.index = pd.DatetimeIndex(df['date'])
        df = df['close']
        return df.sort_index().tz_localize('UTC').pct_change(1).iloc[1:]

    However, according to the IEX FAQ page, the chart api was already removed on June 15, 2019. Currently, using this api to try to download any stock data such as SPY will return nothing but an HTTP 403 error. The functions of deprecated APIs are now transferred to their new API, IEX Cloud, which requires a unique token per user in any request. Any idea how to fix this issue in the long run?

    opened by MarikoKujo 55
  • Can't connect to Yahoo - Errors: Loader: failed to cache the new benchmark returns

    Can't connect to Yahoo - Errors: Loader: failed to cache the new benchmark returns

    Dear Zipline Maintainers,

    Before I tell you about my issue, let me describe my environment:


    • Operating System: Linux hostname 2.6.18-238.12.1.el5 #1 SMP Tue May 31 13:22:04 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
    • Python Version: Python 3.5.1
    • Python Bitness: 32
    • How did you install Zipline: pip
    • Python packages:

    alembic==0.9.1 appdirs==1.4.3 bcolz==0.12.1 Bottleneck==1.3.0.dev0 click==6.7 contextlib2==0.5.5 cyordereddict==1.0.0 Cython==0.25.2 decorator==4.0.11 empyrical==0.2.2 intervaltree==2.1.0 Logbook==1.0.0 lru-dict==1.1.6 Mako==1.0.6 MarkupSafe==1.0 multipledispatch==0.4.9 networkx==1.11 numexpr==2.6.2 numpy==1.12.1 packaging==16.8 pandas==0.18.1 pandas-datareader==0.3.0.post0 patsy==0.4.1 pyparsing==2.2.0 python-dateutil==2.6.0 python-editor==1.0.3 pytz==2017.2 requests==2.13.0 requests-file==1.4.2 requests-ftp==0.3.1 scipy==0.19.0 setuptools-scm==1.15.5 six==1.10.0 sortedcontainers==1.5.7 SQLAlchemy==1.1.9 statsmodels==0.8.0 tables==3.4.2 toolz==0.8.2 zipline==1.1.0

    Now that you know a little about me, let me tell you about the issue I am having:

    Description of Issue

    I just ran the example that described on, but got some errors, can you help to check ?

    /home/kevinyuan/dev/zipline> bin/zipline ingest Downloading Bundle: quantopian-quandl [####################################] 100% Writing data to /home/kevinyuan/.zipline/data/quantopian-quandl/2017-05-01T16;36;49.048566.

    /home/kevinyuan/dev/zipline> bin/zipline run -f examples/ -s 2000-1-1 -e 2001-12-31 [2017-05-01 16:33:28.023652] INFO: Loader: Cache at /home/kevinyuan/.zipline/data/^GSPC_benchmark.csv does not have data from 1990-01-02 00:00:00+00:00 to 2017-04-27 00:00:00+00:00. Downloading benchmark data for '^GSPC'. [2017-05-01 16:33:28.076307] ERROR: Loader: failed to cache the new benchmark returns Traceback (most recent call last): File "/share/dev/tools/lib/python3.5/urllib/", line 1240, in do_open h.request(req.get_method(), req.selector,, headers) File "/share/dev/tools/lib/python3.5/http/", line 1083, in request self.send_request(method, url, body, headers) File "/share/dev/tools/lib/python3.5/http/", line 1128, in send_request self.endheaders(body) File "/share/dev/tools/lib/python3.5/http/", line 1079, in endheaders self._send_output(message_body) File "/share/dev/tools/lib/python3.5/http/", line 911, in _sendoutput self.send(msg) File "/share/dev/tools/lib/python3.5/http/", line 854, in send self.connect() File "/share/dev/tools/lib/python3.5/http/", line 1237, in connect serverhostname=server_hostname) File "/share/dev/tools/lib/python3.5/", line 376, in wrap_socket context=self) File "/share/dev/tools/lib/python3.5/", line 747, in _init self.do_handshake() File "/share/dev/tools/lib/python3.5/", line 983, in do_handshake self.sslobj.do_handshake() File "/share/dev/tools/lib/python3.5/", line 628, in do_handshake self._sslobj.dohandshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/data/", line 247, in ensure_benchmark_data last_date, File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/data/", line 59, in get_benchmark_returns squeeze=True, # squeeze tells pandas to make this a Series File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/pandas/io/", line 562, in parser_f return read(filepath_or_buffer, kwds) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/pandas/io/", line 301, in read compression=kwds.get('compression', None)) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/pandas/io/", line 308, in get_filepath_or_buffer req = urlopen(str(filepath_or_buffer)) File "/share/dev/tools/lib/python3.5/urllib/", line 162, in urlopen return, data, timeout) File "/share/dev/tools/lib/python3.5/urllib/", line 465, in open response =, data) File "/share/dev/tools/lib/python3.5/urllib/", line 483, in _open '_open', req) File "/share/dev/tools/lib/python3.5/urllib/", line 443, in _callchain result = func(*args) File "/share/dev/tools/lib/python3.5/urllib/", line 1283, in https_open context=self.context, check_hostname=self.check_hostname) File "/share/dev/tools/lib/python3.5/urllib/", line 1242, in doopen raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATEVERIFY_FAILED] certificate verify failed (_ssl.c:645)> Traceback (most recent call last): File "/share/dev/tools/lib/python3.5/urllib/", line 1240, in doopen h.request(req.get_method(), req.selector,, headers) File "/share/dev/tools/lib/python3.5/http/", line 1083, in request self.send_request(method, url, body, headers) File "/share/dev/tools/lib/python3.5/http/", line 1128, in send_request self.endheaders(body) File "/share/dev/tools/lib/python3.5/http/", line 1079, in endheaders self._send_output(message_body) File "/share/dev/tools/lib/python3.5/http/", line 911, in _sendoutput self.send(msg) File "/share/dev/tools/lib/python3.5/http/", line 854, in send self.connect() File "/share/dev/tools/lib/python3.5/http/", line 1237, in connect serverhostname=server_hostname) File "/share/dev/tools/lib/python3.5/", line 376, in wrap_socket context=self) File "/share/dev/tools/lib/python3.5/", line 747, in _init self.do_handshake() File "/share/dev/tools/lib/python3.5/", line 983, in do_handshake self.sslobj.do_handshake() File "/share/dev/tools/lib/python3.5/", line 628, in do_handshake self._sslobj.dohandshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "bin/zipline", line 11, in sys.exit(main()) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/click/", line 722, in call return self.main(args, **kwargs) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/click/", line 697, in main rv = self.invoke(ctx) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/click/", line 1066, in invoke return process_result(sub_ctx.command.invoke(sub_ctx)) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/click/", line 895, in invoke return ctx.invoke(self.callback, *ctx.params) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/click/", line 535, in invoke return callback(args, **kwargs) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/", line 97, in _ return f(args, **kwargs) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/click/", line 17, in new_func return f(get_current_context(), *args, *kwargs) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/", line 240, in run environ=os.environ, File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/utils/", line 132, in run env = TradingEnvironment(asset_db_path=connstr) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/finance/", line 101, in init self.bm_symbol, File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/data/", line 164, in load_market_data trading_day, File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/data/", line 247, in ensure_benchmark_data last_date, File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/zipline/data/", line 59, in get_benchmark_returns squeeze=True, # squeeze tells pandas to make this a Series File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/pandas/io/", line 562, in parser_f return read(filepath_or_buffer, kwds) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/pandas/io/", line 301, in _read compression=kwds.get('compression', None)) File "/home-tahoe-n2/kevinyuan/dev/zipline/lib/python3.5/site-packages/pandas/io/", line 308, in get_filepath_or_buffer req = _urlopen(str(filepath_or_buffer)) File "/share/dev/tools/lib/python3.5/urllib/", line 162, in urlopen return, data, timeout) File "/share/dev/tools/lib/python3.5/urllib/", line 465, in open response =, data) File "/share/dev/tools/lib/python3.5/urllib/", line 483, in open '_open', req) File "/share/dev/tools/lib/python3.5/urllib/", line 443, in _callchain result = func(args) File "/share/dev/tools/lib/python3.5/urllib/", line 1283, in https_open context=self.context, check_hostname=self.check_hostname) File "/share/dev/tools/lib/python3.5/urllib/", line 1242, in doopen raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATEVERIFY_FAILED] certificate verify failed (_ssl.c:645)>

    opened by kevinyuan 55
  • Tutorial fails in python 2.7.10

    Tutorial fails in python 2.7.10

    running fails in python 2.7.10 but runs in python 3.4.3 for zipline 8.0rc. The part of code that fails is data[symbol('AAPL')] found in


    the error is

    Traceback (most recent call last):
      File "C:\python2710_64\Scripts\", line 4, in <module>
        __import__('pkg_resources').run_script('zipline==0.8.0rc1', '')
      File "C:\Python2710_64\lib\site-packages\pkg_resources\", line 729, in run_script
        self.require(requires)[0].run_script(script_name, ns)
      File "C:\Python2710_64\lib\site-packages\pkg_resources\", line 1642, in run_script
        exec(code, namespace, namespace)
      File "c:\python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\EGG-INFO\scripts\", line 23, in <module>
        run_pipeline(print_algo=True, **parsed)
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\utils\", line 246, in run_pipeline
        perf =, overwrite_sim_params=overwrite_sim_params)
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\", line 529, in run
        for perf in self.gen:
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\gens\", line 120, in transform
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\gens\", line 314, in _process_snapshot
        new_orders = self._call_handle_data()
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\gens\", line 343, in _call_handle_data
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\utils\", line 194, in handle_data
        event.handle_data(context, data, dt)
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\utils\", line 212, in handle_data
        self.callback(context, data)
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\", line 306, in handle_data
        self._handle_data(self, data)
      File "", line 26, in handle_data
      File "C:\Python2710_64\lib\site-packages\zipline-0.8.0rc1-py2.7-win-amd64.egg\zipline\", line 518, in __getitem__
        return self._data[name]
    KeyError: Equity(0, symbol='AAPL', asset_name='', exchange='', start_date=None, end_date=None, first_traded=None)

    Environment: Windows 7 64 bit, Python 3.4, Python 2.7, zipline 0.8.0rc Appears to be with zipline.protocol.BarData and zipline.assets._assets.Equity

    Kind regards

    David Bieber

    Windows 32-bit 
    opened by beebeed 45
  • Add estimates quarter loader to pipeline

    Add estimates quarter loader to pipeline

    This PR adds an estimates quarter loader to be used with Pipeline.

    Some open questions are:

    • What other tests do we need to add?
    • How do we ensure that the num_quarters attribute has been added to the dynamically generated dataset by the time load_adjusted_array is called?
    opened by mtydykov 44
  • Benchmark downloading is broken

    Benchmark downloading is broken

    Fix benchmark downloading from Google with pandas-datareader. This issue was originally brought up here.

    We now get benchmark data from Google instead of Yahoo, as seen here.

    However, it appears that as of only a week or two ago, Google changed the URL from which they are serving their financial data, causing pandas datareader to break. This is also preventing us from rebuilding the test_examples data. (For more info see the original post above).

    Data Bundle Benchmark Close on Next Release 
    opened by dmichalowicz 36
  • Create in-memory restricted list

    Create in-memory restricted list

    • Create a restricted list manager that takes in information about restricted sids and stores in memory upon instantiation
    • Create a restrictions controller that aggregates and provides restrictions information from multiple restricted list managers
    • Make this restrictions controller available to BarData so that can_trade can take into account these restrictions
    • Register each restricted list manager as a trading control using set_do_not_order_list so that we may log/fail when we try to order a restricted sid
    Ready to Merge Waiting on Downstream 
    opened by lianga888 35
  • Futures being read as Equities from env

    Futures being read as Equities from env

    code snippet:

    class TestAssetFinder(TestCase):
        def setUp(self, env=None):
            self.identifier = 'f'
            metadata={0: {'asset_type': 'future', 'symbol':
            self.asset_finder = AssetFinder(metadata=metadata)
        def test_future_metadata(self, env=None):
            asset = env.asset_finder.lookup_generic(self.identifier,
            self.assertIsInstance(asset, Future)


    AssertionError: (Equity(0, symbol='f', asset_name='', exchange='', start_date=0, end_date=Timestamp('2015-08-20 00:00:00+0000', tz='UTC'), first_traded=None), []) is not an instance of <class 'zipline.assets._assets.Future'>

    cc @jfkirk @StewartDouglas @yankees714 @dhexus

    opened by warren-oneill 30
  • ENH: Implement csvdir bundle

    ENH: Implement csvdir bundle

    This bundle is for loading historical price data from the set of .csv files. It supports daily and minute time frames.

    opened by bartosh 30
  • Error retrieving H15 interest rates - ValueError: 'Time Period' is not in list

    Error retrieving H15 interest rates - ValueError: 'Time Period' is not in list

    Dear Zipline Maintainers,


    • Operating System: Linux 3d62a3c1924c 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
    • Python Version: Python 3.5.2 :: Anaconda 4.3.0 (64-bit)
    • Python Bitness: 64
    • How did you install Zipline: pip
    • Python packages:

    Error retrieving H15 interest rates - ValueError: 'Time Period' is not in list

    • If I try to instantiate a TradingEnvironment, I get a ValueError. The code worked until yesterday and stopped some hours ago. I'm not sure whether on Th or Fr (CEST).
    ValueError                                Traceback (most recent call last)
    env = TradingEnvironment(bm_symbol=self.benchmark, exchange_tz=self.exchange_tz,
    --> 539                                  trading_calendar=cal)
    /opt/conda/envs/develop/lib/python3.5/site-packages/zipline/finance/ in __init__(self, load, bm_symbol, exchange_tz, trading_calendar, asset_db_path)
         94   ,
         95             trading_calendar.schedule.index,
    ---> 96             self.bm_symbol,
         97         )
    /opt/conda/envs/develop/lib/python3.5/site-packages/zipline/data/ in load_market_data(trading_day, trading_days, bm_symbol)
        169         first_date,
        170         last_date,
    --> 171         now,
        172     )
        173     benchmark_returns = br[br.index.slice_indexer(first_date, last_date)]
    /opt/conda/envs/develop/lib/python3.5/site-packages/zipline/data/ in ensure_treasury_data(bm_symbol, first_date, last_date, now)
        318     try:
    --> 319         data = loader_module.get_treasury_data(first_date, last_date)
        320         data.to_csv(path)
        321     except (OSError, IOError, HTTPError):
    /opt/conda/envs/develop/lib/python3.5/site-packages/zipline/data/ in get_treasury_data(start_date, end_date)
         74         parse_dates=['Time Period'],
         75         na_values=['ND'],  # Presumably this stands for "No Data".
    ---> 76         index_col=0,
         77     ).loc[
         78         start_date:end_date
    /opt/conda/envs/develop/lib/python3.5/site-packages/pandas/io/ in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skipfooter, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision)
        644                     skip_blank_lines=skip_blank_lines)
    --> 646         return _read(filepath_or_buffer, kwds)
        648     parser_f.__name__ = name
    /opt/conda/envs/develop/lib/python3.5/site-packages/pandas/io/ in _read(filepath_or_buffer, kwds)
        388     # Create the parser.
    --> 389     parser = TextFileReader(filepath_or_buffer, **kwds)
        391     if (nrows is not None) and (chunksize is not None):
    /opt/conda/envs/develop/lib/python3.5/site-packages/pandas/io/ in __init__(self, f, engine, **kwds)
        728             self.options['has_index_names'] = kwds['has_index_names']
    --> 730         self._make_engine(self.engine)
        732     def close(self):
    /opt/conda/envs/develop/lib/python3.5/site-packages/pandas/io/ in _make_engine(self, engine)
        921     def _make_engine(self, engine='c'):
        922         if engine == 'c':
    --> 923             self._engine = CParserWrapper(self.f, **self.options)
        924         else:
        925             if engine == 'python':
    /opt/conda/envs/develop/lib/python3.5/site-packages/pandas/io/ in __init__(self, src, **kwds)
       1434                 raise ValueError("Usecols do not match names.")
    -> 1436         self._set_noconvert_columns()
       1438         self.orig_names = self.names
    /opt/conda/envs/develop/lib/python3.5/site-packages/pandas/io/ in _set_noconvert_columns(self)
       1484                         _set(k)
       1485                 else:
    -> 1486                     _set(val)
       1488         elif isinstance(self.parse_dates, dict):
    /opt/conda/envs/develop/lib/python3.5/site-packages/pandas/io/ in _set(x)
       1475             if not is_integer(x):
    -> 1476                 x = names.index(x)
       1478             self._reader.set_noconvert(x)
    ValueError: 'Time Period' is not in list

    What steps have you taken to resolve this already?

    • If I run the corresponding code manually, I get the same error.
    df = pd.read_csv(
            "&from="  # An unbounded query is ~2x faster than specifying dates.
            skiprows=1,  # First row is a useless header.
            parse_dates=['Time Period'],
            na_values=['ND'],  # Presumably this stands for "No Data".
    • The request to the hard encoded link (to obtain the H15 interest rates) fails: "Unable to find the output file. Please contact administrator for assistance."

    • I played around with the Data Download Program and compared the parameters of the generated request strings.

    • It seems as if label=omit is not accepted anymore. If I omit the label parameter or set it to include, it seems to work.

    • I am curious if I am the only one having this problem. If not, how can we fix this problem permanently?



    opened by rudolf-bauer 30
  • most examples don't work outside quantopian env

    most examples don't work outside quantopian env

    Hi guys,

    Please update because doesn't exist, its This strategy work perfectly in quantopian environment but not with zipline CLI. I suspect the path to be broken (see details at the end).

    The only example that works or don't crash is buyapple. -> ImportError: No module named talib> ValueError: You must define a handle_data function.> AttributeError: 'TradingAlgorithm' object has no attribute 'symbol'> ValueError: You must define a handle_data function.



    zipline.version Out[39]: '0.7.0'

    python scripts/ -f zipline/examples/ --symbols AAPL --start 2011-1-1 --end 2012-1-1 -o dma.pickle ... [2015-07-30 04:14:04.415502] WARNING: Loader: No benchmark data found for date range. start_date=2015-07-30 00:00:00+00:00, end_date=2015-07-30 04:14:04.295081, url= [2015-07-30 04:14:24.025207] INFO: Performance: Simulated 252 trading days out of 252. [2015-07-30 04:14:24.025510] INFO: Performance: first open: 2011-01-03 14:31:00+00:00 [2015-07-30 04:14:24.025611] INFO: Performance: last close: 2011-12-30 21:00:00+00:00 Traceback (most recent call last): ... File "scripts/", line 25, in File "pandas/hashtable.pyx", line 694, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12231) KeyError: 'AAPL'

    Bug Documentation 
    opened by fraka6 29
  • Documentation not available (link not working)

    Documentation not available (link not working)

    Dear Zipline Maintainers,

    Before I tell you about my issue, let me describe my environment:

    Documentation Link not available.


    Sincerely, $ whoami

    opened by sidaritech 0
  • STOXX 600 Equity Bundle help

    STOXX 600 Equity Bundle help

    Hi there,

    This is my first ever issue on GitHub so really sorry if my question is unclear or not in the appropriate format.

    I am currently trying to build an equity bundle filled with the STOXX 600. Given this is a basket of European stocks, they all trade on different exchanges throughout Europe with different trading holidays and opening hours.

    It appears to me that Zipline is very much geared towards equity bundles which contain stocks that all trade on the exact same exchange. Does anyone know how I might be able to ingest a bundle that does not follow only one trading calendar, but multiple?

    What I have done so far:

    I have followed the guide located here:

    and with this guide, I have been able to utilize BColzDailyBarWriter() to write the stocks into a BColz format. In the below code, I am looping through my asset_metadata table, which contains information on each stock (i.e its associated exchange code like "XLON", its trading start date and trading end date, etc...), and then setting the calendar argument via the get_calendar() function.

    for asset_sid, row in assets_metadata.iterrows():
        daily_bar_writer = BcolzDailyBarWriter(
            calendar=get_calendar(row['exchange']),  # Would love to default to LSE for everything
            start_session=pd.Timestamp("2010-01-04", tz='UTC'),
            end_session=pd.Timestamp("2021-07-29", tz='UTC'),
            data = parse_pricing_and_vol(

    But when I get to the register() step, the function is forcing me to select a single calendar (via the register() argument, calendar_name) and so I am a bit stumped because all my stocks must then follow the trading days of that one calendar. Should I write a new register() function for every exchange and its associated stocks?

    from import register, sxxp_bundle
    register('sxxp_bundle', sxxp_bundle.ingest, calendar_name='????')

    Any help on this issue would be a huge godsend! Thank you all.

    opened by r54885ab 0
  • The data is OHCL and other indicator exported out as CSV from Other platform

    The data is OHCL and other indicator exported out as CSV from Other platform

    Dear Zipline Maintainers,

    Before I tell you about my issue, let me describe my environment:


    • Operating System: (Ubuntu)
    • Python Version: 2.7.x
    • How did you install Zipline: pip

    Now that you know a little about me, let me tell you about the issue I am having:

    Description of Issue

    • What did you expect to happen?
    • What happened instead?

    Here is how you can reproduce this issue on your machine:

    Reproduction Steps

    data = read_csv(data_file)
    data['time'] = None
    for i in data.index:
        data['time'][i] = datetime.strptime(data['Date'][i] + " " + data['Time'][i] + ":00", '%m-%d-%Y %H:%M:%S')
    data.index = data['time']
    del data['time']
    data.index = tseries.index.DatetimeIndex(data=data.index).tz_localize('US/Eastern')

    This is using a local copy of zipline instead of the site-packages one.

    The data is OHCL and other indicator exported out as CSV from Other platform. The timestamps are then munged to be the index similar to fast-data-mining-with-pytables-and-pandas.pdf and also localized. At this point the basic test does work using the local copy of zipline which was check.

    Exception: no rate for end date = 2021-07-28 00:00:00-04:00 and term = 1month. Check that date doesn't exceed treasury history range.


    I'd post this on the zipline Google group but it isn't open for business just yet.


    Anything else?


    Sincerely, Fintechee

    opened by fintechee 0
  • Website ( down?

    Website ( down?

    Dear Zipline Maintainers,

    Before I tell you about my issue, let me describe my environment:


    • Operating System: (Windows Version or $ uname --all)
    • Python Version: $ python --version
    • Python Bitness: $ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
    • How did you install Zipline: (pip, conda, or other (please explain))
    • Python packages: $ pip freeze or $ conda list

    Now that you know a little about me, let me tell you about the issue I am having:

    Description of Issue

    • What did you expect to happen?
    • What happened instead?

    Here is how you can reproduce this issue on your machine:

    Reproduction Steps


    What steps have you taken to resolve this already?


    Anything else?


    Sincerely, $ whoami

    opened by GF-Huang 3
  • ValueError: Unable to determine domain for Pipeline

    ValueError: Unable to determine domain for Pipeline


    • Operating System: Linux Ubuntu-1604-xenial-64-minimal 4.15.0-142-generic #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
    • Python Version: 3.8.8
    • Python Bitness: 64
    • How did you install Zipline: conda
    • Python packages:
    _libgcc_mutex             0.1                 conda_forge    conda-forge
    _openmp_mutex             4.5                      1_llvm    conda-forge
    _py-xgboost-mutex         2.0                       cpu_0    conda-forge
    _sysroot_linux-64_curr_repodata_hack 3                   ha9d2b57_10    conda-forge
    _tflow_select             2.3.0                       mkl  
    abseil-cpp                20210324.0           h9c3ff4c_0    conda-forge
    absl-py                   0.12.0             pyhd8ed1ab_0    conda-forge
    aiohttp                   3.7.4            py38h497a2fe_0    conda-forge
    alembic                   1.5.8              pyhd8ed1ab_0    conda-forge
    alphalens-reloaded        0.4.1.post1              py38_0    ml4t
    alsa-lib                  1.2.3                h516909a_0    conda-forge
    anyio                     2.2.0            py38h578d9bd_0    conda-forge
    appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
    arch                      4.19                     pypi_0    pypi
    argon2-cffi               20.1.0           py38h497a2fe_2    conda-forge
    arrow-cpp                 3.0.0           py38hd6878d3_11_cpu    conda-forge
    arviz                     0.11.2             pyhd8ed1ab_1    conda-forge
    astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
    async-timeout             3.0.1                   py_1000    conda-forge
    async_generator           1.10                       py_0    conda-forge
    atk-1.0                   2.36.0               h3371d22_4    conda-forge
    attrs                     20.3.0             pyhd3deb0d_0    conda-forge
    automat                   20.2.0                     py_0    conda-forge
    autopep8                  1.5.7                    pypi_0    pypi
    aws-c-cal                 0.4.5                h76129ab_8    conda-forge
    aws-c-common              0.5.2                h7f98852_0    conda-forge
    aws-c-event-stream        0.2.7                h6bac3ce_1    conda-forge
    aws-c-io                  0.9.1                ha5b09cb_1    conda-forge
    aws-checksums             0.1.11               h99e32c3_3    conda-forge
    aws-sdk-cpp               1.8.151              hceb1b1e_1    conda-forge
    babel                     2.9.1                    pypi_0    pypi
    backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
    backports                 1.0                        py_2    conda-forge
    backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
    backtrader                     pypi_0    pypi
    bcolz-zipline             1.2.3.post2              pypi_0    pypi
    bcrypt                    3.2.0            py38h497a2fe_1    conda-forge
    beautifulsoup4            4.9.3              pyhb0f4dca_0    conda-forge
    binutils                  2.35.1               hdd6e379_2    conda-forge
    binutils_impl_linux-64    2.35.1               h193b22a_2    conda-forge
    binutils_linux-64         2.35                h67ddf6f_30    conda-forge
    bleach                    3.3.0              pyh44b312d_0    conda-forge
    blinker                   1.4                        py_1    conda-forge
    blosc                     1.21.0               h9c3ff4c_0    conda-forge
    bokeh                     2.3.1            py38h578d9bd_0    conda-forge
    boto                      2.49.0                     py_0    conda-forge
    boto3                     1.17.57            pyhd8ed1ab_0    conda-forge
    botocore                  1.20.57            pyhd8ed1ab_0    conda-forge
    bottleneck                1.3.2            py38h5c078b8_3    conda-forge
    box2d                     2.3.10                   pypi_0    pypi
    box2d-py                  2.3.8            py38h709712a_3    conda-forge
    bqplot                    0.12.26            pyhd8ed1ab_0    conda-forge
    brotli                    1.0.9                h9c3ff4c_4    conda-forge
    brotlipy                  0.7.0           py38h497a2fe_1001    conda-forge
    brunsli                   0.1                  he1b5a44_0    conda-forge
    bz2file                   0.98                       py_0    conda-forge
    bzip2                     1.0.8                h7f98852_4    conda-forge
    c-ares                    1.17.1               h7f98852_1    conda-forge
    c-compiler                1.2.0                h7f98852_0    conda-forge
    ca-certificates           2021.5.30            ha878542_0    conda-forge
    cachetools                4.2.2                    pypi_0    pypi
    cairo                     1.16.0            h6cf1ce9_1008    conda-forge
    catalogue                 2.0.4                    pypi_0    pypi
    catboost                  0.25.1           py38h578d9bd_0    conda-forge
    certifi                   2020.12.5                pypi_0    pypi
    cffi                      1.14.5           py38ha65f79e_0    conda-forge
    cftime                    1.4.1            py38h5c078b8_0    conda-forge
    chardet                   4.0.0            py38h578d9bd_1    conda-forge
    charls                    2.2.0                h9c3ff4c_0    conda-forge
    click                     7.1.2              pyh9f0ad1d_0    conda-forge
    cloudpickle               1.6.0                      py_0    conda-forge
    colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
    colorlover                0.3.0                      py_0    conda-forge
    conda                     4.10.1           py38h578d9bd_0    conda-forge
    conda-package-handling    1.7.3            py38h497a2fe_0    conda-forge
    constantly                15.1.0                     py_0    conda-forge
    cryptography              3.4.7            py38ha5dfef3_0    conda-forge
    cssselect                 1.1.0                      py_0    conda-forge
    cudatoolkit               10.2.89              hfd86e86_1    anaconda
    cudnn                        h469e712_0    conda-forge
    curl                      7.76.1               h979ede3_1    conda-forge
    cvxpy                     1.1.12           py38h578d9bd_0    conda-forge
    cvxpy-base                1.1.12           py38h1abd341_0    conda-forge
    cxx-compiler              1.2.0                h4bd325d_0    conda-forge
    cycler                    0.10.0                     py_2    conda-forge
    cymem                     2.0.5            py38h709712a_1    conda-forge
    cypari                    2.4.1                    pypi_0    pypi
    cython                    0.29.23          py38h709712a_1    conda-forge
    cython-blis               0.7.4            py38h5c078b8_0    conda-forge
    cytoolz                   0.11.0           py38h497a2fe_3    conda-forge
    dask-core                 2021.4.1           pyhd8ed1ab_0    conda-forge
    dataclasses               0.8                pyhc8e2a94_1    conda-forge
    dbus                      1.13.18              hb2f20db_0  
    decorator                 4.4.2                      py_0    conda-forge
    defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
    deprecation               2.1.0              pyh9f0ad1d_0    conda-forge
    dill                      0.3.3              pyhd8ed1ab_0    conda-forge
    ecos                      2.0.7.post1              pypi_0    pypi
    empyrical                 0.5.5              pyh9f0ad1d_0    conda-forge
    empyrical-reloaded        0.5.7                    py38_0    ml4t
    entrypoints               0.3             py38h32f6830_1002    conda-forge
    expat                     2.3.0                h9c3ff4c_0    conda-forge
    fastprogress              1.0.0              pyh39e3cac_0    fastai
    ffmpeg                    1.4                      pypi_0    pypi
    filelock                  3.0.12             pyh9f0ad1d_0    conda-forge
    font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
    font-ttf-inconsolata      2.001                hab24e00_0    conda-forge
    font-ttf-source-code-pro  2.030                hab24e00_0    conda-forge
    font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
    fontconfig                2.13.1            hba837de_1005    conda-forge
    fonts-conda-ecosystem     1                             0    conda-forge
    fonts-conda-forge         1                             0    conda-forge
    freetype                  2.10.4               h0708190_1    conda-forge
    fribidi                   1.0.10               h516909a_0    conda-forge
    fsspec                    2021.4.0           pyhd8ed1ab_0    conda-forge
    funcy                     1.15               pyh9f0ad1d_0    conda-forge
    future                    0.18.2           py38h578d9bd_3    conda-forge
    fxrays                    1.3.5                    pypi_0    pypi
    gast                      0.3.3                    pypi_0    pypi
    gcc_impl_linux-64         9.3.0               h70c0ae5_19    conda-forge
    gcc_linux-64              9.3.0               hf25ea35_30    conda-forge
    gdk-pixbuf                2.42.6               h04a7f16_0    conda-forge
    gensim                    4.0.1            py38h709712a_0    conda-forge
    gettext                   0.21.0               hf68c758_0  
    gflags                    2.2.2             he1b5a44_1004    conda-forge
    giflib                    5.2.1                h516909a_2    conda-forge
    glib                      2.68.1               h9c3ff4c_0    conda-forge
    glib-tools                2.68.1               h9c3ff4c_0    conda-forge
    glog                      0.4.0                h49b9bf7_3    conda-forge
    gmp                       6.2.1                h58526e2_0    conda-forge
    gmpy2                     2.1.0b1          py38hd744826_1    conda-forge
    gnutls                    3.6.15               he1e5248_0  
    google-api-core           1.26.2             pyhd8ed1ab_0    conda-forge
    google-auth               1.30.0                   pypi_0    pypi
    google-auth-oauthlib      0.4.4                    pypi_0    pypi
    google-cloud-core         1.6.0              pyh44b312d_0    conda-forge
    google-cloud-storage      1.31.2             pyh9f0ad1d_0    conda-forge
    google-crc32c             1.1.2            py38h8838a9a_0    conda-forge
    google-pasta              0.2.0              pyh8c360ce_0    conda-forge
    google-resumable-media    1.2.0              pyhd3deb0d_0    conda-forge
    googleapis-common-protos  1.53.0           py38h578d9bd_0    conda-forge
    graphite2                 1.3.14               h23475e2_0  
    graphviz                  2.47.1               hebd9034_0    conda-forge
    greenlet                  1.0.0            py38h709712a_0    conda-forge
    grpc-cpp                  1.37.0               h36de60a_1    conda-forge
    grpcio                    1.37.1                   pypi_0    pypi
    gst-plugins-base          1.18.4               hf529b03_2    conda-forge
    gstreamer                 1.18.4               h76c114f_2    conda-forge
    gtk2                      2.24.33              hab0c2f8_0    conda-forge
    gts                       0.7.6                h64030ff_2    conda-forge
    gxx_impl_linux-64         9.3.0               hd87eabc_19    conda-forge
    gxx_linux-64              9.3.0               h3fbe746_30    conda-forge
    gym                       0.18.0           py38hd0cf306_1    conda-forge
    gym-box2d                 0.18.0           py38h578d9bd_1    conda-forge
    h2                        3.2.0            py38h32f6830_1    conda-forge
    h5py                      2.10.0          nompi_py38h9915d05_106    conda-forge
    harfbuzz                  2.8.0                h83ec7ef_1    conda-forge
    hdbscan                   0.8.27           py38h5c078b8_0    conda-forge
    hdf4                      4.2.13            h10796ff_1005    conda-forge
    hdf5                      1.10.6          nompi_h6a2412b_1114    conda-forge
    hpack                     3.0.0                      py_0    conda-forge
    html5lib                  1.1                pyh9f0ad1d_0    conda-forge
    hyperframe                5.2.0                      py_0    conda-forge
    hyperlink                 21.0.0             pyhd3deb0d_0    conda-forge
    icu                       68.1                 h58526e2_0    conda-forge
    idna                      2.10               pyh9f0ad1d_0    conda-forge
    imagecodecs               2021.3.31        py38h1455ab2_0    conda-forge
    imageio                   2.9.0                      py_0    conda-forge
    importlib-metadata        4.0.1            py38h578d9bd_0    conda-forge
    importlib-resources       5.1.2                    pypi_0    pypi
    importlib_metadata        4.0.1                hd8ed1ab_0    conda-forge
    incremental               21.3.0                   pypi_0    pypi
    inflection                0.5.1              pyh9f0ad1d_0    conda-forge
    intervaltree              3.1.0                      py_0  
    ipydatawidgets            4.2.0              pyhd3deb0d_0    conda-forge
    ipykernel                 5.5.3            py38hd0cf306_0    conda-forge
    ipython                   7.23.0                   pypi_0    pypi
    ipython_genutils          0.2.0                      py_1    conda-forge
    ipyvolume                 0.5.2                    pypi_0    pypi
    ipywebrtc                 0.6.0              pyhd8ed1ab_0    conda-forge
    ipywidgets                7.6.3              pyhd3deb0d_0    conda-forge
    iso3166                   1.0.1              pyh9f0ad1d_0    conda-forge
    iso4217                   1.6.20180829               py_0    conda-forge
    itemadapter               0.2.0              pyhd8ed1ab_0    conda-forge
    itemloaders               1.0.4              pyhd8ed1ab_0    conda-forge
    jax                       0.2.12             pyhd8ed1ab_0    conda-forge
    jaxlib                    0.1.65           py38h578d9bd_0    conda-forge
    jedi                      0.18.0           py38h578d9bd_2    conda-forge
    jellyfish                 0.8.2            py38h497a2fe_1    conda-forge
    jinja2                    2.11.3             pyh44b312d_0    conda-forge
    jmespath                  0.10.0             pyh9f0ad1d_0    conda-forge
    joblib                    1.0.1              pyhd8ed1ab_0    conda-forge
    jpeg                      9d                   h516909a_0    conda-forge
    json5                     0.9.5              pyh9f0ad1d_0    conda-forge
    jsonschema                3.2.0            py38h32f6830_1    conda-forge
    jupyter                   1.0.0            py38h578d9bd_6    conda-forge
    jupyter-packaging         0.9.2              pyhd8ed1ab_0    conda-forge
    jupyter_client            6.1.12             pyhd8ed1ab_0    conda-forge
    jupyter_console           6.4.0              pyhd8ed1ab_0    conda-forge
    jupyter_contrib_core      0.3.3                      py_2    conda-forge
    jupyter_contrib_nbextensions 0.5.1            py38h32f6830_1    conda-forge
    jupyter_core              4.7.1            py38h578d9bd_0    conda-forge
    jupyter_highlight_selected_word 0.2.0           py38h578d9bd_1002    conda-forge
    jupyter_latex_envs        1.4.6           py38h578d9bd_1001    conda-forge
    jupyter_nbextensions_configurator 0.4.1            py38h578d9bd_2    conda-forge
    jupyter_server            1.6.4            py38h578d9bd_0    conda-forge
    jupyterlab                3.0.14             pyhd8ed1ab_0    conda-forge
    jupyterlab-server         2.5.0                    pypi_0    pypi
    jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
    jupyterlab_widgets        1.0.0              pyhd8ed1ab_1    conda-forge
    jxrlib                    1.1                  h516909a_2    conda-forge
    keras-preprocessing       1.1.2              pyhd8ed1ab_0    conda-forge
    kernel-headers_linux-64   3.10.0              h77966d4_10    conda-forge
    kiwisolver                1.3.1            py38h1fd1430_1    conda-forge
    knot-floer-homology       1.0.2                    pypi_0    pypi
    krb5                      1.17.2               h926e7f8_0    conda-forge
    lame                      3.100             h14c3975_1001    conda-forge
    lcms2                     2.12                 hddcbb42_0    conda-forge
    ld_impl_linux-64          2.35.1               hea4e1c9_2    conda-forge
    lerc                      2.2.1                h9c3ff4c_0    conda-forge
    libaec                    1.0.4                he1b5a44_1    conda-forge
    libblas                   3.9.0                     8_mkl    conda-forge
    libcblas                  3.9.0                     8_mkl    conda-forge
    libclang                  11.1.0          default_ha53f305_1    conda-forge
    libcrc32c                 1.1.1                he1b5a44_2    conda-forge
    libcurl                   7.76.1               hc4aaa36_1    conda-forge
    libdeflate                1.7                  h7f98852_5    conda-forge
    libedit                   3.1.20210216         h27cfd23_1  
    libev                     4.33                 h516909a_1    conda-forge
    libevent                  2.1.10               hcdb4288_3    conda-forge
    libffi                    3.3                  h58526e2_2    conda-forge
    libgcc-devel_linux-64     9.3.0               h7864c58_19    conda-forge
    libgcc-ng                 9.3.0               h2828fa1_19    conda-forge
    libgd                     2.3.2                h78a0170_0    conda-forge
    libgfortran-ng            9.3.0               hff62375_19    conda-forge
    libgfortran5              9.3.0               hff62375_19    conda-forge
    libglib                   2.68.1               h3e27bee_0    conda-forge
    libgomp                   9.3.0               h2828fa1_19    conda-forge
    libgpuarray               0.7.6             h14c3975_1003    conda-forge
    libiconv                  1.16                 h516909a_0    conda-forge
    libidn2                   2.3.0                h516909a_0    conda-forge
    liblapack                 3.9.0                     8_mkl    conda-forge
    libllvm10                 10.0.1               he513fc3_3    conda-forge
    libllvm11                 11.1.0               hf817b99_2    conda-forge
    libnetcdf                 4.8.0           nompi_hfa85936_101    conda-forge
    libnghttp2                1.43.0               h812cca2_0    conda-forge
    libogg                    1.3.5                h27cfd23_1  
    libopus                   1.3.1                h7f98852_1    conda-forge
    libpng                    1.6.37               hed695b0_2    conda-forge
    libpq                     13.2                 hfd2b0eb_2    conda-forge
    libprotobuf               3.15.8               h780b84a_0    conda-forge
    librsvg                   2.50.3               hfa39831_1    conda-forge
    libsodium                 1.0.18               h516909a_1    conda-forge
    libssh2                   1.9.0                ha56f1ee_6    conda-forge
    libstdcxx-devel_linux-64  9.3.0               hb016644_19    conda-forge
    libstdcxx-ng              9.3.0               h6de172a_19    conda-forge
    libtasn1                  4.16.0               h27cfd23_0  
    libthrift                 0.14.1               he6d91bd_2    conda-forge
    libtiff                   4.2.0                hbd63e13_2    conda-forge
    libtool                   2.4.6             h58526e2_1007    conda-forge
    libunistring              0.9.10               h14c3975_0    conda-forge
    libutf8proc               2.6.1                h7f98852_0    conda-forge
    libuuid                   2.32.1            h14c3975_1000    conda-forge
    libvorbis                 1.3.7                he1b5a44_0    conda-forge
    libwebp                   1.2.0                h3452ae3_0    conda-forge
    libwebp-base              1.2.0                h7f98852_2    conda-forge
    libxcb                    1.14                 h7b6447c_0  
    libxgboost                1.3.3                h9c3ff4c_2    conda-forge
    libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
    libxml2                   2.9.10               h72842e0_4    conda-forge
    libxslt                   1.1.33               h15afd5d_2    conda-forge
    libzip                    1.7.3                he9f05b3_0    conda-forge
    libzopfli                 1.0.3                he1b5a44_0    conda-forge
    lightgbm                  3.2.1            py38h709712a_0    conda-forge
    linearmodels              4.24             py38h709712a_1    conda-forge
    livelossplot              0.5.4                    pypi_0    pypi
    llvm-openmp               11.1.0               h4bd325d_1    conda-forge
    llvmlite                  0.36.0           py38h4630a5e_0    conda-forge
    locket                    0.2.1            py38h06a4308_1  
    logbook                   1.5.3                    py38_0    ml4t
    lru-dict                  1.1.7                    pypi_0    pypi
    lxml                      4.6.3            py38hf1fe3a4_0    conda-forge
    lz4-c                     1.9.3                h9c3ff4c_0    conda-forge
    lzo                       2.10              h516909a_1000    conda-forge
    magma                     2.5.4                h5da55e3_2    conda-forge
    mako                      1.1.4              pyh44b312d_0    conda-forge
    markdown                  3.3.4              pyhd8ed1ab_0    conda-forge
    markupsafe                1.1.1            py38h497a2fe_3    conda-forge
    matplotlib                3.4.1            py38h578d9bd_0    conda-forge
    matplotlib-base           3.4.1            py38hcc49a3a_0    conda-forge
    matplotlib-inline         0.1.2                    pypi_0    pypi
    mistune                   0.8.4           py38h497a2fe_1003    conda-forge
    mkl                       2020.4             h726a3e6_304    conda-forge
    mkl-service               2.3.0            py38h1e0a361_2    conda-forge
    mock                      4.0.3            py38h578d9bd_1    conda-forge
    more-itertools            8.7.0              pyhd8ed1ab_1    conda-forge
    mpc                       1.1.0             h04dde30_1009    conda-forge
    mpfr                      4.0.2                he80fd80_1    conda-forge
    mplfinance                0.12.7a17          pyhd8ed1ab_0    conda-forge
    mpmath                    1.2.1              pyhd8ed1ab_0    conda-forge
    multidict                 5.1.0            py38h497a2fe_1    conda-forge
    multipledispatch          0.6.0                      py_0    conda-forge
    multitasking              0.0.9                      py_0    ranaroussi
    murmurhash                1.0.5            py38h709712a_0    conda-forge
    mypy_extensions           0.4.3            py38h578d9bd_3    conda-forge
    mysql-common              8.0.23               ha770c72_2    conda-forge
    mysql-libs                8.0.23               h935591d_2    conda-forge
    nb_conda                  2.2.1            py38h578d9bd_4    conda-forge
    nb_conda_kernels          2.3.1            py38h578d9bd_0    conda-forge
    nbclassic                 0.2.7              pyhd8ed1ab_0    conda-forge
    nbclient                  0.5.3              pyhd8ed1ab_0    conda-forge
    nbconvert                 5.6.1                    pypi_0    pypi
    nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
    nccl                          h1a5f58c_0    conda-forge
    ncurses                   6.2                  h58526e2_4    conda-forge
    nest-asyncio              1.5.1              pyhd8ed1ab_0    conda-forge
    netcdf4                   1.5.6           nompi_py38h5e9db54_103    conda-forge
    nettle                    3.7.2                hbbd107a_1  
    networkx                  2.5.1              pyhd8ed1ab_0    conda-forge
    ninja                     1.10.2               h4bd325d_0    conda-forge
    nltk                      3.6.2              pyhd8ed1ab_0    conda-forge
    notebook                  6.3.0            py38h578d9bd_0    conda-forge
    nspr                      4.30                 h9c3ff4c_0    conda-forge
    nss                       3.64                 hb5efdd6_0    conda-forge
    numba                     0.53.1           py38h8b71fd7_1    conda-forge
    numexpr                   2.7.3            py38h51da96c_0    conda-forge
    numpy                     1.20.2           py38h9894fe3_0    conda-forge
    oauthlib                  3.1.0              pyhd8ed1ab_0    conda-forge
    olefile                   0.46               pyh9f0ad1d_1    conda-forge
    opencv-python                    pypi_0    pypi
    opencv-python-headless                 py38_0    fastai
    openh264                  2.1.1                h780b84a_0    conda-forge
    openjpeg                  2.4.0                hb52868f_1    conda-forge
    openssl                   1.1.1k               h7f98852_0    conda-forge
    opt_einsum                3.3.0              pyhd8ed1ab_1    conda-forge
    orc                       1.6.7                heec2584_1    conda-forge
    osqp                      0.6.2.post0              pypi_0    pypi
    packaging                 20.9               pyh44b312d_0    conda-forge
    pandas                    1.2.4            py38h1abd341_0    conda-forge
    pandas-datareader         0.9.0              pyh44b312d_0    conda-forge
    pandoc                    2.12                 h7f98852_0    conda-forge
    pandocfilters             1.4.3            py38h06a4308_1  
    pango                     1.42.4               h80147aa_5    conda-forge
    parquet-cpp               1.5.1                         1    conda-forge
    parsel                    1.6.0                      py_0    conda-forge
    parso                     0.8.2              pyhd8ed1ab_0    conda-forge
    partd                     1.2.0              pyhd8ed1ab_0    conda-forge
    pathy                     0.5.2              pyhd8ed1ab_0    conda-forge
    patsy                     0.5.1                      py_0    conda-forge
    pcre                      8.44                 he1b5a44_0    conda-forge
    pexpect                   4.8.0            py38h32f6830_1    conda-forge
    pickleshare               0.7.5           py38h32f6830_1002    conda-forge
    pillow                    7.2.0                    pypi_0    pypi
    pip                       21.1               pyhd8ed1ab_0    conda-forge
    pixman                    0.40.0               h36c2ea0_0    conda-forge
    plink                     2.4                      pypi_0    pypi
    plotly                    4.14.3             pyh44b312d_0    conda-forge
    pooch                     1.3.0              pyhd8ed1ab_0    conda-forge
    preshed                   3.0.5            py38h709712a_0    conda-forge
    priority                  1.3.0                      py_0    conda-forge
    prometheus_client         0.10.1             pyhd8ed1ab_0    conda-forge
    promise                   2.3              py38h578d9bd_3    conda-forge
    prompt-toolkit            3.0.18             pyha770c72_0    conda-forge
    prompt_toolkit            3.0.18               hd8ed1ab_0    conda-forge
    property-cached           1.6.4                      py_0    conda-forge
    property_cached           1.6.4                         0    conda-forge
    protego                   0.1.16                     py_0    conda-forge
    protobuf                  3.15.8           py38h709712a_0    conda-forge
    ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
    pyarrow                   4.0.0                    pypi_0    pypi
    pyasn1                    0.4.8                      py_0    conda-forge
    pyasn1-modules            0.2.8                      py_0  
    pycodestyle               2.7.0              pyhd8ed1ab_0    conda-forge
    pycosat                   0.6.3           py38h497a2fe_1006    conda-forge
    pycparser                 2.20               pyh9f0ad1d_2    conda-forge
    pydantic                  1.7.3            py38h497a2fe_1    conda-forge
    pydispatcher              2.0.5                      py_1    conda-forge
    pydot                     1.4.2            py38h578d9bd_0    conda-forge
    pyfolio-reloaded          0.9.3                    py38_0    ml4t
    pyglet                    1.5.0                    pypi_0    pypi
    pygments                  2.8.1              pyhd8ed1ab_0    conda-forge
    pygpu                     0.7.6           py38hab2c0dc_1002    conda-forge
    pyhamcrest                2.0.2                      py_0    conda-forge
    pyhdfe                    0.1.0                    pypi_0    pypi
    pyjwt                     2.0.1              pyhd8ed1ab_1    conda-forge
    pykalman                  0.9.5                      py_1    conda-forge
    pyldavis                  3.3.1              pyhd8ed1ab_0    conda-forge
    pymc3                     3.11.2           py38h83c9d95_3    conda-forge
    pymdptoolbox              4.0b3                    pypi_0    pypi
    pynndescent               0.5.2              pyh44b312d_0    conda-forge
    pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
    pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
    pyphen                    0.10.0             pyhd8ed1ab_0    conda-forge
    pypng                     0.0.20                   pypi_0    pypi
    pyportfolioopt            1.4.1                    pypi_0    pypi
    pyqt                      5.12.3           py38h578d9bd_7    conda-forge
    pyqt5                     5.15.4                   pypi_0    pypi
    pyqt5-qt5                 5.15.2                   pypi_0    pypi
    pyqt5-sip                 12.8.1                   pypi_0    pypi
    pyqtchart                 5.15.4                   pypi_0    pypi
    pyqtchart-qt5             5.15.2                   pypi_0    pypi
    pyqtwebengine             5.12.1           py38h7400c14_7    conda-forge
    pyrsistent                0.17.3           py38h497a2fe_2    conda-forge
    pysocks                   1.7.1            py38h578d9bd_3    conda-forge
    pytables                  3.6.1            py38hf9f05d5_3    conda-forge
    python                    3.8.8           hffdb5ce_0_cpython    conda-forge
    python-dateutil           2.8.1                      py_0    conda-forge
    python-editor             1.0.4                      py_0    conda-forge
    python-flatbuffers        1.12               pyhd8ed1ab_1    conda-forge
    python-graphviz           0.16               pyh243d235_2    conda-forge
    python-interface          1.6.1                    pypi_0    pypi
    python-snappy             0.6.0                    pypi_0    pypi
    python_abi                3.8                      1_cp38    conda-forge
    pythreejs                 2.3.0              pyhd8ed1ab_0    conda-forge
    pytz                      2021.1             pyhd8ed1ab_0    conda-forge
    pywavelets                1.1.1            py38hab2c0dc_3    conda-forge
    pyyaml                    5.4.1            py38h497a2fe_0    conda-forge
    pyzmq                     22.0.3           py38h2035c66_1    conda-forge
    qdldl                     0.1.5.post0              pypi_0    pypi
    qt                        5.12.9               hda022c4_4    conda-forge
    qtconsole                 5.0.3              pyhd8ed1ab_0    conda-forge
    qtpy                      1.9.0                      py_0    conda-forge
    quandl                    3.6.1            py38h06a4308_0  
    queuelib                  1.6.1              pyhd8ed1ab_0    conda-forge
    re2                       2021.04.01           h9c3ff4c_0    conda-forge
    readline                  8.1                  h46c0cb4_0    conda-forge
    regex                     2021.4.4         py38h497a2fe_0    conda-forge
    requests                  2.25.1             pyhd3deb0d_0    conda-forge
    requests-oauthlib         1.3.0              pyh9f0ad1d_0    conda-forge
    retrying                  1.3.3                      py_2    conda-forge
    rsa                       4.7.2              pyh44b312d_0    conda-forge
    ruamel_yaml               0.15.100         py38h27cfd23_0  
    s2n                       1.0.0                h9b69904_0    conda-forge
    s3transfer                0.4.2              pyhd8ed1ab_0    conda-forge
    scikit-image              0.18.1           py38h51da96c_0    conda-forge
    scikit-learn              0.23.2                   pypi_0    pypi
    scipy                     1.4.1                    pypi_0    pypi
    scrapy                    2.5.0            py38h578d9bd_1    conda-forge
    scs                       2.1.3                    pypi_0    pypi
    seaborn                   0.11.1               ha770c72_0    conda-forge
    seaborn-base              0.11.1             pyhd8ed1ab_1    conda-forge
    semver                    2.13.0             pyh9f0ad1d_0    conda-forge
    send2trash                1.5.0                      py_0    conda-forge
    service_identity          18.1.0                     py_0    conda-forge
    setuptools                52.0.0           py38h06a4308_0  
    shap                      0.39.0                   pypi_0    pypi
    shellingham               1.4.0              pyh44b312d_0    conda-forge
    six                       1.15.0             pyh9f0ad1d_0    conda-forge
    sklearn                   0.0                      pypi_0    pypi
    sleef                     3.5.1                h7f98852_1    conda-forge
    slicer                    0.0.7              pyhd8ed1ab_0    conda-forge
    smart-open                3.0.0                    pypi_0    pypi
    snappy                    1.1.8                he1b5a44_3    conda-forge
    snappy-manifolds          1.1.2                    pypi_0    pypi
    sniffio                   1.2.0            py38h578d9bd_1    conda-forge
    sortedcontainers          2.3.0              pyhd8ed1ab_0    conda-forge
    soupsieve                 2.2.1              pyhd3eb1b0_0  
    spacy                     3.0.6            py38hfc89cab_1    conda-forge
    spacy-legacy              3.0.5              pyhd8ed1ab_0    conda-forge
    spherogram                2.0                      pypi_0    pypi
    sqlalchemy                1.4.12                   pypi_0    pypi
    sqlite                    3.35.5               h74cdb3f_0    conda-forge
    srsly                     2.4.1            py38h709712a_0    conda-forge
    statsmodels               0.12.2           py38h5c078b8_0    conda-forge
    sympy                     1.8              py38h578d9bd_0    conda-forge
    sysroot_linux-64          2.17                h77966d4_10    conda-forge
    ta-lib                    0.4.19           py38hfeaa757_0    ml4t
    tbb                       2020.3               hfd86e86_0  
    tensorboard               2.2.2                    pypi_0    pypi
    tensorboard-plugin-wit    1.8.0              pyh44b312d_0    conda-forge
    tensorflow                2.2.0                    pypi_0    pypi
    tensorflow-datasets       4.2.0                    pypi_0    pypi
    tensorflow-estimator      2.2.0                    pypi_0    pypi
    tensorflow-metadata       0.30.0                   pypi_0    pypi
    termcolor                 1.1.0                      py_2    conda-forge
    terminado                 0.9.4            py38h578d9bd_0    conda-forge
    testpath                  0.4.4                      py_0    conda-forge
    textacy                   0.11.0           py38h578d9bd_0    conda-forge
    textblob                  0.15.3                     py_0    conda-forge
    theano-pymc               1.1.2            py38h709712a_0    conda-forge
    thinc                     8.0.3            py38hfc89cab_1    conda-forge
    threadpoolctl             2.1.0              pyh5ca1d4c_0    conda-forge
    tifffile                  2021.4.8           pyhd8ed1ab_0    conda-forge
    tk                        8.6.10               hed695b0_1    conda-forge
    toml                      0.10.2             pyhd8ed1ab_0    conda-forge
    tomlkit                   0.7.0            py38h578d9bd_3    conda-forge
    toolz                     0.11.1                     py_0    conda-forge
    torch                     1.8.1                    pypi_0    pypi
    tornado                   6.1              py38h497a2fe_1    conda-forge
    tqdm                      4.60.0             pyhd8ed1ab_0    conda-forge
    trading-calendars         2.1.1              pyhd3deb0d_0    conda-forge
    traitlets                 5.0.5                      py_0    conda-forge
    traittypes                0.2.1              pyh9f0ad1d_2    conda-forge
    twisted                   21.2.0           py38h497a2fe_0    conda-forge
    typer                     0.3.2              pyhd8ed1ab_0    conda-forge
    typing-extensions                 pypi_0    pypi
    umap-learn                0.5.1            py38h578d9bd_1    conda-forge
    urllib3                   1.26.4             pyhd8ed1ab_0    conda-forge
    w3lib                     1.22.0             pyh9f0ad1d_0    conda-forge
    wasabi                    0.8.2              pyh44b312d_0    conda-forge
    wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
    webencodings              0.5.1                      py_1    conda-forge
    werkzeug                  1.0.1              pyh9f0ad1d_0    conda-forge
    wheel                     0.36.2             pyhd3deb0d_0    conda-forge
    widgetsnbextension        3.5.1            py38h578d9bd_4    conda-forge
    wordcloud                 1.8.1            py38h497a2fe_1    conda-forge
    wrapt                     1.12.1           py38h497a2fe_3    conda-forge
    x264                      1!161.3030           h7f98852_1    conda-forge
    xarray                    0.17.0             pyhd8ed1ab_0    conda-forge
    xgboost                   1.4.1                    pypi_0    pypi
    xlrd                      2.0.1              pyhd8ed1ab_3    conda-forge
    xorg-kbproto              1.0.7             h14c3975_1002    conda-forge
    xorg-libice               1.0.10               h516909a_0    conda-forge
    xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
    xorg-libx11               1.7.0                h36c2ea0_0    conda-forge
    xorg-libxext              1.3.4                h7f98852_1    conda-forge
    xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
    xorg-renderproto          0.11.1            h14c3975_1002    conda-forge
    xorg-xextproto            7.3.0             h14c3975_1002    conda-forge
    xorg-xproto               7.0.31            h14c3975_1007    conda-forge
    xz                        5.2.5                h516909a_1    conda-forge
    yaml                      0.2.5                h516909a_0    conda-forge
    yarl                      1.6.3            py38h497a2fe_1    conda-forge
    yellowbrick               1.2.1                    pypi_0    pypi
    yfinance                  0.1.59                     py_0    ml4t
    zeromq                    4.3.4                h9c3ff4c_0    conda-forge
    zfp                       0.5.5                h9c3ff4c_5    conda-forge
    zipline-reloaded          2.0.0                    pypi_0    pypi
    zipp                      3.4.1              pyhd8ed1ab_0    conda-forge
    zlib                      1.2.11            h516909a_1010    conda-forge
    zope.interface            5.4.0            py38h497a2fe_0    conda-forge
    zstd                      1.4.9                ha95c52a_0    conda-forge

    Description of Issue

    I'm trying to follow single alpha factor example ( using Binance 1m OHCLV data with always open calendar, but I'm getting ValueError: Unable to determine domain for Pipeline. error even if I pass GENERIC domain.

    • What did you expect to happen? Things to run like with quandl data.
    • What happened instead? I got ValueError: Unable to determine domain for Pipeline. error.

    Here is how you can reproduce this issue on your machine:

    Reproduction Steps

    1. Download Binance 1m data and ingest
    2. Copy 04_single_factor_zipline example with modifications in the run_algorithm (below)
    3. Try to run run_algorithm
    result = run_algorithm(start=start,

    What steps have you taken to resolve this already?

    I tried to import GENERIC domain and add it manually to Pipeline but didn't work. I'm a total newbie with Zipline, so I have no idea how to debug this further.

    from zipline.pipeline.domain import GENERIC
    def compute_factors():
        mean_reversion = MeanReversion()
        dollar_volume = AverageDollarVolume(window_length=MONTH)
        return Pipeline(columns={'longs': mean_reversion.bottom(N_LONGS),
                                 'ranking': mean_reversion.rank(ascending=False)},
              , domain=GENERIC)
    opened by jb33k 0
  • Installation Issue

    Installation Issue

    Are you able to import that attribute yourself with something like from logbook import Logger, or is zipline's the only code that fails to import it?

    Yes I am able to import logger from logbook. When I import Zipline, it gives me the attribute error. (AttributeError: module 'logbook' has no attribute 'Logger')

    I installed it using Pip3 on my Macintosh. Python version: 3.8

    opened by shivam017arora 8
  • Zipline behavior with many stocks

    Zipline behavior with many stocks

    Dear Zipline Maintainers,

    Before I tell you about my issue, let me describe my environment:

    • Operating System: Windows 10, Verision 20H2
    • Python Version: 3.6
    • How did you install Zipline: conda
    • Zipline version 1.4

    Now that you know a little about me, let me tell you about the issue I am having:

    Description of Issue

    Ingested my own price info of about 2000 stocks from 2000-01-01 to 2020-12-31. I have implemented a simple Donchian channel algorithm together with a momentum score from "Trading Evolved" whichs is used to pick the stocks to trade. I tested the algorithm with different time windows 2000-04-01 through 2020-12-31 and 2000-04-01 through 2015-12-31. All other input was the same (I duplicated the script and simply changed the ending date). The trading system shows completely different results for the two time frames, although I expecte them to be identical up to 2015-12-31. Already the first trading day shows different stocks to trade (momentum score sorting). Comparison of different algorithms is of course not possible this way.

    Is there an issue with the number of stocks Zipline can handle? What is the maximum number of stocks I can savely use so that I can be sure that results can be comparable?

    Here is how you can reproduce this issue on your machine:

    Reproduction Steps

    1. Ingest stock date for about 2000 stocks
    2. implement different time frames with the same beginning but different endings


    What steps have you taken to resolve this already?

    I have tried to understand the zipline handle_data function but could not really get a grasp of it.

    Anything else?


    Sincerely, Waldemar

    opened by WaldemarGrauberger 1
  • KeyError on ingested bundle in run_algorithm

    KeyError on ingested bundle in run_algorithm

    Hi everyone! I ingested a bundle by csv like this

    from import register
    from import csvdir_equities
    import pandas as pd
    start_session = pd.Timestamp('2021-1-1', tz='utc')
    end_session = pd.Timestamp('2021-4-22', tz='utc')

    After that I'm trying to run the Algo by this code

    def initialize(context):
        context.asset = symbol('BTCUSDT')
        order_target_percent(context.asset, 1.0)
    def handle_data(context, data):
        current_time = get_datetime().time()
        if current_time.hour == 0 and current_time.minute == 0:
            print('Current date is ' + str(get_datetime().date()))
        capital_base = 1000000,
        data_frequency = 'minute',
        initialize = initialize,
        handle_data = handle_data,
        bundle = 'binance_test',
        start=pd.to_datetime('2021-1-3', utc=True),
        end=pd.to_datetime('2021-1-4', utc=True))

    But I'm getting this error:

    KeyError                                  Traceback (most recent call last)
    pandas/_libs/index.pyx in pandas._libs.index.DatetimeEngine.get_loc()
    pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
    pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
    KeyError: 1609459200000000000
    During handling of the above exception, another exception occurred:
    KeyError                                  Traceback (most recent call last)
    <ipython-input-3-8711d6cc09d8> in <module>()
         19     bundle = 'binance_test',
         20     start=pd.to_datetime('2021-1-3', utc=True),
    ---> 21     end=pd.to_datetime('2021-1-4', utc=True))
    /opt/anaconda3/envs/env_zipline/lib/python3.5/site-packages/zipline/utils/ in run_algorithm(start, end, initialize, capital_base, handle_data, before_trading_start, analyze, data_frequency, bundle, bundle_timestamp, trading_calendar, metrics_set, benchmark_returns, default_extension, extensions, strict_extensions, environ, blotter)
        407         environ=environ,
        408         blotter=blotter,
    --> 409         benchmark_spec=benchmark_spec,
        410     )
    /opt/anaconda3/envs/env_zipline/lib/python3.5/site-packages/zipline/utils/ in _run(handle_data, initialize, before_trading_start, analyze, algofile, algotext, defines, data_frequency, capital_base, bundle, bundle_timestamp, start, end, output, trading_calendar, print_algo, metrics_set, local_namespace, environ, blotter, benchmark_spec)
        163         equity_minute_reader=bundle_data.equity_minute_bar_reader,
        164         equity_daily_reader=bundle_data.equity_daily_bar_reader,
    --> 165         adjustment_reader=bundle_data.adjustment_reader,
        166     )
    /opt/anaconda3/envs/env_zipline/lib/python3.5/site-packages/zipline/data/ in __init__(self, asset_finder, trading_calendar, first_trading_day, equity_daily_reader, equity_minute_reader, future_daily_reader, future_minute_reader, adjustment_reader, last_available_session, last_available_minute, minute_history_prefetch_length, daily_history_prefetch_length)
        289                 self._first_trading_day
        290             )
    --> 291             if self._first_trading_day is not None else (None, None)
        292         )
    /opt/anaconda3/envs/env_zipline/lib/python3.5/site-packages/trading_calendars/ in open_and_close_for_session(self, session_label)
        763         #  # noqa
        764         return (
    --> 765   [session_label, 'market_open'].tz_localize(UTC),
        766   [session_label, 'market_close'].tz_localize(UTC),
        767         )
    /opt/anaconda3/envs/env_zipline/lib/python3.5/site-packages/pandas/core/ in __getitem__(self, key)
       1868         key = self._convert_key(key)
    -> 1869         return self.obj._get_value(*key, takeable=self._takeable)
       1871     def __setitem__(self, key, value):
    /opt/anaconda3/envs/env_zipline/lib/python3.5/site-packages/pandas/core/ in _get_value(self, index, col, takeable)
       1984         try:
    -> 1985             return engine.get_value(series._values, index)
       1986         except (TypeError, ValueError):
    pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
    pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
    pandas/_libs/index.pyx in pandas._libs.index.DatetimeEngine.get_loc()
    KeyError: Timestamp('2021-01-01 00:00:00+0000', tz='UTC')

    I use zipline version 1.4.1. What could be a reason of this?

    opened by lamres 5
  • How to ingest Quandl

    How to ingest Quandl

    Dear Zipline Maintainers,

    Before I tell you about my issue, let me describe my environment:


    I am currently following a book(Trading Evolved) for learning the algorithmic trading but got **stuck on ingesting quandal what should I do now. I have tried to find the answer but can not get any solution for the same. PLEASE HELP

    '''(zip35) C:\Users\jayan>zipline ingest -b quandl Traceback (most recent call last): File "C:\Users\jayan\anaconda3\envs\zip35\Scripts\", line 33, in sys.exit(load_entry_point('zipline==1.4.1', 'console_scripts', 'zipline')()) File "C:\Users\jayan\anaconda3\envs\zip35\Scripts\", line 25, in importlib_load_entry_point return next(matches).load() File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\", line 100, in load module = import_module('module')) File "C:\Users\jayan\anaconda3\envs\zip35\lib\", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 941, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in find_and_load_unlocked File "", line 665, in load_unlocked File "", line 678, in exec_module File "", line 219, in call_with_frames_removed File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\", line 29, in from .utils.run_algo import run_algorithm File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\utils\", line 20, in from import bundles File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\data\", line 2, in from . import quandl # noqa File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\data\bundles\", line 16, in from . import core as bundles File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\data\bundles\", line 15, in from ..minute_bars import ( File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\data\", line 30, in import tables File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\", line 99, in from .utilsextension import (

    ImportError: DLL load failed: The specified module could not be found.'''

    Thank you to whoever replies to this.

    opened by Jayant-Agarwal 1
  • Live Trading Connectors

    Live Trading Connectors

    Since Quantopian is no more can the live trading and datafeed connectors be also be opensourced?

    opened by sirinath 1
  • 1.4.1(Oct 5, 2020)

    This release includes a small number of bug fixes, documentation improvements, and build/dependency enhancements.

    Conda packages for zipline and its dependencies are now available for python 3.6 on the ‘conda-forge’ Anaconda channel. They’re also available on the ‘Quantopian’ channel, but we’ll stop updating those eventually.

    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Jul 23, 2020)

  • v1.3.0(Jul 17, 2018)

    Release 1.3.0

    This release includes several enhancements and performance improvements along with a small number of bug fixes. We recommend that all users upgrade to this version.

    NOTE: This will likely be the last minor release in the Zipline 1.x series. The release next will be Zipline 2.0, which will include a number of small breaking changes required to support international equities.


    Support for Newer Numpy/Pandas Versions

    Zipline has historically been very conservative when updating versions of numpy, pandas, and other "PyData" ecosystem packages. This conservatism is primarily due to the fact that Zipline is used as the backtesting engine for Quantopian, which means that updating package versions risks breaking a large installed codebase. Of course, many Zipline users don't have the backwards compatibility requirements that Quantopian has, and they'd like to be able to use the latest and greatest package versions.

    As part of this release, we're now building and testing Zipline with two package configurations:

    • "Stable", using numpy version 1.11 and pandas version 0.18.1.
    • "Latest", using numpy version 1.14 and pandas version 0.22.0.

    Other combinations of numpy and pandas may work, but these package sets will be built and tested during our normal development cycle.

    Moving forward, our goal is to continue to maintain support for two sets of packages at any given time. The "stable" package set will change relatively infrequently, and will contain the versions of numpy and pandas supported on Quantopian. The "latest" package set will change regularly, and will contain recently-released versions of numpy and pandas.

    Our hope with these changes is to strike a balance between stability and novelty without taking on too great a maintenance burden by supporting every possible combination of packages.

    Standalone trading_calendars Module

    One of the most popular features of Zipline is its collection of trading calendars, which provide information about holidays and trading hours of various markets. As part of this release, Zipline's calendar-related functionality has been moved to a separate trading-calendars_ package, allowing users that only needed access to the calendars to use them without taking on the rest of Zipline's dependencies.

    For backwards compability, Zipline will continue to re-export calendar-related functions. For example, zipline.get_calendar still exists, but is now an alias for trading_calendars.get_calendar. Users that depend on this functionality are encouraged to update their imports to the new locations in trading_calendars.

    Custom Blotters

    This release adds experimental support for running Zipline with user-defined subclasses of The primary motivation for this change is to make it easier to run live algorithms from the Zipline CLI.

    There are two primary ways to configure a custom blotter:

    1. You can pass an instance of as the blotter parameter to zipline.run_algorithm. (This functionality had existed previously, but wasn't well-documented.)
    2. You can register a named factory for a blotter in your and pass the name on the command line via the --blotter flag.

    An example usage of (2) might look like this:

    from zipline.extensions import register
    from import Blotter, SimulationBlotter
    from import EODCancel
    @register(Blotter, 'my-blotter')
    def my_blotter():
        """Create a SimulationBlotter with a non-default cancel policy.
        return SimulationBlotter(cancel_policy=EODCancel())

    To use this factory when running zipline from the command line, we would invoke zipline like this:

    $ zipline run --blotter my-blotter <...other-args...>

    As part of this change, the class has been converted to an abstract base class. The default blotter used in simulations is now named

    Custom Command-Line Arguments

    This release adds support for passing custom arguments to the zipline command-line interface. Custom command-line arguments are passed via the -x flag followed by a key=value pair. Arguments passed this way can be accessed from Python code (e.g., an algorithm or an extension) via attributes of zipline.extension_args. For example, if zipline is invoked like this:

    $ zipline -x argle=bargle run ...

    then the result of zipline.extension_args.argle would be the string "bargle".

    Custom arguments can be grouped into namespaces by including . characters in keys. For example, if zipline is invoked like this:

    $ zipline -x argle.bargle=foo

    then zipline.extension_args.argle will contain an object with a bargle attribute containing the string "foo". Keys can contain multiple dots to create nested namespaces.


    • Added support for pandas 0.22 and numpy 1.14. See above for details.
    • Moved zipline.utils.calendars into a separately-installable trading-calendars_ package.
    • Added support for specifying custom string arguments with the -x flag. See above for details.

    Experimental Features

    • Added support for registering custom subclass of See above for details.

    Bug Fixes

    • Fixed a bug in zipline.pipeline.Factor.winsorize where NaN values were incorrectly included in value counts when determining cutoff thresholds for winsorization.

    • Fixed a crash in with a count of 1 and no groupby.

    • Fixed a bug where calling data.history with a negative lookback would fetch prices from the future.

    • Fixed a bug where StopOrder, LimitOrder, and StopLimitOrder prices were being rounded to the nearest penny regardless of asset tick size. Prices are now rounded based on the tick_size attribute of the asset being ordered.


    • Improved performance when fetching minutely prices for assets that trade regularly.
    • Improved performance when fetching minutely prices for many assets by tuning cache sizes.

    Maintenance and Refactorings

    • Refactored large parts of the Zipline test suite to make it easier to change the signature of TradingAlgorithm.


    • Added support for running travis builds with pandas 0.18 and 0.22.
    • Added OSX builds to the travis build matrix.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Sep 7, 2016)

Quantopian, Inc.
Quantopian builds software tools and libraries for quantitative finance.
Quantopian, Inc.
:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python. Backtest trading strategies with Python. Project website Documentation the project if you use it. Installation $ pip install backtestin

null 1.8k Oct 23, 2021
Python library for backtesting trading strategies & analyzing financial markets (formerly pythalesians)

finmarketpy (formerly pythalesians) finmarketpy is a Python based library that enables you to analyze market data and also to backtest trading strateg

Cuemacro 2.7k Oct 23, 2021
Portfolio and risk analytics in Python

pyfolio pyfolio is a Python library for performance and risk analysis of financial portfolios developed by Quantopian Inc. It works well with the Zipl

Quantopian, Inc. 4.1k Oct 22, 2021
Performance analysis of predictive (alpha) stock factors

Alphalens Alphalens is a Python Library for performance analysis of predictive (alpha) stock factors. Alphalens works great with the Zipline open sour

Quantopian, Inc. 2.1k Oct 25, 2021 - #1 Quant Trading & Technical Analysis Bot - 2,100 + stars, 580 + forks

CryptoSignal - #1 Quant Trading & Technical Analysis Bot - 2,100 + stars, 580 + forks Development state: - 2,100 + stars, 580 + forks 3.5k Oct 22, 2021
An open source reinforcement learning framework for training, evaluating, and deploying robust trading agents.

TensorTrade: Trade Efficiently with Reinforcement Learning TensorTrade is still in Beta, meaning it should be used very cautiously if used in producti

null 3.5k Oct 23, 2021
Python Algorithmic Trading Library

PyAlgoTrade PyAlgoTrade is an event driven algorithmic trading Python library. Although the initial focus was on backtesting, paper trading is now pos

Gabriel Becedillas 3.5k Oct 24, 2021
Common financial technical indicators implemented in Pandas.

FinTA (Financial Technical Analysis) Common financial technical indicators implemented in Pandas. This is work in progress, bugs are expected and resu

null 1.3k Oct 21, 2021
Python Backtesting library for trading strategies

backtrader Yahoo API Note: [2018-11-16] After some testing it would seem that data downloads can be again relied upon over the web interface (or API v

DRo 7.5k Oct 23, 2021
Technical Analysis Library using Pandas and Numpy

Technical Analysis Library in Python It is a Technical Analysis library useful to do feature engineering from financial time series datasets (Open, Cl

Darío López Padial 2.5k Oct 22, 2021
bt - flexible backtesting for Python

bt - Flexible Backtesting for Python bt is currently in alpha stage - if you find a bug, please submit an issue. Read the docs here: http://pmorissett

Philippe Morissette 1.2k Oct 23, 2021
scrilla: A Financial Optimization Application

A python application that wraps around AlphaVantage, Quandl and IEX APIs, calculates financial statistics and optimizes portfolio allocations.

Grant Moore 3 Oct 19, 2021
Python sync/async framework for Interactive Brokers API

Introduction The goal of the IB-insync library is to make working with the Trader Workstation API from Interactive Brokers as easy as possible. The ma

Ewald de Wit 1.6k Oct 22, 2021
Find big moving stocks before they move using machine learning and anomaly detection

Surpriver - Find High Moving Stocks before they Move Find high moving stocks before they move using anomaly detection and machine learning. Surpriver

Tradytics 1.4k Oct 23, 2021
Common financial risk and performance metrics. Used by zipline and pyfolio.

empyrical Common financial risk metrics. Table of Contents Installation Usage Support Contributing Testing Installation pip install empyrical Usage S

Quantopian, Inc. 847 Oct 24, 2021
Yahoo! Finance market data downloader (+faster Pandas Datareader)

Yahoo! Finance market data downloader Ever since Yahoo! finance decommissioned their historical data API, many programs that relied on it to stop work

Ran Aroussi 5.8k Oct 22, 2021
High-performance TensorFlow library for quantitative finance.

TF Quant Finance: TensorFlow based Quant Finance Library Table of contents Introduction Installation TensorFlow training Development roadmap Examples

Google 2.8k Oct 25, 2021
A python wrapper for Alpha Vantage API for financial data.

alpha_vantage Python module to get stock data/cryptocurrencies from the Alpha Vantage API Alpha Vantage delivers a free API for real time financial da

Romel Torres 3.5k Oct 22, 2021