Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
In main code sample mention that pandas needs to be installed, fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
erdewit committed Jul 2, 2023
1 parent da40d0e commit d9bce7a
Show file tree
Hide file tree
Showing 18 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ This is a complete script to download historical data:
contract, endDateTime='', durationStr='30 D',
barSizeSetting='1 hour', whatToShow='MIDPOINT', useRTH=True)
# convert to pandas dataframe:
# convert to pandas dataframe (pandas needs to be installed):
df = util.df(bars)
print(df)
Expand Down
16 changes: 8 additions & 8 deletions docs/html/_modules/ib_insync/objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ib_insync.objects &mdash; ib_insync 0.9.74 documentation</title>
<title>ib_insync.objects &mdash; ib_insync 0.9.85 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="canonical" href="https://ib_insync.readthedocs.io_modules/ib_insync/objects.html"/>
Expand Down Expand Up @@ -60,9 +60,9 @@
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="../index.html">Module code</a> &raquo;</li>
<li>ib_insync.objects</li>
<li><a href="../../index.html" class="icon icon-home"></a></li>
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
<li class="breadcrumb-item active">ib_insync.objects</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
Expand Down Expand Up @@ -470,7 +470,7 @@ <h1>Source code for ib_insync.objects</h1><div class="highlight"><pre>


<div class="viewcode-block" id="BarDataList"><a class="viewcode-back" href="../../api.html#ib_insync.objects.BarDataList">[docs]</a><span class="k">class</span> <span class="nc">BarDataList</span><span class="p">(</span><span class="n">List</span><span class="p">[</span><span class="n">BarData</span><span class="p">]):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> List of :class:`.BarData` that also stores all request parameters.</span>

<span class="sd"> Events:</span>
Expand Down Expand Up @@ -502,7 +502,7 @@ <h1>Source code for ib_insync.objects</h1><div class="highlight"><pre>


<div class="viewcode-block" id="RealTimeBarList"><a class="viewcode-back" href="../../api.html#ib_insync.objects.RealTimeBarList">[docs]</a><span class="k">class</span> <span class="nc">RealTimeBarList</span><span class="p">(</span><span class="n">List</span><span class="p">[</span><span class="n">RealTimeBar</span><span class="p">]):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> List of :class:`.RealTimeBar` that also stores all request parameters.</span>

<span class="sd"> Events:</span>
Expand Down Expand Up @@ -530,7 +530,7 @@ <h1>Source code for ib_insync.objects</h1><div class="highlight"><pre>


<div class="viewcode-block" id="ScanDataList"><a class="viewcode-back" href="../../api.html#ib_insync.objects.ScanDataList">[docs]</a><span class="k">class</span> <span class="nc">ScanDataList</span><span class="p">(</span><span class="n">List</span><span class="p">[</span><span class="n">ScanData</span><span class="p">]):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> List of :class:`.ScanData` that also stores all request parameters.</span>

<span class="sd"> Events:</span>
Expand Down Expand Up @@ -565,7 +565,7 @@ <h1>Source code for ib_insync.objects</h1><div class="highlight"><pre>


<div class="viewcode-block" id="FundamentalRatios"><a class="viewcode-back" href="../../api.html#ib_insync.objects.FundamentalRatios">[docs]</a><span class="k">class</span> <span class="nc">FundamentalRatios</span><span class="p">(</span><span class="n">DynamicObject</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> See:</span>
<span class="sd"> https://web.archive.org/web/20200725010343/https://interactivebrokers.github.io/tws-api/fundamental_ratios_tags.html</span>
<span class="sd"> &quot;&quot;&quot;</span>
Expand Down
32 changes: 16 additions & 16 deletions docs/html/_modules/ib_insync/wrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ib_insync.wrapper &mdash; ib_insync 0.9.82 documentation</title>
<title>ib_insync.wrapper &mdash; ib_insync 0.9.85 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="canonical" href="https://ib_insync.readthedocs.io_modules/ib_insync/wrapper.html"/>
Expand Down Expand Up @@ -60,9 +60,9 @@
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="../index.html">Module code</a> &raquo;</li>
<li>ib_insync.wrapper</li>
<li><a href="../../index.html" class="icon icon-home"></a></li>
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
<li class="breadcrumb-item active">ib_insync.wrapper</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
Expand Down Expand Up @@ -105,13 +105,13 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>


<div class="viewcode-block" id="RequestError"><a class="viewcode-back" href="../../api.html#ib_insync.wrapper.RequestError">[docs]</a><span class="k">class</span> <span class="nc">RequestError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Exception to raise when the API reports an error that can be tied to</span>
<span class="sd"> a single request.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">reqId</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">code</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Args:</span>
<span class="sd"> reqId: Original request ID.</span>
<span class="sd"> code: Original error code.</span>
Expand All @@ -124,7 +124,7 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>


<span class="k">class</span> <span class="nc">Wrapper</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Wrapper implementation for use with the IB class.&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Wrapper implementation for use with the IB class.&quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ib</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ib</span> <span class="o">=</span> <span class="n">ib</span>
Expand Down Expand Up @@ -186,7 +186,7 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">setTimeout</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">setEventsDone</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Set all subscription-type events as done.&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Set all subscription-type events as done.&quot;&quot;&quot;</span>
<span class="n">events</span> <span class="o">=</span> <span class="p">[</span><span class="n">ticker</span><span class="o">.</span><span class="n">updateEvent</span> <span class="k">for</span> <span class="n">ticker</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tickers</span><span class="o">.</span><span class="n">values</span><span class="p">()]</span>
<span class="n">events</span> <span class="o">+=</span> <span class="p">[</span><span class="n">sub</span><span class="o">.</span><span class="n">updateEvent</span> <span class="k">for</span> <span class="n">sub</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">reqId2Subscriber</span><span class="o">.</span><span class="n">values</span><span class="p">()]</span>
<span class="k">for</span> <span class="n">trade</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">trades</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
Expand All @@ -206,7 +206,7 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>

<span class="k">def</span> <span class="nf">startReq</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">contract</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">container</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Start a new request and return the future that is associated</span>
<span class="sd"> with the key and container. The container is a list by default.</span>
<span class="sd"> &quot;&quot;&quot;</span>
Expand All @@ -218,7 +218,7 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">future</span>

<span class="k">def</span> <span class="nf">_endReq</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">result</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">success</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Finish the future of corresponding key with the given result.</span>
<span class="sd"> If no result is given then it will be popped of the general results.</span>
<span class="sd"> &quot;&quot;&quot;</span>
Expand All @@ -235,7 +235,7 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>

<span class="k">def</span> <span class="nf">startTicker</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span> <span class="n">reqId</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">contract</span><span class="p">:</span> <span class="n">Contract</span><span class="p">,</span> <span class="n">tickType</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">str</span><span class="p">]):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Start a tick request that has the reqId associated with the contract.</span>
<span class="sd"> Return the ticker.</span>
<span class="sd"> &quot;&quot;&quot;</span>
Expand All @@ -256,12 +256,12 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">reqId</span>

<span class="k">def</span> <span class="nf">startSubscription</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">reqId</span><span class="p">,</span> <span class="n">subscriber</span><span class="p">,</span> <span class="n">contract</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Register a live subscription.&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Register a live subscription.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_reqId2Contract</span><span class="p">[</span><span class="n">reqId</span><span class="p">]</span> <span class="o">=</span> <span class="n">contract</span>
<span class="bp">self</span><span class="o">.</span><span class="n">reqId2Subscriber</span><span class="p">[</span><span class="n">reqId</span><span class="p">]</span> <span class="o">=</span> <span class="n">subscriber</span>

<span class="k">def</span> <span class="nf">endSubscription</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">subscriber</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Unregister a live subscription.&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Unregister a live subscription.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_reqId2Contract</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">subscriber</span><span class="o">.</span><span class="n">reqId</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">reqId2Subscriber</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">subscriber</span><span class="o">.</span><span class="n">reqId</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>

Expand Down Expand Up @@ -416,7 +416,7 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>
<span class="k">def</span> <span class="nf">openOrder</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span> <span class="n">orderId</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">contract</span><span class="p">:</span> <span class="n">Contract</span><span class="p">,</span> <span class="n">order</span><span class="p">:</span> <span class="n">Order</span><span class="p">,</span>
<span class="n">orderState</span><span class="p">:</span> <span class="n">OrderState</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This wrapper is called to:</span>

<span class="sd"> * feed in open orders at startup;</span>
Expand Down Expand Up @@ -526,7 +526,7 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>

<span class="k">def</span> <span class="nf">execDetails</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span> <span class="n">reqId</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">contract</span><span class="p">:</span> <span class="n">Contract</span><span class="p">,</span> <span class="n">execution</span><span class="p">:</span> <span class="n">Execution</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This wrapper handles both live fills and responses to</span>
<span class="sd"> reqExecutions.</span>
<span class="sd"> &quot;&quot;&quot;</span>
Expand Down Expand Up @@ -1175,7 +1175,7 @@ <h1>Source code for ib_insync.wrapper</h1><div class="highlight"><pre>
<span class="n">isWarning</span> <span class="o">=</span> <span class="kc">False</span>

<span class="n">msg</span> <span class="o">=</span> <span class="p">(</span>
<span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="s2">&quot;Warning&quot;</span> <span class="k">if</span> <span class="n">isWarning</span> <span class="k">else</span> <span class="s2">&quot;Error&quot;</span><span class="si">}</span><span class="s1"> &#39;</span>
<span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="s2">&quot;Warning&quot;</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">isWarning</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s2">&quot;Error&quot;</span><span class="si">}</span><span class="s1"> &#39;</span>
<span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="n">errorCode</span><span class="si">}</span><span class="s1">, reqId </span><span class="si">{</span><span class="n">reqId</span><span class="si">}</span><span class="s1">: </span><span class="si">{</span><span class="n">errorString</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="n">contract</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reqId2Contract</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">reqId</span><span class="p">)</span>
<span class="k">if</span> <span class="n">contract</span><span class="p">:</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>Overview: module code</li>
<li><a href="../index.html" class="icon icon-home"></a></li>
<li class="breadcrumb-item active">Overview: module code</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
Expand Down
Loading

0 comments on commit d9bce7a

Please sign in to comment.