Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
abbass2 committed Oct 25, 2023
1 parent c491b08 commit 10e5528
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 134 deletions.
15 changes: 1 addition & 14 deletions apidocs/source/pyqstrat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,6 @@ pyqstrat.optimize module
:show-inheritance:


pyqstrat.plot module
--------------------

.. automodule:: pyqstrat.plot
:members:
:undoc-members:
:show-inheritance:


pyqstrat.evaluator module
-------------------------

Expand Down Expand Up @@ -139,6 +130,7 @@ pyqstrat.strategy_components module
:show-inheritance:
:special-members: __call__, __init__


pyqstrat.interactive_plot module
-------------------------------------

Expand All @@ -149,11 +141,6 @@ pyqstrat.interactive_plot module
:special-members: __call__, __init__







Module contents
---------------

Expand Down
10 changes: 5 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
set -x
find pyqstrat -maxdepth 1 -name '*.ipynb' -exec jup_mini {} \;
#find pyqstrat -maxdepth 1 -name '*.ipynb' -exec jup_mini {} \;
export NO_DISPLAY=1
mypy --ignore-missing-imports pyqstrat/
flake8 --ignore W291,W293,W503,E402,E701,E275,E741 --max-line-length=160 --extend-exclude notebooks pyqstrat/
#mypy --ignore-missing-imports pyqstrat/
#flake8 --ignore W291,W293,W503,E402,E701,E275,E741 --max-line-length=160 --extend-exclude notebooks pyqstrat/
# run notebooks
find pyqstrat/notebooks . -maxdepth 1 -name '*.ipynb' -exec ipython {} \; > /dev/null

#find pyqstrat/notebooks . -maxdepth 1 -name '*.ipynb' -exec ipython {} \; > /dev/null

set -x
# build docs
rm -Rf ./docs/*
sphinx-build ./apidocs/source ./docs/
Expand Down
17 changes: 7 additions & 10 deletions docs/_modules/pyqstrat/optimize.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,24 +228,21 @@ <h1>Source code for pyqstrat.optimize</h1><div class="highlight"><pre>
<span class="n">ylim</span><span class="p">:</span> <span class="nb">tuple</span><span class="p">[</span><span class="nb">float</span><span class="p">,</span> <span class="nb">float</span><span class="p">]</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="n">vertical_spacing</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.05</span><span class="p">,</span>
<span class="n">show</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">go</span><span class="o">.</span><span class="n">Figure</span><span class="p">:</span>
<span class="w"> </span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Creates a 3D plot of the optimization output for plotting 2 parameters and costs.</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;Creates a 3D plot of the optimization output for plotting 2 parameters and costs.</span>
<span class="sd"> </span>
<span class="sd"> Args:</span>
<span class="sd"> x: Name of the parameter to plot on the x axis, corresponding to the same name in the generator.</span>
<span class="sd"> y: Name of the parameter to plot on the y axis, corresponding to the same name in the generator.</span>
<span class="sd"> z: Can be one of:</span>
<span class="sd"> &quot;cost&quot; </span>
<span class="sd"> The name of another cost variable corresponding to the output from the cost function</span>
<span class="sd"> &quot;all&quot;, which creates a subplot for cost plus all other costs</span>
<span class="sd"> z: Can be one of</span>
<span class="sd"> cost, the name of another cost variable corresponding to the output from the cost function</span>
<span class="sd"> all, which creates a subplot for cost plus all other costs</span>
<span class="sd"> markers: If set, we show actual datapoints on the graph</span>
<span class="sd"> filter_func: A function that can be used to reduce the dataset before plotting.</span>
<span class="sd"> For example, you may want to filter on a dimension beyond x, y, z to pick a single value</span>
<span class="sd"> from that dimension</span>
<span class="sd"> marker: Adds a marker to each point in x, y, z to show the actual data used for interpolation. You can set this to None to turn markers off.</span>
<span class="sd"> vertical_spacing: Vertical space between subplots</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="sd"> marker: Adds a marker to each point in x, y, z to show the actual data used for interpolation. You can set this to None to turn markers off.</span>
<span class="sd"> vertical_spacing: Vertical space between subplots </span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">experiments</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">_logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s1">&#39;No experiments found&#39;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">go</span><span class="o">.</span><span class="n">Figure</span><span class="p">()</span>
Expand Down
1 change: 1 addition & 0 deletions docs/_modules/pyqstrat/pq_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ <h1>Source code for pyqstrat.pq_types</h1><div class="highlight"><pre>
<span class="k">class</span> <span class="nc">StopLimitOrder</span><span class="p">(</span><span class="n">Order</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;Used for stop loss or stop limit orders. The order is triggered when price goes above or below trigger price, depending on whether this is a short</span>
<span class="sd"> or long order. Becomes either a market or limit order at that point, depending on whether you set the limit price or not.</span>
<span class="sd"> </span>
<span class="sd"> Args:</span>
<span class="sd"> trigger_price: Order becomes a market or limit order if price crosses trigger_price.</span>
<span class="sd"> limit_price: If not set (default), order becomes a market order when price crosses trigger price. </span>
Expand Down
1 change: 1 addition & 0 deletions docs/_modules/pyqstrat/strategy_builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ <h1>Source code for pyqstrat.strategy_builder</h1><div class="highlight"><pre>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> A helper class that makes it easier to build simpler strategies by removing the need for a lot of boilerplate code.</span>
<span class="sd"> The __call__ member function returns a Strategy built by this class that can then be run and evaluated.</span>
<span class="sd"> </span>
<span class="sd"> Args:</span>
<span class="sd"> data: A pandas dataframe containing columns for timestamps, indicators and signals</span>
<span class="sd"> timestamps: The &#39;&#39;heartbeat&#39;&#39; of the strategy. A vector of each relevant time for this strategy </span>
Expand Down
5 changes: 5 additions & 0 deletions docs/_modules/pyqstrat/strategy_components.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ <h1>Source code for pyqstrat.strategy_components</h1><div class="highlight"><pre
<span class="w"> </span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> A function object with a signature of PriceFunctionType and takes a dictionary of </span>
<span class="sd"> contract name -&gt; tuple of sorted timestamps and prices</span>
<span class="sd"> </span>
<span class="sd"> &gt;&gt;&gt; timestamps = np.arange(np.datetime64(&#39;2023-01-01&#39;), np.datetime64(&#39;2023-01-04&#39;))</span>
<span class="sd"> &gt;&gt;&gt; price_dict = {&#39;AAPL&#39;: (timestamps, [8, 9, 10]), &#39;IBM&#39;: (timestamps, [20, 21, 22])}</span>
<span class="sd"> &gt;&gt;&gt; pricefunc = PriceFuncArrayDict(price_dict)</span>
Expand Down Expand Up @@ -304,6 +305,7 @@ <h1>Source code for pyqstrat.strategy_components</h1><div class="highlight"><pre
<span class="k">class</span> <span class="nc">PercentOfEquityTradingRule</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> A rule that trades a percentage of equity.</span>
<span class="sd"> </span>
<span class="sd"> Args:</span>
<span class="sd"> reason_code: Reason for entering the order, used for display</span>
<span class="sd"> equity_percent: Percentage of equity used to size order</span>
Expand Down Expand Up @@ -374,6 +376,7 @@ <h1>Source code for pyqstrat.strategy_components</h1><div class="highlight"><pre
<span class="k">class</span> <span class="nc">VWAPEntryRule</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> A rule that generates VWAP orders</span>
<span class="sd"> </span>
<span class="sd"> Args:</span>
<span class="sd"> reason_code: Reason for each order. For display purposes</span>
<span class="sd"> vwap_minutes: How long the vwap period is. For example, a 5 minute vwap order will execute at 5 minute vwap </span>
Expand Down Expand Up @@ -621,6 +624,7 @@ <h1>Source code for pyqstrat.strategy_components</h1><div class="highlight"><pre
<span class="k">class</span> <span class="nc">FiniteRiskEntryRule</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> A rule that generates orders with stops</span>
<span class="sd"> </span>
<span class="sd"> Args:</span>
<span class="sd"> reason_code: Reason for the orders created used for display</span>
<span class="sd"> price_func: A function that returns price given a contract and timestamp</span>
Expand Down Expand Up @@ -712,6 +716,7 @@ <h1>Source code for pyqstrat.strategy_components</h1><div class="highlight"><pre
<span class="k">class</span> <span class="nc">ClosePositionExitRule</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> A rule to close out an open position</span>
<span class="sd"> </span>
<span class="sd"> Args:</span>
<span class="sd"> reason_code: the reason for closing out used for display purposes</span>
<span class="sd"> price_func: the function this rule uses to get market prices</span>
Expand Down
15 changes: 1 addition & 14 deletions docs/_sources/pyqstrat.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,6 @@ pyqstrat.optimize module
:show-inheritance:


pyqstrat.plot module
--------------------

.. automodule:: pyqstrat.plot
:members:
:undoc-members:
:show-inheritance:


pyqstrat.evaluator module
-------------------------

Expand Down Expand Up @@ -139,6 +130,7 @@ pyqstrat.strategy_components module
:show-inheritance:
:special-members: __call__, __init__


pyqstrat.interactive_plot module
-------------------------------------

Expand All @@ -149,11 +141,6 @@ pyqstrat.interactive_plot module
:special-members: __call__, __init__







Module contents
---------------

Expand Down
1 change: 0 additions & 1 deletion docs/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ <h1>pyqstrat<a class="headerlink" href="#pyqstrat" title="Link to this heading">
<li class="toctree-l3"><a class="reference internal" href="pyqstrat.html#pyqstrat.optimize.test_optimize"><code class="docutils literal notranslate"><span class="pre">test_optimize()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="pyqstrat.html#pyqstrat-plot-module">pyqstrat.plot module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyqstrat.html#module-pyqstrat.evaluator">pyqstrat.evaluator module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="pyqstrat.html#pyqstrat.evaluator.Evaluator"><code class="docutils literal notranslate"><span class="pre">Evaluator</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="pyqstrat.html#pyqstrat.evaluator.Evaluator.__init__"><code class="docutils literal notranslate"><span class="pre">Evaluator.__init__()</span></code></a></li>
Expand Down
Loading

0 comments on commit 10e5528

Please sign in to comment.