ib_async 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ib_async-1.0.0/LICENSE +26 -0
- ib_async-1.0.0/PKG-INFO +182 -0
- ib_async-1.0.0/README.md +154 -0
- ib_async-1.0.0/ib_async/__init__.py +219 -0
- ib_async-1.0.0/ib_async/client.py +1143 -0
- ib_async-1.0.0/ib_async/connection.py +61 -0
- ib_async-1.0.0/ib_async/contract.py +612 -0
- ib_async-1.0.0/ib_async/decoder.py +1363 -0
- ib_async-1.0.0/ib_async/flexreport.py +128 -0
- ib_async-1.0.0/ib_async/ib.py +2513 -0
- ib_async-1.0.0/ib_async/ibcontroller.py +372 -0
- ib_async-1.0.0/ib_async/objects.py +499 -0
- ib_async-1.0.0/ib_async/order.py +434 -0
- ib_async-1.0.0/ib_async/py.typed +0 -0
- ib_async-1.0.0/ib_async/ticker.py +375 -0
- ib_async-1.0.0/ib_async/util.py +576 -0
- ib_async-1.0.0/ib_async/version.py +4 -0
- ib_async-1.0.0/ib_async/wrapper.py +1497 -0
- ib_async-1.0.0/pyproject.toml +56 -0
ib_async-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 - 2023, Ewald de Wit
|
|
4
|
+
Copyright (c) 2024, Matt Stancliff
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
Redistribution and use in source and binary forms, with or without
|
|
8
|
+
modification, are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
11
|
+
list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
and/or other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
18
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
ib_async-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ib_async
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python sync/async framework for Interactive Brokers API
|
|
5
|
+
Home-page: https://github.com/ib-api-reloaded/ib_async
|
|
6
|
+
License: BSD
|
|
7
|
+
Keywords: ibapi,tws,asyncio,jupyter,interactive,brokers,async,ib_insync
|
|
8
|
+
Author: Ewald de Wit
|
|
9
|
+
Maintainer: Matt Stancliff
|
|
10
|
+
Maintainer-email: matt@matt.sh
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
15
|
+
Classifier: License :: Other/Proprietary License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
22
|
+
Requires-Dist: eventkit
|
|
23
|
+
Requires-Dist: nest_asyncio
|
|
24
|
+
Project-URL: Bug Tracker, https://github.com/ib-api-reloaded/ib_async/issues
|
|
25
|
+
Project-URL: Repository, https://github.com/ib-api-reloaded/ib_async
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
[](https://github.com/ib-api-reloaded/ib_async/actions) [](#) <!-- [](#) --> [](https://pypi.python.org/pypi/ib_async) [](#) <!-- [](https://pepy.tech/project/ib-insync) --> [](https://ib-api-reloaded.github.io/ib_async/)
|
|
29
|
+
|
|
30
|
+
# ib_async
|
|
31
|
+
|
|
32
|
+
## Update
|
|
33
|
+
|
|
34
|
+
Under new management. See [original discussions](https://github.com/mattsta/ib_insync/discussions) for recent history. Create new discussions or PRs or issues under [the new primary repo](https://github.com/ib-api-reloaded/ib_async) for ongoing updates.
|
|
35
|
+
|
|
36
|
+
New contributions welcome. We are open to adding more maintainers with commit access if your updates and understanding of IBKR/TWS and Python are all high quality.
|
|
37
|
+
|
|
38
|
+
This is a small project with a userbase of widely varying experience and knowledge, so if you open issues which are more about IBKR problems and less about client problems, we may not be able to assist you unless your problem is a direct client issue and not one of many IBKR API edge cases. Feel free to open [Discussion topics](https://github.com/ib-api-reloaded/ib_async/discussions) about anything if you are unsure about a problem being IBKR, our client, or your own code usage.
|
|
39
|
+
|
|
40
|
+
## Introduction
|
|
41
|
+
|
|
42
|
+
The goal of the `ib_async` library is to make working with the
|
|
43
|
+
[Trader Workstation API](https://ibkrcampus.com/ibkr-api-page/twsapi-doc/)
|
|
44
|
+
from Interactive Brokers as easy as possible.
|
|
45
|
+
|
|
46
|
+
The main features are:
|
|
47
|
+
|
|
48
|
+
* An easy to use linear style of programming;
|
|
49
|
+
* An [IB component](https://ib-api-reloaded.github.io/ib_async/api.html#module-ib_async.ib)
|
|
50
|
+
that automatically keeps in sync with the TWS or IB Gateway application;
|
|
51
|
+
* A fully asynchonous framework based on
|
|
52
|
+
[asyncio](https://docs.python.org/3/library/asyncio.html)
|
|
53
|
+
and
|
|
54
|
+
[eventkit](https://github.com/erdewit/eventkit)
|
|
55
|
+
for advanced users;
|
|
56
|
+
* Interactive operation with live data in Jupyter notebooks.
|
|
57
|
+
|
|
58
|
+
Be sure to take a look at the
|
|
59
|
+
[notebooks](https://ib-api-reloaded.github.io/ib_async/notebooks.html),
|
|
60
|
+
the [recipes](https://ib-api-reloaded.github.io/ib_async/recipes.html)
|
|
61
|
+
and the [API docs](https://ib-api-reloaded.github.io/ib_async/api.html).
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
pip install ib_async
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Requirements:
|
|
71
|
+
|
|
72
|
+
- Python 3.10 or higher
|
|
73
|
+
- We plan to support Python releases [2 years back](https://devguide.python.org/versions/) which allows us to continue adding newer features and performance improvements over time.
|
|
74
|
+
- A running IB Gateway application (or TWS with API mode enabled)
|
|
75
|
+
- [stable gateway](https://www.interactivebrokers.com/en/trading/ibgateway-stable.php) — updated every few months
|
|
76
|
+
- [latest gateway](https://www.interactivebrokers.com/en/trading/ibgateway-latest.php) — updated weekly
|
|
77
|
+
- Make sure the [API port is enabled](https://ibkrcampus.com/ibkr-api-page/twsapi-doc/#tws-download) and 'Download open orders on connection' is checked.
|
|
78
|
+
- You may also want to increase the Java memory usage under `Configure->Settings->Memory Allocation` to 4096 MB minimum to prevent gateway crashes when loading bulk data.
|
|
79
|
+
|
|
80
|
+
The ibapi package from IB is not needed. `ib_async` implements the full IBKR API protocol internally.
|
|
81
|
+
|
|
82
|
+
## Build Manually
|
|
83
|
+
|
|
84
|
+
First, install poetry:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
pip install poetry -U
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Installing Only Library
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
poetry install
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Install Everything (enable docs + dev testing)
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
poetry install --with=docs,dev
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Generate Docs
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
poetry install --with=docs
|
|
106
|
+
poetry run sphinx-build -b html docs html
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Check Types
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
poetry run mypy ib_async
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Build Package
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
poetry build
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Upload Package (if maintaining)
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
poetry install
|
|
125
|
+
poetry config pypi-token.pypi your-api-token
|
|
126
|
+
poetry publish --build
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Example
|
|
130
|
+
|
|
131
|
+
This is a complete script to download historical data:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from ib_async import *
|
|
135
|
+
# util.startLoop() # uncomment this line when in a notebook
|
|
136
|
+
|
|
137
|
+
ib = IB()
|
|
138
|
+
ib.connect('127.0.0.1', 7497, clientId=1)
|
|
139
|
+
|
|
140
|
+
contract = Forex('EURUSD')
|
|
141
|
+
bars = ib.reqHistoricalData(
|
|
142
|
+
contract, endDateTime='', durationStr='30 D',
|
|
143
|
+
barSizeSetting='1 hour', whatToShow='MIDPOINT', useRTH=True)
|
|
144
|
+
|
|
145
|
+
# convert to pandas dataframe (pandas needs to be installed):
|
|
146
|
+
df = util.df(bars)
|
|
147
|
+
print(df)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Output:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
date open high low close volume
|
|
154
|
+
0 2019-11-19 23:15:00 1.107875 1.108050 1.107725 1.107825 -1
|
|
155
|
+
1 2019-11-20 00:00:00 1.107825 1.107925 1.107675 1.107825 -1
|
|
156
|
+
2 2019-11-20 01:00:00 1.107825 1.107975 1.107675 1.107875 -1
|
|
157
|
+
3 2019-11-20 02:00:00 1.107875 1.107975 1.107025 1.107225 -1
|
|
158
|
+
4 2019-11-20 03:00:00 1.107225 1.107725 1.107025 1.107525 -1
|
|
159
|
+
.. ... ... ... ... ... ...
|
|
160
|
+
705 2020-01-02 14:00:00 1.119325 1.119675 1.119075 1.119225 -1
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Documentation
|
|
164
|
+
|
|
165
|
+
The complete [API documentation](https://ib-api-reloaded.github.io/ib_async/api.html).
|
|
166
|
+
|
|
167
|
+
[Changelog](https://ib-api-reloaded.github.io/ib_async/changelog.html).
|
|
168
|
+
|
|
169
|
+
## Disclaimer
|
|
170
|
+
|
|
171
|
+
The software is provided on the conditions of the simplified BSD license.
|
|
172
|
+
|
|
173
|
+
This project is not affiliated with Interactive Brokers Group, Inc.
|
|
174
|
+
|
|
175
|
+
[Official Interactive Brokers API Docs](https://ibkrcampus.com/ibkr-api-page/twsapi-doc/)
|
|
176
|
+
|
|
177
|
+
## History
|
|
178
|
+
|
|
179
|
+
This library was originally created by [Ewald de Wit](https://github.com/erdewit) as [`tws_async` in early-2017](https://github.com/erdewit/tws_async) then became the more prominent [`ib_insync` library in mid-2017](https://github.com/erdewit/ib_insync). He maintained and improved the library for the world to use for free until his unexpected passing in early 2024. Afterward, we decided to rename the project to `ib_async` under a new github organization since we lost access to modify anything in the original repos and packaging and docs infrastructure.
|
|
180
|
+
|
|
181
|
+
The library is currently maintained by [Matt Stancliff](https://github.com/mattsta) and we are open to adding more committers and org contributors if people show interest in helping out.
|
|
182
|
+
|
ib_async-1.0.0/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
[](https://github.com/ib-api-reloaded/ib_async/actions) [](#) <!-- [](#) --> [](https://pypi.python.org/pypi/ib_async) [](#) <!-- [](https://pepy.tech/project/ib-insync) --> [](https://ib-api-reloaded.github.io/ib_async/)
|
|
2
|
+
|
|
3
|
+
# ib_async
|
|
4
|
+
|
|
5
|
+
## Update
|
|
6
|
+
|
|
7
|
+
Under new management. See [original discussions](https://github.com/mattsta/ib_insync/discussions) for recent history. Create new discussions or PRs or issues under [the new primary repo](https://github.com/ib-api-reloaded/ib_async) for ongoing updates.
|
|
8
|
+
|
|
9
|
+
New contributions welcome. We are open to adding more maintainers with commit access if your updates and understanding of IBKR/TWS and Python are all high quality.
|
|
10
|
+
|
|
11
|
+
This is a small project with a userbase of widely varying experience and knowledge, so if you open issues which are more about IBKR problems and less about client problems, we may not be able to assist you unless your problem is a direct client issue and not one of many IBKR API edge cases. Feel free to open [Discussion topics](https://github.com/ib-api-reloaded/ib_async/discussions) about anything if you are unsure about a problem being IBKR, our client, or your own code usage.
|
|
12
|
+
|
|
13
|
+
## Introduction
|
|
14
|
+
|
|
15
|
+
The goal of the `ib_async` library is to make working with the
|
|
16
|
+
[Trader Workstation API](https://ibkrcampus.com/ibkr-api-page/twsapi-doc/)
|
|
17
|
+
from Interactive Brokers as easy as possible.
|
|
18
|
+
|
|
19
|
+
The main features are:
|
|
20
|
+
|
|
21
|
+
* An easy to use linear style of programming;
|
|
22
|
+
* An [IB component](https://ib-api-reloaded.github.io/ib_async/api.html#module-ib_async.ib)
|
|
23
|
+
that automatically keeps in sync with the TWS or IB Gateway application;
|
|
24
|
+
* A fully asynchonous framework based on
|
|
25
|
+
[asyncio](https://docs.python.org/3/library/asyncio.html)
|
|
26
|
+
and
|
|
27
|
+
[eventkit](https://github.com/erdewit/eventkit)
|
|
28
|
+
for advanced users;
|
|
29
|
+
* Interactive operation with live data in Jupyter notebooks.
|
|
30
|
+
|
|
31
|
+
Be sure to take a look at the
|
|
32
|
+
[notebooks](https://ib-api-reloaded.github.io/ib_async/notebooks.html),
|
|
33
|
+
the [recipes](https://ib-api-reloaded.github.io/ib_async/recipes.html)
|
|
34
|
+
and the [API docs](https://ib-api-reloaded.github.io/ib_async/api.html).
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
pip install ib_async
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Requirements:
|
|
44
|
+
|
|
45
|
+
- Python 3.10 or higher
|
|
46
|
+
- We plan to support Python releases [2 years back](https://devguide.python.org/versions/) which allows us to continue adding newer features and performance improvements over time.
|
|
47
|
+
- A running IB Gateway application (or TWS with API mode enabled)
|
|
48
|
+
- [stable gateway](https://www.interactivebrokers.com/en/trading/ibgateway-stable.php) — updated every few months
|
|
49
|
+
- [latest gateway](https://www.interactivebrokers.com/en/trading/ibgateway-latest.php) — updated weekly
|
|
50
|
+
- Make sure the [API port is enabled](https://ibkrcampus.com/ibkr-api-page/twsapi-doc/#tws-download) and 'Download open orders on connection' is checked.
|
|
51
|
+
- You may also want to increase the Java memory usage under `Configure->Settings->Memory Allocation` to 4096 MB minimum to prevent gateway crashes when loading bulk data.
|
|
52
|
+
|
|
53
|
+
The ibapi package from IB is not needed. `ib_async` implements the full IBKR API protocol internally.
|
|
54
|
+
|
|
55
|
+
## Build Manually
|
|
56
|
+
|
|
57
|
+
First, install poetry:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
pip install poetry -U
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Installing Only Library
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
poetry install
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Install Everything (enable docs + dev testing)
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
poetry install --with=docs,dev
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Generate Docs
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
poetry install --with=docs
|
|
79
|
+
poetry run sphinx-build -b html docs html
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Check Types
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
poetry run mypy ib_async
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Build Package
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
poetry build
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Upload Package (if maintaining)
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
poetry install
|
|
98
|
+
poetry config pypi-token.pypi your-api-token
|
|
99
|
+
poetry publish --build
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Example
|
|
103
|
+
|
|
104
|
+
This is a complete script to download historical data:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from ib_async import *
|
|
108
|
+
# util.startLoop() # uncomment this line when in a notebook
|
|
109
|
+
|
|
110
|
+
ib = IB()
|
|
111
|
+
ib.connect('127.0.0.1', 7497, clientId=1)
|
|
112
|
+
|
|
113
|
+
contract = Forex('EURUSD')
|
|
114
|
+
bars = ib.reqHistoricalData(
|
|
115
|
+
contract, endDateTime='', durationStr='30 D',
|
|
116
|
+
barSizeSetting='1 hour', whatToShow='MIDPOINT', useRTH=True)
|
|
117
|
+
|
|
118
|
+
# convert to pandas dataframe (pandas needs to be installed):
|
|
119
|
+
df = util.df(bars)
|
|
120
|
+
print(df)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Output:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
date open high low close volume
|
|
127
|
+
0 2019-11-19 23:15:00 1.107875 1.108050 1.107725 1.107825 -1
|
|
128
|
+
1 2019-11-20 00:00:00 1.107825 1.107925 1.107675 1.107825 -1
|
|
129
|
+
2 2019-11-20 01:00:00 1.107825 1.107975 1.107675 1.107875 -1
|
|
130
|
+
3 2019-11-20 02:00:00 1.107875 1.107975 1.107025 1.107225 -1
|
|
131
|
+
4 2019-11-20 03:00:00 1.107225 1.107725 1.107025 1.107525 -1
|
|
132
|
+
.. ... ... ... ... ... ...
|
|
133
|
+
705 2020-01-02 14:00:00 1.119325 1.119675 1.119075 1.119225 -1
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Documentation
|
|
137
|
+
|
|
138
|
+
The complete [API documentation](https://ib-api-reloaded.github.io/ib_async/api.html).
|
|
139
|
+
|
|
140
|
+
[Changelog](https://ib-api-reloaded.github.io/ib_async/changelog.html).
|
|
141
|
+
|
|
142
|
+
## Disclaimer
|
|
143
|
+
|
|
144
|
+
The software is provided on the conditions of the simplified BSD license.
|
|
145
|
+
|
|
146
|
+
This project is not affiliated with Interactive Brokers Group, Inc.
|
|
147
|
+
|
|
148
|
+
[Official Interactive Brokers API Docs](https://ibkrcampus.com/ibkr-api-page/twsapi-doc/)
|
|
149
|
+
|
|
150
|
+
## History
|
|
151
|
+
|
|
152
|
+
This library was originally created by [Ewald de Wit](https://github.com/erdewit) as [`tws_async` in early-2017](https://github.com/erdewit/tws_async) then became the more prominent [`ib_insync` library in mid-2017](https://github.com/erdewit/ib_insync). He maintained and improved the library for the world to use for free until his unexpected passing in early 2024. Afterward, we decided to rename the project to `ib_async` under a new github organization since we lost access to modify anything in the original repos and packaging and docs infrastructure.
|
|
153
|
+
|
|
154
|
+
The library is currently maintained by [Matt Stancliff](https://github.com/mattsta) and we are open to adding more committers and org contributors if people show interest in helping out.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"""Python sync/async framework for Interactive Brokers API"""
|
|
2
|
+
|
|
3
|
+
import dataclasses
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from eventkit import Event
|
|
7
|
+
|
|
8
|
+
from . import util
|
|
9
|
+
from .client import Client
|
|
10
|
+
from .contract import (
|
|
11
|
+
Bag,
|
|
12
|
+
Bond,
|
|
13
|
+
CFD,
|
|
14
|
+
ComboLeg,
|
|
15
|
+
Commodity,
|
|
16
|
+
ContFuture,
|
|
17
|
+
Contract,
|
|
18
|
+
ContractDescription,
|
|
19
|
+
ContractDetails,
|
|
20
|
+
Crypto,
|
|
21
|
+
DeltaNeutralContract,
|
|
22
|
+
Forex,
|
|
23
|
+
Future,
|
|
24
|
+
FuturesOption,
|
|
25
|
+
Index,
|
|
26
|
+
MutualFund,
|
|
27
|
+
Option,
|
|
28
|
+
ScanData,
|
|
29
|
+
Stock,
|
|
30
|
+
TagValue,
|
|
31
|
+
Warrant,
|
|
32
|
+
)
|
|
33
|
+
from .flexreport import FlexError, FlexReport
|
|
34
|
+
from .ib import IB
|
|
35
|
+
from .ibcontroller import IBC, Watchdog
|
|
36
|
+
from .objects import (
|
|
37
|
+
AccountValue,
|
|
38
|
+
BarData,
|
|
39
|
+
BarDataList,
|
|
40
|
+
CommissionReport,
|
|
41
|
+
ConnectionStats,
|
|
42
|
+
DOMLevel,
|
|
43
|
+
DepthMktDataDescription,
|
|
44
|
+
Dividends,
|
|
45
|
+
Execution,
|
|
46
|
+
ExecutionFilter,
|
|
47
|
+
FamilyCode,
|
|
48
|
+
Fill,
|
|
49
|
+
FundamentalRatios,
|
|
50
|
+
HistogramData,
|
|
51
|
+
HistoricalNews,
|
|
52
|
+
HistoricalSchedule,
|
|
53
|
+
HistoricalSession,
|
|
54
|
+
HistoricalTick,
|
|
55
|
+
HistoricalTickBidAsk,
|
|
56
|
+
HistoricalTickLast,
|
|
57
|
+
MktDepthData,
|
|
58
|
+
NewsArticle,
|
|
59
|
+
NewsBulletin,
|
|
60
|
+
NewsProvider,
|
|
61
|
+
NewsTick,
|
|
62
|
+
OptionChain,
|
|
63
|
+
OptionComputation,
|
|
64
|
+
PnL,
|
|
65
|
+
PnLSingle,
|
|
66
|
+
PortfolioItem,
|
|
67
|
+
Position,
|
|
68
|
+
PriceIncrement,
|
|
69
|
+
RealTimeBar,
|
|
70
|
+
RealTimeBarList,
|
|
71
|
+
ScanDataList,
|
|
72
|
+
ScannerSubscription,
|
|
73
|
+
SmartComponent,
|
|
74
|
+
SoftDollarTier,
|
|
75
|
+
TickAttrib,
|
|
76
|
+
TickAttribBidAsk,
|
|
77
|
+
TickAttribLast,
|
|
78
|
+
TickByTickAllLast,
|
|
79
|
+
TickByTickBidAsk,
|
|
80
|
+
TickByTickMidPoint,
|
|
81
|
+
TickData,
|
|
82
|
+
TradeLogEntry,
|
|
83
|
+
WshEventData,
|
|
84
|
+
)
|
|
85
|
+
from .order import (
|
|
86
|
+
BracketOrder,
|
|
87
|
+
ExecutionCondition,
|
|
88
|
+
LimitOrder,
|
|
89
|
+
MarginCondition,
|
|
90
|
+
MarketOrder,
|
|
91
|
+
Order,
|
|
92
|
+
OrderComboLeg,
|
|
93
|
+
OrderCondition,
|
|
94
|
+
OrderState,
|
|
95
|
+
OrderStatus,
|
|
96
|
+
PercentChangeCondition,
|
|
97
|
+
PriceCondition,
|
|
98
|
+
StopLimitOrder,
|
|
99
|
+
StopOrder,
|
|
100
|
+
TimeCondition,
|
|
101
|
+
Trade,
|
|
102
|
+
VolumeCondition,
|
|
103
|
+
)
|
|
104
|
+
from .ticker import Ticker
|
|
105
|
+
from .version import __version__, __version_info__
|
|
106
|
+
from .wrapper import RequestError, Wrapper
|
|
107
|
+
|
|
108
|
+
__all__ = [
|
|
109
|
+
"Event",
|
|
110
|
+
"util",
|
|
111
|
+
"Client",
|
|
112
|
+
"Bag",
|
|
113
|
+
"Bond",
|
|
114
|
+
"CFD",
|
|
115
|
+
"ComboLeg",
|
|
116
|
+
"Commodity",
|
|
117
|
+
"ContFuture",
|
|
118
|
+
"Contract",
|
|
119
|
+
"ContractDescription",
|
|
120
|
+
"ContractDetails",
|
|
121
|
+
"Crypto",
|
|
122
|
+
"DeltaNeutralContract",
|
|
123
|
+
"Forex",
|
|
124
|
+
"Future",
|
|
125
|
+
"FuturesOption",
|
|
126
|
+
"Index",
|
|
127
|
+
"MutualFund",
|
|
128
|
+
"Option",
|
|
129
|
+
"ScanData",
|
|
130
|
+
"Stock",
|
|
131
|
+
"TagValue",
|
|
132
|
+
"Warrant",
|
|
133
|
+
"FlexError",
|
|
134
|
+
"FlexReport",
|
|
135
|
+
"IB",
|
|
136
|
+
"IBC",
|
|
137
|
+
"Watchdog",
|
|
138
|
+
"AccountValue",
|
|
139
|
+
"BarData",
|
|
140
|
+
"BarDataList",
|
|
141
|
+
"CommissionReport",
|
|
142
|
+
"ConnectionStats",
|
|
143
|
+
"DOMLevel",
|
|
144
|
+
"DepthMktDataDescription",
|
|
145
|
+
"Dividends",
|
|
146
|
+
"Execution",
|
|
147
|
+
"ExecutionFilter",
|
|
148
|
+
"FamilyCode",
|
|
149
|
+
"Fill",
|
|
150
|
+
"FundamentalRatios",
|
|
151
|
+
"HistogramData",
|
|
152
|
+
"HistoricalNews",
|
|
153
|
+
"HistoricalTick",
|
|
154
|
+
"HistoricalTickBidAsk",
|
|
155
|
+
"HistoricalTickLast",
|
|
156
|
+
"HistoricalSchedule",
|
|
157
|
+
"HistoricalSession",
|
|
158
|
+
"MktDepthData",
|
|
159
|
+
"NewsArticle",
|
|
160
|
+
"NewsBulletin",
|
|
161
|
+
"NewsProvider",
|
|
162
|
+
"NewsTick",
|
|
163
|
+
"OptionChain",
|
|
164
|
+
"OptionComputation",
|
|
165
|
+
"PnL",
|
|
166
|
+
"PnLSingle",
|
|
167
|
+
"PortfolioItem",
|
|
168
|
+
"Position",
|
|
169
|
+
"PriceIncrement",
|
|
170
|
+
"RealTimeBar",
|
|
171
|
+
"RealTimeBarList",
|
|
172
|
+
"ScanDataList",
|
|
173
|
+
"ScannerSubscription",
|
|
174
|
+
"SmartComponent",
|
|
175
|
+
"SoftDollarTier",
|
|
176
|
+
"TickAttrib",
|
|
177
|
+
"TickAttribBidAsk",
|
|
178
|
+
"TickAttribLast",
|
|
179
|
+
"TickByTickAllLast",
|
|
180
|
+
"WshEventData",
|
|
181
|
+
"TickByTickBidAsk",
|
|
182
|
+
"TickByTickMidPoint",
|
|
183
|
+
"TickData",
|
|
184
|
+
"TradeLogEntry",
|
|
185
|
+
"BracketOrder",
|
|
186
|
+
"ExecutionCondition",
|
|
187
|
+
"LimitOrder",
|
|
188
|
+
"MarginCondition",
|
|
189
|
+
"MarketOrder",
|
|
190
|
+
"Order",
|
|
191
|
+
"OrderComboLeg",
|
|
192
|
+
"OrderCondition",
|
|
193
|
+
"OrderState",
|
|
194
|
+
"OrderStatus",
|
|
195
|
+
"PercentChangeCondition",
|
|
196
|
+
"PriceCondition",
|
|
197
|
+
"StopLimitOrder",
|
|
198
|
+
"StopOrder",
|
|
199
|
+
"TimeCondition",
|
|
200
|
+
"Trade",
|
|
201
|
+
"VolumeCondition",
|
|
202
|
+
"Ticker",
|
|
203
|
+
"__version__",
|
|
204
|
+
"__version_info__",
|
|
205
|
+
"RequestError",
|
|
206
|
+
"Wrapper",
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
# compatibility with old Object
|
|
211
|
+
for obj in locals().copy().values():
|
|
212
|
+
if dataclasses.is_dataclass(obj):
|
|
213
|
+
obj.dict = util.dataclassAsDict
|
|
214
|
+
obj.tuple = util.dataclassAsTuple
|
|
215
|
+
obj.update = util.dataclassUpdate
|
|
216
|
+
obj.nonDefaults = util.dataclassNonDefaults
|
|
217
|
+
|
|
218
|
+
del sys
|
|
219
|
+
del dataclasses
|