mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-02 01:35:40 +08:00
DOC: updated documentation
This commit is contained in:
+285
-148
@@ -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>
|
||||
|
||||
</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> »</li>
|
||||
|
||||
<li>API Reference</li>
|
||||
|
||||
|
||||
<li><a href="index.html">Docs</a> »</li>
|
||||
|
||||
<li>API Reference</li>
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
|
||||
<a href="_sources/appendix.rst.txt" rel="nofollow"> View page source</a>
|
||||
|
||||
<a href="_sources/appendix.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="api-reference">
|
||||
<h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h1>
|
||||
@@ -205,7 +348,7 @@ once before each trading day (after initialize on the first day).</p>
|
||||
once at the end of the backtest and is passed the context and the
|
||||
performance data.</p>
|
||||
</div></blockquote>
|
||||
<p><strong>data_frequency</strong> : {‘daily’, ‘minute’}, optional</p>
|
||||
<p><strong>data_frequency</strong> : {‘daily’, ‘minute’}, optional</p>
|
||||
<blockquote>
|
||||
<div><p>The data frequency to run the algorithm at.</p>
|
||||
</div></blockquote>
|
||||
@@ -219,7 +362,7 @@ This argument is mutually exclusive with:
|
||||
<p><strong>bundle</strong> : str, optional</p>
|
||||
<blockquote>
|
||||
<div><p>The name of the data bundle to use to load the data to run the backtest
|
||||
with. This defaults to ‘quantopian-quandl’.
|
||||
with. This defaults to ‘quantopian-quandl’.
|
||||
This argument is mutually exclusive with <code class="docutils literal"><span class="pre">data</span></code>.</p>
|
||||
</div></blockquote>
|
||||
<p><strong>bundle_timestamp</strong> : datetime, optional</p>
|
||||
@@ -301,7 +444,7 @@ has recent trade data, etc.</p>
|
||||
<div><p>Function which returns the current simulation time.
|
||||
This is usually bound to a method of TradingSimulation.</p>
|
||||
</div></blockquote>
|
||||
<p><strong>data_frequency</strong> : {‘minute’, ‘daily’}</p>
|
||||
<p><strong>data_frequency</strong> : {‘minute’, ‘daily’}</p>
|
||||
<blockquote>
|
||||
<div><p>The frequency of the bar data; i.e. whether the data is
|
||||
daily or minute bars</p>
|
||||
@@ -313,7 +456,7 @@ multiple sources</p>
|
||||
</div></blockquote>
|
||||
<p><strong>universe_func</strong> : callable, optional</p>
|
||||
<blockquote class="last">
|
||||
<div><p>Function which returns the current ‘universe’. This is for
|
||||
<div><p>Function which returns the current ‘universe’. This is for
|
||||
backwards compatibility with older API concepts.</p>
|
||||
</div></blockquote>
|
||||
</td>
|
||||
@@ -330,10 +473,10 @@ following are true:
|
||||
<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 asset’s exchange is open at the</li>
|
||||
<li>(if we are in minute mode) the asset’s exchange is open at the</li>
|
||||
</ol>
|
||||
<blockquote>
|
||||
<div>current simulation time or at the simulation calendar’s next market
|
||||
<div>current simulation time or at the simulation calendar’s next market
|
||||
minute</div></blockquote>
|
||||
<ol class="arabic simple" start="3">
|
||||
<li>there is a known last price for the asset.</li>
|
||||
@@ -350,10 +493,10 @@ minute</div></blockquote>
|
||||
</table>
|
||||
<p class="rubric">Notes</p>
|
||||
<p>The second condition above warrants some further explanation.
|
||||
- If the asset’s exchange calendar is identical to the simulation
|
||||
- If the asset’s 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 asset’s exchange’s trading hours (for example, if the simulation
|
||||
this asset’s exchange’s 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
|
||||
@@ -374,8 +517,8 @@ notes for more information).</p>
|
||||
<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
|
||||
<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>
|
||||
@@ -402,17 +545,17 @@ 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
|
||||
<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,
|
||||
<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
|
||||
<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
|
||||
<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>
|
||||
@@ -430,18 +573,18 @@ the notes for <cite>get_spot_value</cite>.</p>
|
||||
<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>
|
||||
<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><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>
|
||||
<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>
|
||||
<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
|
||||
@@ -654,8 +797,8 @@ shares.</p>
|
||||
<blockquote>
|
||||
<div><p>If the requested asset exists, the requested value is
|
||||
divided by its price to imply the number of shares to transact.
|
||||
If the Asset being ordered is a Future, the ‘value’ calculated
|
||||
is actually the exposure, as Futures have no ‘value’.</p>
|
||||
If the Asset being ordered is a Future, the ‘value’ calculated
|
||||
is actually the exposure, as Futures have no ‘value’.</p>
|
||||
<p>value > 0 :: Buy/Cover
|
||||
value < 0 :: Sell/Short</p>
|
||||
</div></blockquote>
|
||||
@@ -743,7 +886,7 @@ This is specified as a decimal, for example: 0.50 means 50%.</p>
|
||||
<dt id="catalyst.api.order_target">
|
||||
<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 doesn’t already exist, this is equivalent to placing a new
|
||||
the position doesn’t already exist, this is equivalent to placing a new
|
||||
order. If the position does exist, this is equivalent to placing an
|
||||
order for the difference between the target number of shares and the
|
||||
current number of shares.</p>
|
||||
@@ -788,7 +931,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></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>
|
||||
<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>
|
||||
<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>
|
||||
@@ -803,12 +946,12 @@ call to <code class="docutils literal"><span class="pre">order_target</span></co
|
||||
<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>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 doesn’t already exist, this is equivalent to placing a new
|
||||
the position doesn’t already exist, this is equivalent to placing a new
|
||||
order. If the position does exist, this is equivalent to placing an
|
||||
order for the difference between the target value and the
|
||||
current value.
|
||||
If the Asset being ordered is a Future, the ‘target value’ calculated
|
||||
is actually the target exposure, as Futures have no ‘value’.</p>
|
||||
If the Asset being ordered is a Future, the ‘target value’ calculated
|
||||
is actually the target exposure, as Futures have no ‘value’.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -850,7 +993,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></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>
|
||||
<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>
|
||||
<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>
|
||||
@@ -865,7 +1008,7 @@ second <code class="docutils literal"><span class="pre">order_target_value</span
|
||||
<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>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 doesn’t already exist, this is
|
||||
current portfolio value. If the position doesn’t already exist, this is
|
||||
equivalent to placing a new order. If the position does exist, this is
|
||||
equivalent to placing an order for the difference between the target
|
||||
percent and the current percent.</p>
|
||||
@@ -912,7 +1055,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></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>
|
||||
<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>
|
||||
<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>
|
||||
@@ -1374,7 +1517,7 @@ asset.</p>
|
||||
<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
|
||||
that it’s possible to end up with more than the max number of shares
|
||||
that it’s possible to end up with more than the max number of shares
|
||||
due to splits/dividends, and more than the max notional due to price
|
||||
improvement.</p>
|
||||
<p>If an algorithm attempts to place an order that would result in
|
||||
@@ -1439,7 +1582,7 @@ automatically reinvested.</p>
|
||||
<em class="property">class </em><code class="descclassname">catalyst.finance.commission.</code><code class="descname">CommissionModel</code><a class="reference internal" href="_modules/catalyst/finance/commission.html#CommissionModel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#catalyst.finance.commission.CommissionModel" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Abstract commission model interface.</p>
|
||||
<p>Commission models are responsible for accepting order/transaction pairs and
|
||||
calculating how much commission should be charged to an algorithm’s account
|
||||
calculating how much commission should be charged to an algorithm’s account
|
||||
on each transaction.</p>
|
||||
<dl class="method">
|
||||
<dt id="catalyst.finance.commission.CommissionModel.calculate">
|
||||
@@ -1459,7 +1602,7 @@ amount of commission already charged on this order.</p>
|
||||
<p><strong>transaction</strong> : catalyst.finance.transaction.Transaction</p>
|
||||
<blockquote>
|
||||
<div><p>The transaction being processed. A single order may generate
|
||||
multiple transactions if there isn’t enough volume in a given bar
|
||||
multiple transactions if there isn’t enough volume in a given bar
|
||||
to fill the full amount requested in the order.</p>
|
||||
</div></blockquote>
|
||||
</td>
|
||||
@@ -1646,10 +1789,10 @@ dataframe passed to <code class="docutils literal"><span class="pre">analyze</sp
|
||||
<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>field</strong> : {‘platform’, ‘arena’, ‘data_frequency’,</p>
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>field</strong> : {‘platform’, ‘arena’, ‘data_frequency’,</p>
|
||||
<blockquote>
|
||||
<div><blockquote>
|
||||
<div><p>‘start’, ‘end’, ‘capital_base’, ‘platform’, ‘*’}</p>
|
||||
<div><p>‘start’, ‘end’, ‘capital_base’, ‘platform’, ‘*’}</p>
|
||||
</div></blockquote>
|
||||
<dl class="docutils">
|
||||
<dt>The field to query. The options have the following meanings:</dt>
|
||||
@@ -1659,7 +1802,7 @@ dataframe passed to <code class="docutils literal"><span class="pre">analyze</sp
|
||||
be <code class="docutils literal"><span class="pre">backtest</span></code> but some systems may use this distinguish
|
||||
live trading from backtesting.</p>
|
||||
</dd>
|
||||
<dt>data_frequency <span class="classifier-delimiter">:</span> <span class="classifier">{‘daily’, ‘minute’}</span></dt>
|
||||
<dt>data_frequency <span class="classifier-delimiter">:</span> <span class="classifier">{‘daily’, ‘minute’}</span></dt>
|
||||
<dd><p class="first last">data_frequency tells the algorithm if it is running with
|
||||
daily or minute mode.</p>
|
||||
</dd>
|
||||
@@ -1674,7 +1817,7 @@ daily or minute mode.</p>
|
||||
</dd>
|
||||
<dt>platform <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
|
||||
<dd><p class="first last">The platform that the code is running on. By default this
|
||||
will be the string ‘catalyst’. This can allow algorithms to
|
||||
will be the string ‘catalyst’. This can allow algorithms to
|
||||
know if they are running on the Quantopian platform instead.</p>
|
||||
</dd>
|
||||
<dt>\* <span class="classifier-delimiter">:</span> <span class="classifier">dict[str -> any]</span></dt>
|
||||
@@ -1827,7 +1970,7 @@ information to map the sids in the asset finder.</p>
|
||||
</div></blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">boolean: whether the asset’s exchange is open at the given minute.</p>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">boolean: whether the asset’s exchange is open at the given minute.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -1855,7 +1998,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>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>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>
|
||||
<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" />
|
||||
@@ -1879,7 +2022,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-02-09 07:12:19.610910+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-02-09 17:08:31.919026+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>
|
||||
@@ -1915,7 +2058,7 @@ used for convenience.</p>
|
||||
<dl class="method">
|
||||
<dt id="catalyst.utils.calendars.TradingCalendar.is_session">
|
||||
<code class="descname">is_session</code><span class="sig-paren">(</span><em>dt</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/catalyst/utils/calendars/trading_calendar.html#TradingCalendar.is_session"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#catalyst.utils.calendars.TradingCalendar.is_session" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Given a dt, returns whether it’s a valid session label.</p>
|
||||
<dd><p>Given a dt, returns whether it’s a valid session label.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -1975,11 +2118,11 @@ DatetimeIndex of the corresponding session labels.</p>
|
||||
</div></blockquote>
|
||||
<p><strong>direction: str</strong></p>
|
||||
<blockquote>
|
||||
<div><p>“next” (default) means that if the given dt is not part of a
|
||||
<div><p>“next” (default) means that if the given dt is not part of a
|
||||
session, return the label of the next session.</p>
|
||||
<p>“previous” means that if the given dt is not part of a session,
|
||||
<p>“previous” means that if the given dt is not part of a session,
|
||||
return the label of the previous session.</p>
|
||||
<p>“none” means that a KeyError will be raised if the given
|
||||
<p>“none” means that a KeyError will be raised if the given
|
||||
dt is not part of a session.</p>
|
||||
</div></blockquote>
|
||||
</td>
|
||||
@@ -2031,7 +2174,7 @@ dt is not part of a session.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>session_label: pd.Timestamp (midnight UTC)</strong></p>
|
||||
<blockquote>
|
||||
<div><p>A session label whose session’s minutes are desired.</p>
|
||||
<div><p>A session label whose session’s minutes are desired.</p>
|
||||
</div></blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -2079,7 +2222,7 @@ session label to the given end session label, inclusive.</p>
|
||||
<code class="descname">minutes_in_range</code><span class="sig-paren">(</span><em>start_minute</em>, <em>end_minute</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/catalyst/utils/calendars/trading_calendar.html#TradingCalendar.minutes_in_range"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#catalyst.utils.calendars.TradingCalendar.minutes_in_range" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Given start and end minutes, return all the calendar minutes
|
||||
in that range, inclusive.</p>
|
||||
<p>Given minutes don’t need to be calendar minutes.</p>
|
||||
<p>Given minutes don’t need to be calendar minutes.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -2157,7 +2300,7 @@ an exchange minute, returns the next exchange open.</p>
|
||||
<dt id="catalyst.utils.calendars.TradingCalendar.next_open">
|
||||
<code class="descname">next_open</code><span class="sig-paren">(</span><em>dt</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/catalyst/utils/calendars/trading_calendar.html#TradingCalendar.next_open"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#catalyst.utils.calendars.TradingCalendar.next_open" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Given a dt, returns the next open.</p>
|
||||
<p>If the given dt happens to be a session open, the next session’s open
|
||||
<p>If the given dt happens to be a session open, the next session’s open
|
||||
will be returned.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@@ -2502,7 +2645,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>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>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>
|
||||
<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" />
|
||||
@@ -2526,7 +2669,7 @@ Default is False.</p>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><strong>CalendarNameCollision</strong></p>
|
||||
<blockquote class="last">
|
||||
<div><p>If a calendar is already registered with the given calendar’s name.</p>
|
||||
<div><p>If a calendar is already registered with the given calendar’s name.</p>
|
||||
</div></blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -2536,7 +2679,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>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>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>
|
||||
<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>
|
||||
@@ -2562,7 +2705,7 @@ Default is False.</p>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><strong>CalendarNameCollision</strong></p>
|
||||
<blockquote class="last">
|
||||
<div><p>If a calendar is already registered with the given calendar’s name.</p>
|
||||
<div><p>If a calendar is already registered with the given calendar’s name.</p>
|
||||
</div></blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -2572,7 +2715,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>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>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>
|
||||
<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" />
|
||||
@@ -2590,7 +2733,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><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><em>self</em><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>
|
||||
|
||||
@@ -2624,14 +2767,14 @@ Default is False.</p>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="rubric">Examples</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </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">>>> </span><span class="n">expires</span> <span class="o">=</span> <span class="n">Timestamp</span><span class="p">(</span><span class="s1">'2014'</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="s1">'UTC'</span><span class="p">)</span>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </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">>>> </span><span class="n">expires</span> <span class="o">=</span> <span class="n">Timestamp</span><span class="p">(</span><span class="s">'2014'</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="s">'UTC'</span><span class="p">)</span>
|
||||
<span class="gp">>>> </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">>>> </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">'1 minute'</span><span class="p">))</span>
|
||||
<span class="gp">>>> </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">'1 minute'</span><span class="p">))</span>
|
||||
<span class="go">1</span>
|
||||
<span class="gp">>>> </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">>>> </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">'1 minute'</span><span class="p">))</span>
|
||||
<span class="gp">>>> </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">'1 minute'</span><span class="p">))</span>
|
||||
<span class="gp">... </span>
|
||||
<span class="gt">Traceback (most recent call last):</span>
|
||||
<span class="o">...</span>
|
||||
@@ -2660,14 +2803,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></span><span class="gp">>>> </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">>>> </span><span class="n">expires</span> <span class="o">=</span> <span class="n">Timestamp</span><span class="p">(</span><span class="s1">'2014'</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="s1">'UTC'</span><span class="p">)</span>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </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">>>> </span><span class="n">expires</span> <span class="o">=</span> <span class="n">Timestamp</span><span class="p">(</span><span class="s">'2014'</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="s">'UTC'</span><span class="p">)</span>
|
||||
<span class="gp">>>> </span><span class="n">value</span> <span class="o">=</span> <span class="mi">1</span>
|
||||
<span class="gp">>>> </span><span class="n">cache</span> <span class="o">=</span> <span class="n">ExpiringCache</span><span class="p">()</span>
|
||||
<span class="gp">>>> </span><span class="n">cache</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">'foo'</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">>>> </span><span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'foo'</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">'1 minute'</span><span class="p">))</span>
|
||||
<span class="gp">>>> </span><span class="n">cache</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">'foo'</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">>>> </span><span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'foo'</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">'1 minute'</span><span class="p">))</span>
|
||||
<span class="go">1</span>
|
||||
<span class="gp">>>> </span><span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'foo'</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">'1 minute'</span><span class="p">))</span>
|
||||
<span class="gp">>>> </span><span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'foo'</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">'1 minute'</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">'foo'</span>
|
||||
@@ -2702,7 +2845,7 @@ If not provided no locking will be used.</p>
|
||||
<div><p>Should the directory be cleaned up if an exception is raised in the
|
||||
context manager.</p>
|
||||
</div></blockquote>
|
||||
<p><strong>serialize</strong> : {‘msgpack’, ‘pickle:<n>’}, optional</p>
|
||||
<p><strong>serialize</strong> : {‘msgpack’, ‘pickle:<n>’}, optional</p>
|
||||
<blockquote class="last">
|
||||
<div><p>How should the data be serialized. If <code class="docutils literal"><span class="pre">'pickle'</span></code> is passed, an
|
||||
optional pickle protocol can be passed like: <code class="docutils literal"><span class="pre">'pickle:3'</span></code> which says
|
||||
@@ -2742,8 +2885,8 @@ to a non-temporary location if no exceptions are raised in the context.</p>
|
||||
</table>
|
||||
<p class="rubric">Notes</p>
|
||||
<p>The file is moved on __exit__ if there are no exceptions.
|
||||
<code class="docutils literal"><span class="pre">working_file</span></code> uses <a class="reference external" href="https://docs.python.org/dev/library/shutil.html#shutil.move" title="(in Python v3.8)"><code class="xref py py-func docutils literal"><span class="pre">shutil.move()</span></code></a> to move the actual files,
|
||||
meaning it has as strong of guarantees as <a class="reference external" href="https://docs.python.org/dev/library/shutil.html#shutil.move" title="(in Python v3.8)"><code class="xref py py-func docutils literal"><span class="pre">shutil.move()</span></code></a>.</p>
|
||||
<code class="docutils literal"><span class="pre">working_file</span></code> uses <a class="reference external" href="http://docs.python.org/dev/library/shutil.html#shutil.move" title="(in Python v3.8)"><code class="xref py py-func docutils literal"><span class="pre">shutil.move()</span></code></a> to move the actual files,
|
||||
meaning it has as strong of guarantees as <a class="reference external" href="http://docs.python.org/dev/library/shutil.html#shutil.move" title="(in Python v3.8)"><code class="xref py py-func docutils literal"><span class="pre">shutil.move()</span></code></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
@@ -2807,7 +2950,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></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>
|
||||
<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>
|
||||
<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>
|
||||
@@ -2819,10 +2962,6 @@ meaning it has as strong of guarantees as <code class="xref py py-func docutils
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="articleComments">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
@@ -2832,10 +2971,9 @@ meaning it has as strong of guarantees as <code class="xref py py-func docutils
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© 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,8 +2994,7 @@ 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,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user