DOC: updated documentation

This commit is contained in:
Frederic Fortier
2018-02-09 12:12:06 -05:00
parent e6fa2827e2
commit c566a373fd
62 changed files with 5085 additions and 34053 deletions
+254 -117
View File
@@ -13,8 +13,6 @@
@@ -32,9 +30,6 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
@@ -44,28 +39,21 @@
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> Catalyst
<a href="index.html" class="icon icon-home"> Catalyst
</a>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@@ -74,89 +62,244 @@
</form>
</div>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="install.html">Install</a></li>
<li class="toctree-l1"><a class="reference internal" href="beginner-tutorial.html">Catalyst Beginner Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="live-trading.html">Live Trading</a></li>
<li class="toctree-l1"><a class="reference internal" href="features.html">Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="example-algos.html">Example Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="utilities.html">Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="videos.html">Videos</a></li>
<li class="toctree-l1"><a class="reference internal" href="resources.html">Resources</a></li>
<li class="toctree-l1"><a class="reference internal" href="development-guidelines.html">Development Guidelines</a></li>
<li class="toctree-l1"><a class="reference internal" href="releases.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Install</a><ul>
<li class="toctree-l2"><a class="reference internal" href="install.html#installing-with-conda">Installing with <code class="docutils literal"><span class="pre">conda</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="install.html#troubleshooting-conda-install">Troubleshooting <code class="docutils literal"><span class="pre">conda</span></code> Install</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="install.html#installing-with-pip">Installing with <code class="docutils literal"><span class="pre">pip</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="install.html#troubleshooting-pip-install">Troubleshooting <code class="docutils literal"><span class="pre">pip</span></code> Install</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="install.html#installing-with-pipenv">Installing with <code class="docutils literal"><span class="pre">pipenv</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#gnu-linux-requirements">GNU/Linux Requirements</a><ul>
<li class="toctree-l3"><a class="reference internal" href="install.html#amazon-linux-ami-notes">Amazon Linux AMI Notes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="install.html#macos-requirements">MacOS Requirements</a><ul>
<li class="toctree-l3"><a class="reference internal" href="install.html#macos-virtualenv-conda-matplotlib">MacOS + virtualenv/conda + matplotlib</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="install.html#windows-requirements">Windows Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#updating-catalyst">Updating Catalyst</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#getting-help">Getting Help</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beginner-tutorial.html">Catalyst Beginner Tutorial</a><ul>
<li class="toctree-l2"><a class="reference internal" href="beginner-tutorial.html#basics">Basics</a></li>
<li class="toctree-l2"><a class="reference internal" href="beginner-tutorial.html#my-first-algorithm">My first algorithm</a></li>
<li class="toctree-l2"><a class="reference internal" href="beginner-tutorial.html#ingesting-data">Ingesting data</a></li>
<li class="toctree-l2"><a class="reference internal" href="beginner-tutorial.html#running-the-algorithm">Running the algorithm</a><ul>
<li class="toctree-l3"><a class="reference internal" href="beginner-tutorial.html#command-line-interface">Command line interface</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="beginner-tutorial.html#access-to-previous-prices-using-history">Access to previous prices using <code class="docutils literal"><span class="pre">history</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="beginner-tutorial.html#working-example-dual-moving-average-cross-over">Working example: Dual Moving Average Cross-Over</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="beginner-tutorial.html#jupyter-notebook">Jupyter Notebook</a><ul>
<li class="toctree-l3"><a class="reference internal" href="beginner-tutorial.html#install">Install</a></li>
<li class="toctree-l3"><a class="reference internal" href="beginner-tutorial.html#running-algorithms">Running Algorithms</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="beginner-tutorial.html#next-steps">Next steps</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="live-trading.html">Live Trading</a><ul>
<li class="toctree-l2"><a class="reference internal" href="live-trading.html#supported-exchanges">Supported Exchanges</a></li>
<li class="toctree-l2"><a class="reference internal" href="live-trading.html#paper-trading-vs-live-trading-modes">Paper Trading vs Live Trading modes</a></li>
<li class="toctree-l2"><a class="reference internal" href="live-trading.html#authentication">Authentication</a></li>
<li class="toctree-l2"><a class="reference internal" href="live-trading.html#currency-symbols">Currency Symbols</a></li>
<li class="toctree-l2"><a class="reference internal" href="live-trading.html#trading-an-algorithm">Trading an Algorithm</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="features.html">Features</a><ul>
<li class="toctree-l2"><a class="reference internal" href="features.html#current-functionality">Current Functionality</a></li>
<li class="toctree-l2"><a class="reference internal" href="features.html#upcoming-features">Upcoming features</a></li>
<li class="toctree-l2"><a class="reference internal" href="features.html#naming-convention">Naming Convention</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="example-algos.html">Example Algorithms</a><ul>
<li class="toctree-l2"><a class="reference internal" href="example-algos.html#overview">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="example-algos.html#buy-btc-simple-algorithm">Buy BTC Simple Algorithm</a></li>
<li class="toctree-l2"><a class="reference internal" href="example-algos.html#buy-and-hodl-algorithm">Buy and Hodl Algorithm</a></li>
<li class="toctree-l2"><a class="reference internal" href="example-algos.html#dual-moving-average-crossover">Dual Moving Average Crossover</a></li>
<li class="toctree-l2"><a class="reference internal" href="example-algos.html#mean-reversion-algorithm">Mean Reversion Algorithm</a></li>
<li class="toctree-l2"><a class="reference internal" href="example-algos.html#simple-universe">Simple Universe</a></li>
<li class="toctree-l2"><a class="reference internal" href="example-algos.html#portfolio-optimization">Portfolio Optimization</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="utilities.html">Utilities</a><ul>
<li class="toctree-l2"><a class="reference internal" href="utilities.html#output-to-csv-file">Output to CSV file</a></li>
<li class="toctree-l2"><a class="reference internal" href="utilities.html#extracting-market-data">Extracting market data</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="videos.html">Videos</a><ul>
<li class="toctree-l2"><a class="reference internal" href="videos.html#installation-macos">Installation: MacOS</a></li>
<li class="toctree-l2"><a class="reference internal" href="videos.html#installation-windows">Installation: Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="videos.html#backtesting-a-strategy">Backtesting a Strategy</a></li>
<li class="toctree-l2"><a class="reference internal" href="videos.html#live-trading-a-strategy">Live Trading a Strategy</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="resources.html">Resources</a><ul>
<li class="toctree-l2"><a class="reference internal" href="resources.html#related-3rd-party-apis">Related 3rd Party APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="development-guidelines.html">Development Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="development-guidelines.html#creating-a-development-environment">Creating a Development Environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="development-guidelines.html#development-with-docker">Development with Docker</a></li>
<li class="toctree-l2"><a class="reference internal" href="development-guidelines.html#git-branching-structure">Git Branching Structure</a></li>
<li class="toctree-l2"><a class="reference internal" href="development-guidelines.html#contributing-to-the-docs">Contributing to the Docs</a></li>
<li class="toctree-l2"><a class="reference internal" href="development-guidelines.html#commit-messages">Commit messages</a></li>
<li class="toctree-l2"><a class="reference internal" href="development-guidelines.html#formatting-docstrings">Formatting Docstrings</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="releases.html">Release Notes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-5-3">Version 0.5.3</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#bug-fixes">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-5-2">Version 0.5.2</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id1">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-5-1">Version 0.5.1</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id2">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#build">Build</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-4-7">Version 0.4.7</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id3">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id4">Build</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-4-6">Version 0.4.6</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id5">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id6">Build</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-4-5">Version 0.4.5</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id7">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-4-4">Version 0.4.4</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id8">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-4-3">Version 0.4.3</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id9">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-4-2">Version 0.4.2</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id10">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id11">Build</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-4-0">Version 0.4.0</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id12">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id13">Build</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#version-0-3-10">Version 0.3.10</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id14">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-9">Version 0.3.9</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id15">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id16">Build</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-8">Version 0.3.8</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id17">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-7">Version 0.3.7</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id18">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id19">Build</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-6">Version 0.3.6</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id20">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-5">Version 0.3.5</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id21">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-4">Version 0.3.4</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id22">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id23">Build</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#documentation">Documentation</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-3">Version 0.3.3</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id25">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id26">Build</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-2">Version 0.3.2</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id27">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id28">Build</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3-1">Version 0.3.1</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id29">Bug Fixes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-3">Version 0.3</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-2-dev5">Version 0.2.dev5</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-2-dev4">Version 0.2.dev4</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-2-dev3">Version 0.2.dev3</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-2-dev2">Version 0.2.dev2</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-2-dev1">Version 0.2.dev1</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-1-dev9">Version 0.1.dev9</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-1-dev8">Version 0.1.dev8</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-1-dev7">Version 0.1.dev7</a></li>
<li class="toctree-l2"><a class="reference internal" href="releases.html#version-0-1-dev6">Version 0.1.dev6</a></li>
</ul>
</li>
</ul>
</div>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Catalyst</a>
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Catalyst</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>Data Bundles</li>
<li><a href="index.html">Docs</a> &raquo;</li>
<li>Data Bundles</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/bundles.rst.txt" rel="nofollow"> View page source</a>
<a href="_sources/bundles.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div role="main" class="document">
<div class="section" id="data-bundles">
<span id="id1"></span><h1>Data Bundles<a class="headerlink" href="#data-bundles" title="Permalink to this headline"></a></h1>
@@ -168,12 +311,12 @@ backtests and store the data for future runs.</p>
<p>Zipline comes with a few bundles by default as well as the ability to register
new bundles. To see which bundles we have have available, we may run the
<code class="docutils literal"><span class="pre">bundles</span></code> command, for example:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ zipline bundles
my-custom-bundle <span class="m">2016</span>-05-05 <span class="m">20</span>:35:19.809398
my-custom-bundle <span class="m">2016</span>-05-05 <span class="m">20</span>:34:53.654082
my-custom-bundle <span class="m">2016</span>-05-05 <span class="m">20</span>:34:48.401767
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>zipline bundles
my-custom-bundle 2016-05-05 20:35:19.809398
my-custom-bundle 2016-05-05 20:34:53.654082
my-custom-bundle 2016-05-05 20:34:48.401767
quandl &lt;no ingestions&gt;
quantopian-quandl <span class="m">2016</span>-05-05 <span class="m">20</span>:06:40.894956
quantopian-quandl 2016-05-05 20:06:40.894956
</pre></div>
</div>
<p>The output here shows that there are 3 bundles available:</p>
@@ -196,11 +339,11 @@ standard location that zipline can find. By default the location where ingested
data will be written is <code class="docutils literal"><span class="pre">$ZIPLINE_ROOT/data/&lt;bundle&gt;</span></code> where by default
<code class="docutils literal"><span class="pre">ZIPLINE_ROOT=~/.zipline</span></code>. The ingestion step may take some time as it could
involve downloading and processing a lot of data. This can be run with:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ zipline ingest <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>zipline ingest <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span>
</pre></div>
</div>
<p>where <code class="docutils literal"><span class="pre">&lt;bundle&gt;</span></code> is the name of the bundle to ingest, defaulting to
<a class="reference internal" href="#quantopian-quandl-mirror"><span class="std std-ref">quantopian-quandl</span></a>.</p>
<a class="reference internal" href="#quantopian-quandl-mirror"><span>quantopian-quandl</span></a>.</p>
</div>
<div class="section" id="old-data">
<h2>Old Data<a class="headerlink" href="#old-data" title="Permalink to this headline"></a></h2>
@@ -211,21 +354,21 @@ copies. Running a backtest with an old ingestion makes it easier to reproduce
backtest results later.</p>
<p>One drawback of saving all of the data by default is that the data directory
may grow quite large even if you do not want to use the data. As shown earlier,
we can list all of the ingestions with the <a class="reference internal" href="#bundles-command"><span class="std std-ref">bundles command</span></a>. To solve the problem of leaking old data there is another
we can list all of the ingestions with the <a class="reference internal" href="#bundles-command"><span>bundles command</span></a>. To solve the problem of leaking old data there is another
command: <code class="docutils literal"><span class="pre">clean</span></code>, which will clear data bundles based on some time
constraints.</p>
<p>For example:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="c1"># clean everything older than &lt;date&gt;</span>
$ zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span> --before &lt;date&gt;
<div class="highlight-bash"><div class="highlight"><pre><span class="c"># clean everything older than &lt;date&gt;</span>
<span class="nv">$ </span>zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span> --before &lt;date&gt;
<span class="c1"># clean everything newer than &lt;date&gt;</span>
$ zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span> --after &lt;date&gt;
<span class="c"># clean everything newer than &lt;date&gt;</span>
<span class="nv">$ </span>zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span> --after &lt;date&gt;
<span class="c1"># keep everything in the range of [before, after] and delete the rest</span>
$ zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span> --before &lt;date&gt; --after &lt;after&gt;
<span class="c"># keep everything in the range of [before, after] and delete the rest</span>
<span class="nv">$ </span>zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span> --before &lt;date&gt; --after &lt;after&gt;
<span class="c1"># clean all but the last &lt;int&gt; runs</span>
$ zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span> --keep-last &lt;int&gt;
<span class="c"># clean all but the last &lt;int&gt; runs</span>
<span class="nv">$ </span>zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span> --keep-last &lt;int&gt;
</pre></div>
</div>
</div>
@@ -234,7 +377,7 @@ $ zipline clean <span class="o">[</span>-b &lt;bundle&gt;<span class="o">]</span
<p>Now that the data has been ingested we can use it to run backtests with the
<code class="docutils literal"><span class="pre">run</span></code> command. The bundle to use can be specified with the <code class="docutils literal"><span class="pre">--bundle</span></code> option
like:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ zipline run --bundle &lt;bundle&gt; --algofile algo.py ...
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>zipline run --bundle &lt;bundle&gt; --algofile algo.py ...
</pre></div>
</div>
<p>We may also specify the date to use to look up the bundle data with the
@@ -250,13 +393,13 @@ current day to use the most recent data.</p>
<h2>Default Data Bundles<a class="headerlink" href="#default-data-bundles" title="Permalink to this headline"></a></h2>
<div class="section" id="quandl-wiki-bundle">
<span id="quandl-data-bundle"></span><h3>Quandl WIKI Bundle<a class="headerlink" href="#quandl-wiki-bundle" title="Permalink to this headline"></a></h3>
<p>By default zipline comes with the <code class="docutils literal"><span class="pre">quandl</span></code> data bundle which uses quandls
<p>By default zipline comes with the <code class="docutils literal"><span class="pre">quandl</span></code> data bundle which uses quandl&#8217;s
<a class="reference external" href="https://www.quandl.com/data/WIKI">WIKI dataset</a>. The quandl data bundle
includes daily pricing data, splits, cash dividends, and asset metadata. To
ingest the <code class="docutils literal"><span class="pre">quandl</span></code> data bundle we recommend creating an account on quandl.com
to get an API key to be able to make more API requests per day. Once we have an
API key we may run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nv">QUANDL_API_KEY</span><span class="o">=</span>&lt;api-key&gt; zipline ingest -b quandl
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ QUANDL_API_KEY</span><span class="o">=</span>&lt;api-key&gt; zipline ingest -b quandl
</pre></div>
</div>
<p>though we may still run <code class="docutils literal"><span class="pre">ingest</span></code> as an anonymous quandl user (with no API
@@ -287,23 +430,23 @@ cache the data for a set of equities from yahoo. The yahoo bundles include daily
pricing data along with splits, cash dividends, and inferred asset metadata. To
create a bundle from a set of equities, add the following to your
<code class="docutils literal"><span class="pre">~/.zipline/extensions.py</span></code> file:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">zipline.data.bundles</span> <span class="kn">import</span> <span class="n">register</span><span class="p">,</span> <span class="n">yahoo_equities</span>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">zipline.data.bundles</span> <span class="kn">import</span> <span class="n">register</span><span class="p">,</span> <span class="n">yahoo_equities</span>
<span class="c1"># these are the tickers you would like data for</span>
<span class="c"># these are the tickers you would like data for</span>
<span class="n">equities</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;AAPL&#39;</span><span class="p">,</span>
<span class="s1">&#39;MSFT&#39;</span><span class="p">,</span>
<span class="s1">&#39;GOOG&#39;</span><span class="p">,</span>
<span class="s">&#39;AAPL&#39;</span><span class="p">,</span>
<span class="s">&#39;MSFT&#39;</span><span class="p">,</span>
<span class="s">&#39;GOOG&#39;</span><span class="p">,</span>
<span class="p">}</span>
<span class="n">register</span><span class="p">(</span>
<span class="s1">&#39;my-yahoo-equities-bundle&#39;</span><span class="p">,</span> <span class="c1"># name this whatever you like</span>
<span class="s">&#39;my-yahoo-equities-bundle&#39;</span><span class="p">,</span> <span class="c"># name this whatever you like</span>
<span class="n">yahoo_equities</span><span class="p">(</span><span class="n">equities</span><span class="p">),</span>
<span class="p">)</span>
</pre></div>
</div>
<p>This may now be used like:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ zipline ingest -b my-yahoo-equities-bundle
$ zipline run -f algo.py --bundle my-yahoo-equities-bundle
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>zipline ingest -b my-yahoo-equities-bundle
<span class="nv">$ </span>zipline run -f algo.py --bundle my-yahoo-equities-bundle
</pre></div>
</div>
<p>More than one yahoo equities bundle may be registered as long as they use
@@ -316,14 +459,14 @@ different names.</p>
zipline. To add a new bundle, one must implement an <code class="docutils literal"><span class="pre">ingest</span></code> function.</p>
<p>The <code class="docutils literal"><span class="pre">ingest</span></code> function is responsible for loading the data into memory and
passing it to a set of writer objects provided by zipline to convert the data to
ziplines internal format. The ingest function may work by downloading data from
zipline&#8217;s internal format. The ingest function may work by downloading data from
a remote location like the <code class="docutils literal"><span class="pre">quandl</span></code> bundle or yahoo bundles or it may just
load files that are already on the machine. The function is provided with
writers that will write the data to the correct location transactionally. If an
ingestion fails part way through the bundle will not be written in an incomplete
state.</p>
<p>The signature of the ingest function should be:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">ingest</span><span class="p">(</span><span class="n">environ</span><span class="p">,</span>
<div class="highlight-python"><div class="highlight"><pre><span class="n">ingest</span><span class="p">(</span><span class="n">environ</span><span class="p">,</span>
<span class="n">asset_db_writer</span><span class="p">,</span>
<span class="n">minute_bar_writer</span><span class="p">,</span>
<span class="n">daily_bar_writer</span><span class="p">,</span>
@@ -357,7 +500,7 @@ docs for write.</p>
<h3><code class="docutils literal"><span class="pre">minute_bar_writer</span></code><a class="headerlink" href="#minute-bar-writer" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal"><span class="pre">minute_bar_writer</span></code> is an instance of
<code class="xref py py-class docutils literal"><span class="pre">BcolzMinuteBarWriter</span></code>. This writer is used to
convert data to ziplines internal bcolz format to later be read by a
convert data to zipline&#8217;s internal bcolz format to later be read by a
<code class="xref py py-class docutils literal"><span class="pre">BcolzMinuteBarReader</span></code>. If minute data is
provided, users should call
<code class="xref py py-meth docutils literal"><span class="pre">write()</span></code> with an iterable of
@@ -379,7 +522,7 @@ as the dates are strictly increasing.</p>
<h3><code class="docutils literal"><span class="pre">daily_bar_writer</span></code><a class="headerlink" href="#daily-bar-writer" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal"><span class="pre">daily_bar_writer</span></code> is an instance of
<code class="xref py py-class docutils literal"><span class="pre">BcolzDailyBarWriter</span></code>. This writer is
used to convert data into ziplines internal bcolz format to later be read by a
used to convert data into zipline&#8217;s internal bcolz format to later be read by a
<code class="xref py py-class docutils literal"><span class="pre">BcolzDailyBarReader</span></code>. If daily data is
provided, users should call
<code class="xref py py-meth docutils literal"><span class="pre">write()</span></code> with an iterable of
@@ -429,7 +572,7 @@ that the bundle should load data for.</p>
<p><code class="docutils literal"><span class="pre">cache</span></code> is an instance of <code class="xref py py-class docutils literal"><span class="pre">dataframe_cache</span></code>. This
object is a mapping from strings to dataframes. This object is provided in case
an ingestion crashes part way through. The idea is that the ingest function
should check the cache for raw data, if it doesnt exist in the cache, it should
should check the cache for raw data, if it doesn&#8217;t exist in the cache, it should
acquire it and then store it in the cache. Then it can parse and write the
data. The cache will be cleared only after a successful load, this prevents the
ingest function from needing to redownload all the data if there is some bug in
@@ -439,7 +582,7 @@ from another local file, then there is no need to use this cache.</p>
<div class="section" id="show-progress">
<h3><code class="docutils literal"><span class="pre">show_progress</span></code><a class="headerlink" href="#show-progress" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal"><span class="pre">show_progress</span></code> is a boolean indicating that the user would like to receive
feedback about the ingest functions progress fetching and writing the
feedback about the ingest function&#8217;s progress fetching and writing the
data. Some examples for where to show how many files you have downloaded out of
the total needed, or how far into some data conversion the ingest function
is. One tool that may help with implementing <code class="docutils literal"><span class="pre">show_progress</span></code> for a loop is
@@ -452,17 +595,13 @@ forwarded to <code class="docutils literal"><span class="pre">minute_bar_writer.
written. <code class="docutils literal"><span class="pre">output_dir</span></code> will be some subdirectory of <code class="docutils literal"><span class="pre">$ZIPLINE_ROOT</span></code> and will
contain the time of the start of the current ingestion. This can be used to
directly move resources here if for some reason your ingest function can produce
its own outputs without the writers. For example, the <code class="docutils literal"><span class="pre">quantopian:quandl</span></code>
it&#8217;s own outputs without the writers. For example, the <code class="docutils literal"><span class="pre">quantopian:quandl</span></code>
bundle uses this to directly untar the bundle into the <code class="docutils literal"><span class="pre">output_dir</span></code>.</p>
</div>
</div>
</div>
</div>
<div class="articleComments">
</div>
</div>
<footer>
@@ -472,10 +611,9 @@ bundle uses this to directly untar the bundle into the <code class="docutils lit
<div role="contentinfo">
<p>
&copy; Copyright 2018, Enigma MPC, Inc..
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@@ -496,8 +634,7 @@ bundle uses this to directly untar the bundle into the <code class="docutils lit
VERSION:'0.4',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>