DOC: release 0.5.6

This commit is contained in:
Victor Grau Serrat
2018-03-22 12:08:15 -06:00
parent e303f60378
commit caf2ef70fd
31 changed files with 2765 additions and 4515 deletions
+288 -281
View File
@@ -13,6 +13,8 @@
@@ -42,21 +44,28 @@
<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-nav-search">
<div class="wy-side-scroll">
<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" />
@@ -65,259 +74,89 @@
</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><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#pycharm-ide">PyCharm IDE</a><ul>
<li class="toctree-l3"><a class="reference internal" href="beginner-tutorial.html#id1">Install</a></li>
<li class="toctree-l3"><a class="reference internal" href="beginner-tutorial.html#setup">Setup</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-5">Version 0.5.5</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-4">Version 0.5.4</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#build">Build</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id1">Bug Fixes</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-5-3">Version 0.5.3</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id2">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#id3">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#id4">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id5">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#id6">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id7">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#id8">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id9">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#id10">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#id11">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#id12">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#id13">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id14">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#id15">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id16">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#id17">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#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-8">Version 0.3.8</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-7">Version 0.3.7</a><ul>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id21">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id22">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#id23">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#id24">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#id25">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id26">Build</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id27">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#id29">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id30">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#id31">Bug Fixes</a></li>
<li class="toctree-l3"><a class="reference internal" href="releases.html#id32">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#id33">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>
<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>
</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>API Reference</li>
<li><a href="index.html">Docs</a> &raquo;</li>
<li>API Reference</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/appendix.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document">
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="api-reference">
<h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline"></a></h1>
@@ -481,6 +320,168 @@ backwards compatibility with older API concepts.</p>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="catalyst.protocol.BarData.can_trade">
<code class="descname">can_trade</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.protocol.BarData.can_trade" title="Permalink to this definition"></a></dt>
<dd><p>For the given asset or iterable of assets, returns true if all of the
following are true:
1) the asset is alive for the session of the current simulation time</p>
<blockquote>
<div>(if current simulation time is not a market minute, we use the next
session)</div></blockquote>
<ol class="arabic simple" start="2">
<li>(if we are in minute mode) the assets exchange is open at the</li>
</ol>
<blockquote>
<div>current simulation time or at the simulation calendars next market
minute</div></blockquote>
<ol class="arabic simple" start="3">
<li>there is a known last price for the asset.</li>
</ol>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>assets: Asset or iterable of assets</strong></td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>can_trade</strong> : bool or pd.Series[bool] indexed by asset.</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>The second condition above warrants some further explanation.
- If the assets exchange calendar is identical to the simulation
calendar, then this condition always returns True.
- If there are market minutes in the simulation calendar outside of
this assets exchanges trading hours (for example, if the simulation
is running on the CME calendar but the asset is MSFT, which trades on
the NYSE), during those minutes, this condition will return false
(for example, 3:15 am Eastern on a weekday, during which the CME is
open but the NYSE is closed).</p>
</dd></dl>
<dl class="method">
<dt id="catalyst.protocol.BarData.current">
<code class="descname">current</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.protocol.BarData.current" title="Permalink to this definition"></a></dt>
<dd><p>Returns the current value of the given assets for the given fields
at the current simulation time. Current values are the as-traded price
and are usually not adjusted for events like splits or dividends (see
notes for more information).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>assets</strong> : Asset or iterable of Assets</p>
<p><strong>fields</strong> : str or iterable[str].</p>
<blockquote>
<div><p>Valid values are: “price”,
“last_traded”, “open”, “high”, “low”, “close”, “volume”, or column
names in files read by <code class="docutils literal"><span class="pre">fetch_csv</span></code>.</p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>current_value</strong> : Scalar, pandas Series, or pandas DataFrame.</p>
<blockquote class="last">
<div><p>See notes below.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>If a single asset and a single field are passed in, a scalar float
value is returned.</p>
<p>If a single asset and a list of fields are passed in, a pandas Series
is returned whose indices are the fields, and whose values are scalar
values for this asset for each field.</p>
<p>If a list of assets and a single field are passed in, a pandas Series
is returned whose indices are the assets, and whose values are scalar
values for each asset for the given field.</p>
<p>If a list of assets and a list of fields are passed in, a pandas
DataFrame is returned, indexed by asset. The columns are the requested
fields, filled with the scalar values for each asset for each field.</p>
<p>If the current simulation time is not a valid market time, we use the
last market close instead.</p>
<p>“price” returns the last known close price of the asset. If there is
no last known value (either because the asset has never traded, or
because it has delisted) NaN is returned. If a value is found, and we
had to cross an adjustment boundary (split, dividend, etc) to get it,
the value is adjusted before being returned.</p>
<p>“last_traded” returns the date of the last trade event of the asset,
even if the asset has stopped trading. If there is no last known value,
pd.NaT is returned.</p>
<p>“volume” returns the trade volume for the current simulation time. If
there is no trade this minute, 0 is returned.</p>
<p>“open”, “high”, “low”, and “close” return the relevant information for
the current trade bar. If there is no current trade bar, NaN is
returned.</p>
</dd></dl>
<dl class="method">
<dt id="catalyst.protocol.BarData.history">
<code class="descname">history</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.protocol.BarData.history" title="Permalink to this definition"></a></dt>
<dd><p>Returns a window of data for the given assets and fields.</p>
<p>This data is adjusted for splits, dividends, and mergers as of the
current algorithm time.</p>
<p>The semantics of missing data are identical to the ones described in
the notes for <cite>get_spot_value</cite>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>assets: Asset or iterable of Asset</strong></p>
<p><strong>fields: string or iterable of string. Valid values are “open”, “high”,</strong></p>
<blockquote>
<div><p>“low”, “close”, “volume”, “price”, and “last_traded”.</p>
</div></blockquote>
<p><strong>bar_count: integer number of bars of trade data</strong></p>
<p><strong>frequency: string. “1m” for minutely data or “1d” for daily date</strong></p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>history</strong> : Series or DataFrame or Panel</p>
<blockquote class="last">
<div><p>Return type depends on the dimensionality of the assets and
fields parameters.</p>
<p>If single asset and field are passed in, the returned Series is
indexed by dt.</p>
<p>If multiple assets and single field are passed in, the returned
DataFrame is indexed by dt, and has assets as columns.</p>
<p>If a single asset and multiple fields are passed in, the returned
DataFrame is indexed by dt, and has fields as columns.</p>
<p>If multiple assets and multiple fields are passed in, the returned
Panel is indexed by field, has dt as the major axis, and assets
as the minor axis.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>If the current simulation time is not a valid market time, we use the
last market close instead.</p>
</dd></dl>
<dl class="method">
<dt id="catalyst.protocol.BarData.is_stale">
<code class="descname">is_stale</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.protocol.BarData.is_stale" title="Permalink to this definition"></a></dt>
<dd><p>For the given asset or iterable of assets, returns true if the asset
is alive and there is no trade data for the current simulation time.</p>
<p>If the asset has never traded, returns False.</p>
<p>If the current simulation time is not a valid market time, we use the
current time to check if the asset is alive, but we use the last
market minute/day for the trade data check.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>assets: Asset or iterable of assets</strong></td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">boolean or Series of booleans, indexed by asset.</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
@@ -488,7 +489,7 @@ backwards compatibility with older API concepts.</p>
<h3>Scheduling Functions<a class="headerlink" href="#scheduling-functions" title="Permalink to this headline"></a></h3>
<dl class="function">
<dt id="catalyst.api.schedule_function">
<code class="descclassname">catalyst.api.</code><code class="descname">schedule_function</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.schedule_function" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">schedule_function</code><span class="sig-paren">(</span><em>self</em>, <em>func</em>, <em>date_rule=None</em>, <em>time_rule=None</em>, <em>half_days=True</em>, <em>calendar=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.schedule_function" title="Permalink to this definition"></a></dt>
<dd><p>Schedules a function to be called according to some timed rules.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -583,7 +584,7 @@ backwards compatibility with older API concepts.</p>
<h3>Orders<a class="headerlink" href="#orders" title="Permalink to this headline"></a></h3>
<dl class="function">
<dt id="catalyst.api.order">
<code class="descclassname">catalyst.api.</code><code class="descname">order</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">order</code><span class="sig-paren">(</span><em>self</em>, <em>asset</em>, <em>amount</em>, <em>limit_price=None</em>, <em>stop_price=None</em>, <em>style=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order" title="Permalink to this definition"></a></dt>
<dd><p>Place an order.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -638,7 +639,7 @@ and <code class="docutils literal"><span class="pre">limit_price</span></code> o
<dl class="function">
<dt id="catalyst.api.order_value">
<code class="descclassname">catalyst.api.</code><code class="descname">order_value</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_value" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">order_value</code><span class="sig-paren">(</span><em>self</em>, <em>asset</em>, <em>value</em>, <em>limit_price=None</em>, <em>stop_price=None</em>, <em>style=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_value" title="Permalink to this definition"></a></dt>
<dd><p>Place an order by desired value rather than desired number of
shares.</p>
<table class="docutils field-list" frame="void" rules="none">
@@ -691,7 +692,7 @@ value &lt; 0 :: Sell/Short</p>
<dl class="function">
<dt id="catalyst.api.order_percent">
<code class="descclassname">catalyst.api.</code><code class="descname">order_percent</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_percent" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">order_percent</code><span class="sig-paren">(</span><em>self</em>, <em>asset</em>, <em>percent</em>, <em>limit_price=None</em>, <em>stop_price=None</em>, <em>style=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_percent" title="Permalink to this definition"></a></dt>
<dd><p>Place an order in the specified asset corresponding to the given
percent of the current portfolio value.</p>
<table class="docutils field-list" frame="void" rules="none">
@@ -740,7 +741,7 @@ This is specified as a decimal, for example: 0.50 means 50%.</p>
<dl class="function">
<dt id="catalyst.api.order_target">
<code class="descclassname">catalyst.api.</code><code class="descname">order_target</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_target" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">order_target</code><span class="sig-paren">(</span><em>self</em>, <em>asset</em>, <em>target</em>, <em>limit_price=None</em>, <em>stop_price=None</em>, <em>style=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_target" title="Permalink to this definition"></a></dt>
<dd><p>Place an order to adjust a position to a target number of shares. If
the position doesnt already exist, this is equivalent to placing a new
order. If the position does exist, this is equivalent to placing an
@@ -787,7 +788,7 @@ current number of shares.</p>
<p class="rubric">Notes</p>
<p><code class="docutils literal"><span class="pre">order_target</span></code> does not take into account any open orders. For
example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">order_target</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">order_target</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
<span class="n">order_target</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
</pre></div>
</div>
@@ -800,7 +801,7 @@ call to <code class="docutils literal"><span class="pre">order_target</span></co
<dl class="function">
<dt id="catalyst.api.order_target_value">
<code class="descclassname">catalyst.api.</code><code class="descname">order_target_value</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_target_value" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">order_target_value</code><span class="sig-paren">(</span><em>self</em>, <em>asset</em>, <em>target</em>, <em>limit_price=None</em>, <em>stop_price=None</em>, <em>style=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_target_value" title="Permalink to this definition"></a></dt>
<dd><p>Place an order to adjust a position to a target value. If
the position doesnt already exist, this is equivalent to placing a new
order. If the position does exist, this is equivalent to placing an
@@ -849,7 +850,7 @@ is actually the target exposure, as Futures have no value.</p>
<p class="rubric">Notes</p>
<p><code class="docutils literal"><span class="pre">order_target_value</span></code> does not take into account any open orders. For
example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">order_target_value</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">order_target_value</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
<span class="n">order_target_value</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
</pre></div>
</div>
@@ -862,7 +863,7 @@ second <code class="docutils literal"><span class="pre">order_target_value</span
<dl class="function">
<dt id="catalyst.api.order_target_percent">
<code class="descclassname">catalyst.api.</code><code class="descname">order_target_percent</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_target_percent" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">order_target_percent</code><span class="sig-paren">(</span><em>self</em>, <em>asset</em>, <em>target</em>, <em>limit_price=None</em>, <em>stop_price=None</em>, <em>style=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.order_target_percent" title="Permalink to this definition"></a></dt>
<dd><p>Place an order to adjust a position to a target percent of the
current portfolio value. If the position doesnt already exist, this is
equivalent to placing a new order. If the position does exist, this is
@@ -911,7 +912,7 @@ percent and the current percent.</p>
<p class="rubric">Notes</p>
<p><code class="docutils literal"><span class="pre">order_target_value</span></code> does not take into account any open orders. For
example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">order_target_percent</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">order_target_percent</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
<span class="n">order_target_percent</span><span class="p">(</span><span class="n">sid</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>
</pre></div>
</div>
@@ -977,7 +978,7 @@ limit price once the market reaches a specified stop price.</p>
<dl class="function">
<dt id="catalyst.api.get_order">
<code class="descclassname">catalyst.api.</code><code class="descname">get_order</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.get_order" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">get_order</code><span class="sig-paren">(</span><em>self</em>, <em>order_id</em>, <em>exchange_name</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.get_order" title="Permalink to this definition"></a></dt>
<dd><p>Lookup an order based on the order id returned from one of the
order functions.</p>
<table class="docutils field-list" frame="void" rules="none">
@@ -1006,7 +1007,7 @@ order functions.</p>
<dl class="function">
<dt id="catalyst.api.get_open_orders">
<code class="descclassname">catalyst.api.</code><code class="descname">get_open_orders</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.get_open_orders" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">get_open_orders</code><span class="sig-paren">(</span><em>self</em>, <em>asset=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.get_open_orders" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve all of the current open orders.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1034,7 +1035,7 @@ orders for this asset.</p>
<dl class="function">
<dt id="catalyst.api.cancel_order">
<code class="descclassname">catalyst.api.</code><code class="descname">cancel_order</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.cancel_order" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">cancel_order</code><span class="sig-paren">(</span><em>self</em>, <em>order_param</em>, <em>exchange_name</em>, <em>symbol=None</em>, <em>params={}</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.cancel_order" title="Permalink to this definition"></a></dt>
<dd><p>Cancel an open order.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1060,7 +1061,7 @@ orders for this asset.</p>
<h4>Order Cancellation Policies<a class="headerlink" href="#order-cancellation-policies" title="Permalink to this headline"></a></h4>
<dl class="function">
<dt id="catalyst.api.set_cancel_policy">
<code class="descclassname">catalyst.api.</code><code class="descname">set_cancel_policy</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_cancel_policy" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_cancel_policy</code><span class="sig-paren">(</span><em>self</em>, <em>cancel_policy</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_cancel_policy" title="Permalink to this definition"></a></dt>
<dd><p>Sets the order cancellation policy for the simulation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1150,7 +1151,7 @@ Zipline will only apply this policy to minutely simulations.</p>
<h3>Assets<a class="headerlink" href="#assets" title="Permalink to this headline"></a></h3>
<dl class="function">
<dt id="catalyst.api.symbol">
<code class="descclassname">catalyst.api.</code><code class="descname">symbol</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.symbol" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">symbol</code><span class="sig-paren">(</span><em>self</em>, <em>symbol_str</em>, <em>exchange_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.symbol" title="Permalink to this definition"></a></dt>
<dd><p>Lookup an Equity by its ticker symbol.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1189,7 +1190,7 @@ symbol lookup date.</p>
<dl class="function">
<dt id="catalyst.api.symbols">
<code class="descclassname">catalyst.api.</code><code class="descname">symbols</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.symbols" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">symbols</code><span class="sig-paren">(</span><em>self</em>, <em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.symbols" title="Permalink to this definition"></a></dt>
<dd><p>Lookup multuple Equities as a list.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1225,7 +1226,7 @@ lookup date.</p>
<dl class="function">
<dt id="catalyst.api.set_symbol_lookup_date">
<code class="descclassname">catalyst.api.</code><code class="descname">set_symbol_lookup_date</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_symbol_lookup_date" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_symbol_lookup_date</code><span class="sig-paren">(</span><em>self</em>, <em>dt</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_symbol_lookup_date" title="Permalink to this definition"></a></dt>
<dd><p>Set the date for which symbols will be resolved to their assets
(symbols may map to different firms or underlying assets at
different times)</p>
@@ -1245,7 +1246,7 @@ different times)</p>
<dl class="function">
<dt id="catalyst.api.sid">
<code class="descclassname">catalyst.api.</code><code class="descname">sid</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.sid" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">sid</code><span class="sig-paren">(</span><em>self</em>, <em>sid</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.sid" title="Permalink to this definition"></a></dt>
<dd><p>Lookup an Asset by its unique asset identifier.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1281,7 +1282,7 @@ performing as expected. The functions help protect the algorithm from certian
bugs that could cause undesirable behavior when trading with real money.</p>
<dl class="function">
<dt id="catalyst.api.set_do_not_order_list">
<code class="descclassname">catalyst.api.</code><code class="descname">set_do_not_order_list</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_do_not_order_list" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_do_not_order_list</code><span class="sig-paren">(</span><em>self</em>, <em>restricted_list</em>, <em>on_error='fail'</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_do_not_order_list" title="Permalink to this definition"></a></dt>
<dd><p>Set a restriction on which assets can be ordered.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1299,14 +1300,14 @@ bugs that could cause undesirable behavior when trading with real money.</p>
<dl class="function">
<dt id="catalyst.api.set_long_only">
<code class="descclassname">catalyst.api.</code><code class="descname">set_long_only</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_long_only" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_long_only</code><span class="sig-paren">(</span><em>self</em>, <em>on_error='fail'</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_long_only" title="Permalink to this definition"></a></dt>
<dd><p>Set a rule specifying that this algorithm cannot take short
positions.</p>
</dd></dl>
<dl class="function">
<dt id="catalyst.api.set_max_leverage">
<code class="descclassname">catalyst.api.</code><code class="descname">set_max_leverage</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_max_leverage" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_max_leverage</code><span class="sig-paren">(</span><em>self</em>, <em>max_leverage</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_max_leverage" title="Permalink to this definition"></a></dt>
<dd><p>Set a limit on the maximum leverage of the algorithm.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1325,7 +1326,7 @@ be no maximum.</p>
<dl class="function">
<dt id="catalyst.api.set_max_order_count">
<code class="descclassname">catalyst.api.</code><code class="descname">set_max_order_count</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_max_order_count" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_max_order_count</code><span class="sig-paren">(</span><em>self</em>, <em>max_count</em>, <em>on_error='fail'</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_max_order_count" title="Permalink to this definition"></a></dt>
<dd><p>Set a limit on the number of orders that can be placed in a single
day.</p>
<table class="docutils field-list" frame="void" rules="none">
@@ -1344,7 +1345,7 @@ day.</p>
<dl class="function">
<dt id="catalyst.api.set_max_order_size">
<code class="descclassname">catalyst.api.</code><code class="descname">set_max_order_size</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_max_order_size" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_max_order_size</code><span class="sig-paren">(</span><em>self</em>, <em>asset=None</em>, <em>max_shares=None</em>, <em>max_notional=None</em>, <em>on_error='fail'</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_max_order_size" title="Permalink to this definition"></a></dt>
<dd><p>Set a limit on the number of shares and/or dollar value of any single
order placed for sid. Limits are treated as absolute values and are
enforced at the time that the algo attempts to place an order for sid.</p>
@@ -1375,7 +1376,7 @@ asset.</p>
<dl class="function">
<dt id="catalyst.api.set_max_position_size">
<code class="descclassname">catalyst.api.</code><code class="descname">set_max_position_size</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_max_position_size" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_max_position_size</code><span class="sig-paren">(</span><em>self</em>, <em>asset=None</em>, <em>max_shares=None</em>, <em>max_notional=None</em>, <em>on_error='fail'</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_max_position_size" title="Permalink to this definition"></a></dt>
<dd><p>Set a limit on the number of shares and/or dollar value held for the
given sid. Limits are treated as absolute values and are enforced at
the time that the algo attempts to place an order for sid. This means
@@ -1413,7 +1414,7 @@ asset.</p>
<h3>Simulation Parameters<a class="headerlink" href="#simulation-parameters" title="Permalink to this headline"></a></h3>
<dl class="function">
<dt id="catalyst.api.set_benchmark">
<code class="descclassname">catalyst.api.</code><code class="descname">set_benchmark</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_benchmark" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_benchmark</code><span class="sig-paren">(</span><em>self</em>, <em>benchmark</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_benchmark" title="Permalink to this definition"></a></dt>
<dd><p>Set the benchmark asset.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1436,7 +1437,7 @@ automatically reinvested.</p>
<h4>Commission Models<a class="headerlink" href="#commission-models" title="Permalink to this headline"></a></h4>
<dl class="function">
<dt id="catalyst.api.set_commission">
<code class="descclassname">catalyst.api.</code><code class="descname">set_commission</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_commission" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_commission</code><span class="sig-paren">(</span><em>self</em>, <em>maker=None</em>, <em>taker=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_commission" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="class">
@@ -1546,7 +1547,7 @@ an optional minimum cost per trade.</p>
<h4>Slippage Models<a class="headerlink" href="#slippage-models" title="Permalink to this headline"></a></h4>
<dl class="function">
<dt id="catalyst.api.set_slippage">
<code class="descclassname">catalyst.api.</code><code class="descname">set_slippage</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_slippage" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">set_slippage</code><span class="sig-paren">(</span><em>self</em>, <em>spread=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.set_slippage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="class">
@@ -1623,7 +1624,7 @@ multiple bars.</p>
<h3>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Permalink to this headline"></a></h3>
<dl class="function">
<dt id="catalyst.api.record">
<code class="descclassname">catalyst.api.</code><code class="descname">record</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.record" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">record</code><span class="sig-paren">(</span><em>self</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.record" title="Permalink to this definition"></a></dt>
<dd><p>Track and record values each day.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1645,7 +1646,7 @@ dataframe passed to <code class="docutils literal"><span class="pre">analyze</sp
<dl class="function">
<dt id="catalyst.api.get_environment">
<code class="descclassname">catalyst.api.</code><code class="descname">get_environment</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.get_environment" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">get_environment</code><span class="sig-paren">(</span><em>self</em>, <em>field='platform'</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.get_environment" title="Permalink to this definition"></a></dt>
<dd><p>Query the execution environment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1709,7 +1710,7 @@ know if they are running on the Quantopian platform instead.</p>
<dl class="function">
<dt id="catalyst.api.fetch_csv">
<code class="descclassname">catalyst.api.</code><code class="descname">fetch_csv</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.fetch_csv" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.api.</code><code class="descname">fetch_csv</code><span class="sig-paren">(</span><em>self</em>, <em>url</em>, <em>pre_func=None</em>, <em>post_func=None</em>, <em>date_column='date'</em>, <em>date_format=None</em>, <em>timezone='UTC'</em>, <em>symbol=None</em>, <em>mask=True</em>, <em>symbol_column=None</em>, <em>special_params_checker=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.api.fetch_csv" title="Permalink to this definition"></a></dt>
<dd><p>Fetch a csv from a remote url and register the data so that it is
queryable from the <code class="docutils literal"><span class="pre">data</span></code> object.</p>
<table class="docutils field-list" frame="void" rules="none">
@@ -1785,7 +1786,7 @@ information to map the sids in the asset finder.</p>
<h2>Asset Metadata<a class="headerlink" href="#asset-metadata" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="catalyst.assets.Asset">
<em class="property">class </em><code class="descclassname">catalyst.assets.</code><code class="descname">Asset</code><a class="headerlink" href="#catalyst.assets.Asset" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">catalyst.assets.</code><code class="descname">Asset</code><span class="sig-paren">(</span><em>int sid</em>, <em>exchange</em>, <em>symbol=''</em>, <em>asset_name=''</em>, <em>start_date=None</em>, <em>end_date=None</em>, <em>first_traded=None</em>, <em>auto_close_date=None</em>, <em>exchange_full=None</em>, <em>min_trade_size=None</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.assets.Asset" title="Permalink to this definition"></a></dt>
<dd><dl class="attribute">
<dt id="catalyst.assets.Asset.first_traded">
<code class="descname">first_traded</code><a class="headerlink" href="#catalyst.assets.Asset.first_traded" title="Permalink to this definition"></a></dt>
@@ -1860,7 +1861,7 @@ Assets.</p>
<h2>Trading Calendar API<a class="headerlink" href="#trading-calendar-api" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="catalyst.utils.calendars.get_calendar">
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">get_calendar</code><span class="sig-paren">(</span><em>self</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.get_calendar" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">get_calendar</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.get_calendar" title="Permalink to this definition"></a></dt>
<dd><p>Retrieves an instance of an TradingCalendar whose name is given.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1884,7 +1885,7 @@ Assets.</p>
<dl class="class">
<dt id="catalyst.utils.calendars.TradingCalendar">
<em class="property">class </em><code class="descclassname">catalyst.utils.calendars.</code><code class="descname">TradingCalendar</code><span class="sig-paren">(</span><em>start=Timestamp('1990-01-01 00:00:00+0000'</em>, <em>tz='UTC')</em>, <em>end=Timestamp('2019-03-19 17:37:26.475737+0000'</em>, <em>tz='UTC')</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/catalyst/utils/calendars/trading_calendar.html#TradingCalendar"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#catalyst.utils.calendars.TradingCalendar" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">catalyst.utils.calendars.</code><code class="descname">TradingCalendar</code><span class="sig-paren">(</span><em>start=Timestamp('1990-01-01 00:00:00+0000'</em>, <em>tz='UTC')</em>, <em>end=Timestamp('2019-03-22 17:29:08.321479+0000'</em>, <em>tz='UTC')</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/catalyst/utils/calendars/trading_calendar.html#TradingCalendar"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#catalyst.utils.calendars.TradingCalendar" title="Permalink to this definition"></a></dt>
<dd><p>An TradingCalendar represents the timing information of a single market
exchange.</p>
<p>The timing information is made up of two parts: sessions, and opens/closes.</p>
@@ -2507,7 +2508,7 @@ negative).</p>
<dl class="function">
<dt id="catalyst.utils.calendars.register_calendar">
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">register_calendar</code><span class="sig-paren">(</span><em>self</em>, <em>name</em>, <em>calendar</em>, <em>force=False</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.register_calendar" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">register_calendar</code><span class="sig-paren">(</span><em>name</em>, <em>calendar</em>, <em>force=False</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.register_calendar" title="Permalink to this definition"></a></dt>
<dd><p>Registers a calendar for retrieval by the get_calendar method.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -2541,7 +2542,7 @@ Default is False.</p>
<dl class="function">
<dt id="catalyst.utils.calendars.register_calendar_type">
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">register_calendar_type</code><span class="sig-paren">(</span><em>self</em>, <em>name</em>, <em>calendar_type</em>, <em>force=False</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.register_calendar_type" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">register_calendar_type</code><span class="sig-paren">(</span><em>name</em>, <em>calendar_type</em>, <em>force=False</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.register_calendar_type" title="Permalink to this definition"></a></dt>
<dd><p>Registers a calendar by type.</p>
<p>This is useful for registering a new calendar to be lazily instantiated
at some future point in time.</p>
@@ -2577,7 +2578,7 @@ Default is False.</p>
<dl class="function">
<dt id="catalyst.utils.calendars.deregister_calendar">
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">deregister_calendar</code><span class="sig-paren">(</span><em>self</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.deregister_calendar" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">deregister_calendar</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.deregister_calendar" title="Permalink to this definition"></a></dt>
<dd><p>If a calendar is registered with the given name, it is de-registered.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -2595,7 +2596,7 @@ Default is False.</p>
<dl class="function">
<dt id="catalyst.utils.calendars.clear_calendars">
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">clear_calendars</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.clear_calendars" title="Permalink to this definition"></a></dt>
<code class="descclassname">catalyst.utils.calendars.</code><code class="descname">clear_calendars</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#catalyst.utils.calendars.clear_calendars" title="Permalink to this definition"></a></dt>
<dd><p>Deregisters all current registered calendars</p>
</dd></dl>
@@ -2629,14 +2630,14 @@ Default is False.</p>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pandas</span> <span class="kn">import</span> <span class="n">Timestamp</span><span class="p">,</span> <span class="n">Timedelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expires</span> <span class="o">=</span> <span class="n">Timestamp</span><span class="p">(</span><span class="s">&#39;2014&#39;</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="s">&#39;UTC&#39;</span><span class="p">)</span>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pandas</span> <span class="kn">import</span> <span class="n">Timestamp</span><span class="p">,</span> <span class="n">Timedelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expires</span> <span class="o">=</span> <span class="n">Timestamp</span><span class="p">(</span><span class="s1">&#39;2014&#39;</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="s1">&#39;UTC&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">obj</span> <span class="o">=</span> <span class="n">CachedObject</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">expires</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">obj</span><span class="o">.</span><span class="n">unwrap</span><span class="p">(</span><span class="n">expires</span> <span class="o">-</span> <span class="n">Timedelta</span><span class="p">(</span><span class="s">&#39;1 minute&#39;</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">obj</span><span class="o">.</span><span class="n">unwrap</span><span class="p">(</span><span class="n">expires</span> <span class="o">-</span> <span class="n">Timedelta</span><span class="p">(</span><span class="s1">&#39;1 minute&#39;</span><span class="p">))</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">obj</span><span class="o">.</span><span class="n">unwrap</span><span class="p">(</span><span class="n">expires</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">obj</span><span class="o">.</span><span class="n">unwrap</span><span class="p">(</span><span class="n">expires</span> <span class="o">+</span> <span class="n">Timedelta</span><span class="p">(</span><span class="s">&#39;1 minute&#39;</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">obj</span><span class="o">.</span><span class="n">unwrap</span><span class="p">(</span><span class="n">expires</span> <span class="o">+</span> <span class="n">Timedelta</span><span class="p">(</span><span class="s1">&#39;1 minute&#39;</span><span class="p">))</span>
<span class="gp">... </span>
<span class="gt">Traceback (most recent call last):</span>
<span class="o">...</span>
@@ -2665,14 +2666,14 @@ If <cite>None</cite>, than a dict is used as a default.</p>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pandas</span> <span class="kn">import</span> <span class="n">Timestamp</span><span class="p">,</span> <span class="n">Timedelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expires</span> <span class="o">=</span> <span class="n">Timestamp</span><span class="p">(</span><span class="s">&#39;2014&#39;</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="s">&#39;UTC&#39;</span><span class="p">)</span>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pandas</span> <span class="kn">import</span> <span class="n">Timestamp</span><span class="p">,</span> <span class="n">Timedelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expires</span> <span class="o">=</span> <span class="n">Timestamp</span><span class="p">(</span><span class="s1">&#39;2014&#39;</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="s1">&#39;UTC&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">value</span> <span class="o">=</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cache</span> <span class="o">=</span> <span class="n">ExpiringCache</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cache</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">expires</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">,</span> <span class="n">expires</span> <span class="o">-</span> <span class="n">Timedelta</span><span class="p">(</span><span class="s">&#39;1 minute&#39;</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cache</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">expires</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="n">expires</span> <span class="o">-</span> <span class="n">Timedelta</span><span class="p">(</span><span class="s1">&#39;1 minute&#39;</span><span class="p">))</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">,</span> <span class="n">expires</span> <span class="o">+</span> <span class="n">Timedelta</span><span class="p">(</span><span class="s">&#39;1 minute&#39;</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="n">expires</span> <span class="o">+</span> <span class="n">Timedelta</span><span class="p">(</span><span class="s1">&#39;1 minute&#39;</span><span class="p">))</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="o">...</span>
<span class="gr">KeyError</span>: <span class="n">&#39;foo&#39;</span>
@@ -2812,7 +2813,7 @@ meaning it has as strong of guarantees as <code class="xref py py-func docutils
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">maybe_show_progress</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="bp">True</span><span class="p">)</span> <span class="k">as</span> <span class="n">ns</span><span class="p">:</span>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">maybe_show_progress</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="bp">True</span><span class="p">)</span> <span class="k">as</span> <span class="n">ns</span><span class="p">:</span>
<span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">ns</span><span class="p">:</span>
<span class="o">...</span>
</pre></div>
@@ -2824,6 +2825,10 @@ meaning it has as strong of guarantees as <code class="xref py py-func docutils
</div>
</div>
<div class="articleComments">
</div>
</div>
<footer>
@@ -2833,9 +2838,10 @@ meaning it has as strong of guarantees as <code class="xref py py-func docutils
<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>
@@ -2856,7 +2862,8 @@ meaning it has as strong of guarantees as <code class="xref py py-func docutils
VERSION:'0.4',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>