ibind 0.1.10rc10__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.
- ibind-0.1.10rc10/LICENSE +203 -0
- ibind-0.1.10rc10/PKG-INFO +423 -0
- ibind-0.1.10rc10/README.md +194 -0
- ibind-0.1.10rc10/ibind/__init__.py +32 -0
- ibind-0.1.10rc10/ibind/base/__init__.py +0 -0
- ibind-0.1.10rc10/ibind/base/queue_controller.py +150 -0
- ibind-0.1.10rc10/ibind/base/rest_client.py +230 -0
- ibind-0.1.10rc10/ibind/base/subscription_controller.py +358 -0
- ibind-0.1.10rc10/ibind/base/ws_client.py +489 -0
- ibind-0.1.10rc10/ibind/client/__init__.py +0 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client.py +171 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/__init__.py +0 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/accounts_mixin.py +78 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/contract_mixin.py +335 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/marketdata_mixin.py +296 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/order_mixin.py +208 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/portfolio_mixin.py +224 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/scanner_mixin.py +90 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/session_mixin.py +98 -0
- ibind-0.1.10rc10/ibind/client/ibkr_client_mixins/watchlist_mixin.py +60 -0
- ibind-0.1.10rc10/ibind/client/ibkr_definitions.py +161 -0
- ibind-0.1.10rc10/ibind/client/ibkr_utils.py +473 -0
- ibind-0.1.10rc10/ibind/client/ibkr_ws_client.py +648 -0
- ibind-0.1.10rc10/ibind/support/__init__.py +0 -0
- ibind-0.1.10rc10/ibind/support/errors.py +6 -0
- ibind-0.1.10rc10/ibind/support/logs.py +143 -0
- ibind-0.1.10rc10/ibind/support/oauth.py +360 -0
- ibind-0.1.10rc10/ibind/support/py_utils.py +327 -0
- ibind-0.1.10rc10/ibind/var.py +123 -0
- ibind-0.1.10rc10/ibind.egg-info/PKG-INFO +423 -0
- ibind-0.1.10rc10/ibind.egg-info/SOURCES.txt +51 -0
- ibind-0.1.10rc10/ibind.egg-info/dependency_links.txt +1 -0
- ibind-0.1.10rc10/ibind.egg-info/requires.txt +10 -0
- ibind-0.1.10rc10/ibind.egg-info/top_level.txt +2 -0
- ibind-0.1.10rc10/pyproject.toml +42 -0
- ibind-0.1.10rc10/setup.cfg +7 -0
- ibind-0.1.10rc10/setup.py +9 -0
- ibind-0.1.10rc10/test/__init__.py +0 -0
- ibind-0.1.10rc10/test/integration/__init__.py +0 -0
- ibind-0.1.10rc10/test/integration/base/__init__.py +0 -0
- ibind-0.1.10rc10/test/integration/base/test_rest_client_i.py +82 -0
- ibind-0.1.10rc10/test/integration/base/test_websocket_client_i.py +284 -0
- ibind-0.1.10rc10/test/integration/base/websocketapp_mock.py +50 -0
- ibind-0.1.10rc10/test/integration/client/__init__.py +0 -0
- ibind-0.1.10rc10/test/integration/client/ibkr_responses.py +1062 -0
- ibind-0.1.10rc10/test/integration/client/test_ibkr_client_i.py +291 -0
- ibind-0.1.10rc10/test/integration/client/test_ibkr_utils_i.py +268 -0
- ibind-0.1.10rc10/test/integration/client/test_ibkr_ws_client_i.py +373 -0
- ibind-0.1.10rc10/test/test_utils.py +226 -0
- ibind-0.1.10rc10/test/unit/__init__.py +0 -0
- ibind-0.1.10rc10/test/unit/support/__init__.py +0 -0
- ibind-0.1.10rc10/test/unit/support/test_py_utils_u.py +120 -0
ibind-0.1.10rc10/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Copyright 2020 Voy Zan
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
38
|
+
Object form, made available under the License, as indicated by a
|
|
39
|
+
copyright notice that is included in or attached to the work
|
|
40
|
+
(an example is provided in the Appendix below).
|
|
41
|
+
|
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
43
|
+
form, that is based on (or derived from) the Work and for which the
|
|
44
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
45
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
46
|
+
of this License, Derivative Works shall not include works that remain
|
|
47
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
48
|
+
the Work and Derivative Works thereof.
|
|
49
|
+
|
|
50
|
+
"Contribution" shall mean any work of authorship, including
|
|
51
|
+
the original version of the Work and any modifications or additions
|
|
52
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
53
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
54
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
55
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
56
|
+
means any form of electronic, verbal, or written communication sent
|
|
57
|
+
to the Licensor or its representatives, including but not limited to
|
|
58
|
+
communication on electronic mailing lists, source code control systems,
|
|
59
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
60
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
61
|
+
excluding communication that is conspicuously marked or otherwise
|
|
62
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
65
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
66
|
+
subsequently incorporated within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate
|
|
89
|
+
as of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, then any Derivative Works that You distribute must
|
|
110
|
+
include a readable copy of the attribution notices contained
|
|
111
|
+
within such NOTICE file, excluding those notices that do not
|
|
112
|
+
pertain to any part of the Derivative Works, in at least one
|
|
113
|
+
of the following places: within a NOTICE text file distributed
|
|
114
|
+
as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or,
|
|
116
|
+
within a display generated by the Derivative Works, if and
|
|
117
|
+
wherever such third-party notices normally appear. The contents
|
|
118
|
+
of the NOTICE file are for informational purposes only and
|
|
119
|
+
do not modify the License. You may add Your own attribution
|
|
120
|
+
notices within Derivative Works that You distribute, alongside
|
|
121
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as modifying the License.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright statement to Your modifications and
|
|
126
|
+
may provide additional or different license terms and conditions
|
|
127
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
128
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
129
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
130
|
+
the conditions stated in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright 2020 Voy Zan
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: ibind
|
|
3
|
+
Version: 0.1.10rc10
|
|
4
|
+
Summary: IBind is a REST and WebSocket client library for Interactive Brokers Client Portal Web API.
|
|
5
|
+
Author-email: Voy Zan <voy1982@yahoo.co.uk>
|
|
6
|
+
License: Copyright 2020 Voy Zan
|
|
7
|
+
|
|
8
|
+
Apache License
|
|
9
|
+
Version 2.0, January 2004
|
|
10
|
+
http://www.apache.org/licenses/
|
|
11
|
+
|
|
12
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
13
|
+
|
|
14
|
+
1. Definitions.
|
|
15
|
+
|
|
16
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
17
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
18
|
+
|
|
19
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
20
|
+
the copyright owner that is granting the License.
|
|
21
|
+
|
|
22
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
23
|
+
other entities that control, are controlled by, or are under common
|
|
24
|
+
control with that entity. For the purposes of this definition,
|
|
25
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
26
|
+
direction or management of such entity, whether by contract or
|
|
27
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
28
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
29
|
+
|
|
30
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
31
|
+
exercising permissions granted by this License.
|
|
32
|
+
|
|
33
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
34
|
+
including but not limited to software source code, documentation
|
|
35
|
+
source, and configuration files.
|
|
36
|
+
|
|
37
|
+
"Object" form shall mean any form resulting from mechanical
|
|
38
|
+
transformation or translation of a Source form, including but
|
|
39
|
+
not limited to compiled object code, generated documentation,
|
|
40
|
+
and conversions to other media types.
|
|
41
|
+
|
|
42
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
43
|
+
Object form, made available under the License, as indicated by a
|
|
44
|
+
copyright notice that is included in or attached to the work
|
|
45
|
+
(an example is provided in the Appendix below).
|
|
46
|
+
|
|
47
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
48
|
+
form, that is based on (or derived from) the Work and for which the
|
|
49
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
50
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
51
|
+
of this License, Derivative Works shall not include works that remain
|
|
52
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
53
|
+
the Work and Derivative Works thereof.
|
|
54
|
+
|
|
55
|
+
"Contribution" shall mean any work of authorship, including
|
|
56
|
+
the original version of the Work and any modifications or additions
|
|
57
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
58
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
59
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
60
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
61
|
+
means any form of electronic, verbal, or written communication sent
|
|
62
|
+
to the Licensor or its representatives, including but not limited to
|
|
63
|
+
communication on electronic mailing lists, source code control systems,
|
|
64
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
65
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
66
|
+
excluding communication that is conspicuously marked or otherwise
|
|
67
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
68
|
+
|
|
69
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
70
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
71
|
+
subsequently incorporated within the Work.
|
|
72
|
+
|
|
73
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
77
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
78
|
+
Work and such Derivative Works in Source or Object form.
|
|
79
|
+
|
|
80
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
81
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
82
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
83
|
+
(except as stated in this section) patent license to make, have made,
|
|
84
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
85
|
+
where such license applies only to those patent claims licensable
|
|
86
|
+
by such Contributor that are necessarily infringed by their
|
|
87
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
88
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
89
|
+
institute patent litigation against any entity (including a
|
|
90
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
91
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
92
|
+
or contributory patent infringement, then any patent licenses
|
|
93
|
+
granted to You under this License for that Work shall terminate
|
|
94
|
+
as of the date such litigation is filed.
|
|
95
|
+
|
|
96
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
97
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
98
|
+
modifications, and in Source or Object form, provided that You
|
|
99
|
+
meet the following conditions:
|
|
100
|
+
|
|
101
|
+
(a) You must give any other recipients of the Work or
|
|
102
|
+
Derivative Works a copy of this License; and
|
|
103
|
+
|
|
104
|
+
(b) You must cause any modified files to carry prominent notices
|
|
105
|
+
stating that You changed the files; and
|
|
106
|
+
|
|
107
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
108
|
+
that You distribute, all copyright, patent, trademark, and
|
|
109
|
+
attribution notices from the Source form of the Work,
|
|
110
|
+
excluding those notices that do not pertain to any part of
|
|
111
|
+
the Derivative Works; and
|
|
112
|
+
|
|
113
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
114
|
+
distribution, then any Derivative Works that You distribute must
|
|
115
|
+
include a readable copy of the attribution notices contained
|
|
116
|
+
within such NOTICE file, excluding those notices that do not
|
|
117
|
+
pertain to any part of the Derivative Works, in at least one
|
|
118
|
+
of the following places: within a NOTICE text file distributed
|
|
119
|
+
as part of the Derivative Works; within the Source form or
|
|
120
|
+
documentation, if provided along with the Derivative Works; or,
|
|
121
|
+
within a display generated by the Derivative Works, if and
|
|
122
|
+
wherever such third-party notices normally appear. The contents
|
|
123
|
+
of the NOTICE file are for informational purposes only and
|
|
124
|
+
do not modify the License. You may add Your own attribution
|
|
125
|
+
notices within Derivative Works that You distribute, alongside
|
|
126
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
127
|
+
that such additional attribution notices cannot be construed
|
|
128
|
+
as modifying the License.
|
|
129
|
+
|
|
130
|
+
You may add Your own copyright statement to Your modifications and
|
|
131
|
+
may provide additional or different license terms and conditions
|
|
132
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
133
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
134
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
135
|
+
the conditions stated in this License.
|
|
136
|
+
|
|
137
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
138
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
139
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
140
|
+
this License, without any additional terms or conditions.
|
|
141
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
142
|
+
the terms of any separate license agreement you may have executed
|
|
143
|
+
with Licensor regarding such Contributions.
|
|
144
|
+
|
|
145
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
146
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
147
|
+
except as required for reasonable and customary use in describing the
|
|
148
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
149
|
+
|
|
150
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
151
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
152
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
153
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
154
|
+
implied, including, without limitation, any warranties or conditions
|
|
155
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
156
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
157
|
+
appropriateness of using or redistributing the Work and assume any
|
|
158
|
+
risks associated with Your exercise of permissions under this License.
|
|
159
|
+
|
|
160
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
161
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
162
|
+
unless required by applicable law (such as deliberate and grossly
|
|
163
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
164
|
+
liable to You for damages, including any direct, indirect, special,
|
|
165
|
+
incidental, or consequential damages of any character arising as a
|
|
166
|
+
result of this License or out of the use or inability to use the
|
|
167
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
168
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
169
|
+
other commercial damages or losses), even if such Contributor
|
|
170
|
+
has been advised of the possibility of such damages.
|
|
171
|
+
|
|
172
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
173
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
174
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
175
|
+
or other liability obligations and/or rights consistent with this
|
|
176
|
+
License. However, in accepting such obligations, You may act only
|
|
177
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
178
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
179
|
+
defend, and hold each Contributor harmless for any liability
|
|
180
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
181
|
+
of your accepting any such warranty or additional liability.
|
|
182
|
+
|
|
183
|
+
END OF TERMS AND CONDITIONS
|
|
184
|
+
|
|
185
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
186
|
+
|
|
187
|
+
To apply the Apache License to your work, attach the following
|
|
188
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
189
|
+
replaced with your own identifying information. (Don't include
|
|
190
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
191
|
+
comment syntax for the file format. We also recommend that a
|
|
192
|
+
file or class name and description of purpose be included on the
|
|
193
|
+
same "printed page" as the copyright notice for easier
|
|
194
|
+
identification within third-party archives.
|
|
195
|
+
|
|
196
|
+
Copyright 2020 Voy Zan
|
|
197
|
+
|
|
198
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
199
|
+
you may not use this file except in compliance with the License.
|
|
200
|
+
You may obtain a copy of the License at
|
|
201
|
+
|
|
202
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
203
|
+
|
|
204
|
+
Unless required by applicable law or agreed to in writing, software
|
|
205
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
206
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
207
|
+
See the License for the specific language governing permissions and
|
|
208
|
+
limitations under the License.
|
|
209
|
+
Project-URL: Homepage, https://github.com/Voyz/ibind
|
|
210
|
+
Keywords: interactive brokers,rest api,python api,ibkr python api,ibkr web api,ib api,ibkr api,algo trading,algorithmic trading,quant,trading
|
|
211
|
+
Classifier: Development Status :: 4 - Beta
|
|
212
|
+
Classifier: Programming Language :: Python :: 3
|
|
213
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
214
|
+
Classifier: Operating System :: OS Independent
|
|
215
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
216
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
217
|
+
Requires-Python: >=3.8
|
|
218
|
+
Description-Content-Type: text/markdown
|
|
219
|
+
License-File: LICENSE
|
|
220
|
+
Requires-Dist: requests==2.31.*
|
|
221
|
+
Requires-Dist: websocket-client==1.7.*
|
|
222
|
+
Provides-Extra: oauth
|
|
223
|
+
Requires-Dist: certifi>=2024.12.14; extra == "oauth"
|
|
224
|
+
Requires-Dist: charset-normalizer~=3.4; extra == "oauth"
|
|
225
|
+
Requires-Dist: idna~=3.10; extra == "oauth"
|
|
226
|
+
Requires-Dist: pycryptodome~=3.19.0; extra == "oauth"
|
|
227
|
+
Requires-Dist: python-dotenv==1.0.0; extra == "oauth"
|
|
228
|
+
Requires-Dist: urllib3~=2.3; extra == "oauth"
|
|
229
|
+
|
|
230
|
+
*This library is currently being beta-tested. See something that's broken? Did we get something
|
|
231
|
+
wrong? [Create an issue and let us know!][issues]*
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
<p align="center">
|
|
236
|
+
<a id="ibind" href="#ibind">
|
|
237
|
+
<img src="https://raw.githubusercontent.com/Voyz/ibind/master/media/ibind_logo.png" alt="IBind logo" title="IBind logo" width="600"/>
|
|
238
|
+
</a>
|
|
239
|
+
</p>
|
|
240
|
+
<p align="center">
|
|
241
|
+
<a href="https://opensource.org/licenses/Apache-2.0">
|
|
242
|
+
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/>
|
|
243
|
+
</a>
|
|
244
|
+
<a href="https://github.com/Voyz/ibind/releases">
|
|
245
|
+
<img src="https://img.shields.io/pypi/v/ibind?label=version"/>
|
|
246
|
+
</a>
|
|
247
|
+
</p>
|
|
248
|
+
|
|
249
|
+
IBind is an unofficial Python API client library for the [Interactive Brokers Client Portal Web API.][ibkr-docs] (recently rebranded to Web API 1.0 or CPAPI 1.0) It supports both REST and WebSocket APIs of the IBKR Web API 1.0.
|
|
250
|
+
|
|
251
|
+
_Note: IBind currently supports only the Web API 1.0 since the [newer OAuth-based Web API][web-api] seems to be still in beta and is not fully documented. Once a complete version of the new Web API is released IBind will be extended to support it._
|
|
252
|
+
|
|
253
|
+
## Installation
|
|
254
|
+
|
|
255
|
+
```rich
|
|
256
|
+
pip install ibind
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Use [IBeam][ibeam] along with this library for easier authentication with IBKR.
|
|
260
|
+
|
|
261
|
+
## Documentation
|
|
262
|
+
|
|
263
|
+
See full [IBind documentation][wiki].
|
|
264
|
+
|
|
265
|
+
* [Installation][wiki-installation]
|
|
266
|
+
* [Basic Concepts][wiki-basic-concepts]
|
|
267
|
+
* [IBind Configuration][wiki-ibind-configuration]
|
|
268
|
+
* [IbkrClient][wiki-ibkr-client] - REST Python client for [IBKR REST API][ibkr-endpoints].
|
|
269
|
+
* [IbkrWsClient][wiki-ibkr-ws-client] - WebSocket Python client for [IBKR WebSocket API][ibkr-websocket].
|
|
270
|
+
* [API Reference][api-ibkr-client]
|
|
271
|
+
|
|
272
|
+
Features:
|
|
273
|
+
* REST:
|
|
274
|
+
* [Automated question/answer handling][wiki-question-answer]
|
|
275
|
+
* [Parallel requests][wiki-parallel-requests]
|
|
276
|
+
* [Rate limiting][wiki-rate-limiting]
|
|
277
|
+
* [Conid unpacking][wiki-conid-unpacking]
|
|
278
|
+
* [and more][wiki-advanced-api]
|
|
279
|
+
* WebSocket:
|
|
280
|
+
* [WebSocket thread lifecycle handling][wiki-ws-lifecycle]
|
|
281
|
+
* [Thread-safe Queue data stream][wiki-ws-queues]
|
|
282
|
+
* [Internal subscription tracking][wiki-ws-subscriptions]
|
|
283
|
+
* [Health monitoring][wiki-ws-health-monitoring]
|
|
284
|
+
* [and more][wiki-advanced-websocket]
|
|
285
|
+
|
|
286
|
+
<a href="https://www.youtube.com/watch?v=34iHETvbdas">
|
|
287
|
+
<img src="https://raw.githubusercontent.com/Voyz/voyz_public/master/ibind_promo_vidA_A01.gif" alt="IBind showcase gif" title="IBind showcase gif" width="500"/>
|
|
288
|
+
</a>
|
|
289
|
+
|
|
290
|
+
## Overview
|
|
291
|
+
|
|
292
|
+
IBind's core functionality consists of two client classes:
|
|
293
|
+
|
|
294
|
+
* [`IbkrClient`][ibkr-client-docs] - for [IBKR REST API][ibkr-endpoints]
|
|
295
|
+
|
|
296
|
+
Using the `IbkrClient` requires constructing it with appropriate arguments, then calling the API methods.
|
|
297
|
+
|
|
298
|
+
* [`IbkrWsClient`][ibkr-ws-client-docs] - for [IBKR WebSocket API][ibkr-websocket]
|
|
299
|
+
|
|
300
|
+
Using the `IbkrWsClient` involves handling three areas:
|
|
301
|
+
|
|
302
|
+
* Managing its lifecycle. It is asynchronous and it will run on a separate thread, hence we need to construct it, start it and then manage its lifecycle on the originating thread.
|
|
303
|
+
* Subscribing and unsubscribing. It is subscription-based, hence we need to specify which channels we want to subscribe to and remember to unsubscribe later.
|
|
304
|
+
* Consuming data. It uses a queue system, hence we need to access these queues and consume their data.
|
|
305
|
+
|
|
306
|
+
Their usage differs substantially. Users are encouraged to familiarise themselves with the `IbkrClient` class first.
|
|
307
|
+
|
|
308
|
+
## Examples
|
|
309
|
+
|
|
310
|
+
See [all examples][examples].
|
|
311
|
+
|
|
312
|
+
### Basic REST Example
|
|
313
|
+
|
|
314
|
+
```python
|
|
315
|
+
from ibind import IbkrClient
|
|
316
|
+
|
|
317
|
+
# Construct the client
|
|
318
|
+
client = IbkrClient()
|
|
319
|
+
|
|
320
|
+
# Call some endpoints
|
|
321
|
+
print('\n#### check_health ####')
|
|
322
|
+
print(client.check_health())
|
|
323
|
+
|
|
324
|
+
print('\n\n#### tickle ####')
|
|
325
|
+
print(client.tickle().data)
|
|
326
|
+
|
|
327
|
+
print('\n\n#### get_accounts ####')
|
|
328
|
+
print(client.portfolio_accounts().data)
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Basic WebSocket Example
|
|
332
|
+
|
|
333
|
+
```python
|
|
334
|
+
from ibind import IbkrWsKey, IbkrWsClient
|
|
335
|
+
|
|
336
|
+
# Construct the client. Assumes IBIND_ACCOUNT_ID and IBIND_CACERT environment variables have been set.
|
|
337
|
+
ws_client = IbkrWsClient(start=True)
|
|
338
|
+
|
|
339
|
+
# Choose the WebSocket channel
|
|
340
|
+
ibkr_ws_key = IbkrWsKey.PNL
|
|
341
|
+
|
|
342
|
+
# Subscribe to the PNL channel
|
|
343
|
+
ws_client.subscribe(channel=ibkr_ws_key.channel)
|
|
344
|
+
|
|
345
|
+
# Wait for new items in the PNL queue.
|
|
346
|
+
while True:
|
|
347
|
+
while not ws_client.empty(ibkr_ws_key):
|
|
348
|
+
print(ws_client.get(ibkr_ws_key))
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
## Licence
|
|
353
|
+
|
|
354
|
+
See [LICENSE](https://github.com/Voyz/ibind/blob/master/LICENSE)
|
|
355
|
+
|
|
356
|
+
## Disclaimer
|
|
357
|
+
|
|
358
|
+
IBind is not built, maintained, or endorsed by the Interactive Brokers.
|
|
359
|
+
|
|
360
|
+
Use at own discretion. IBind and its authors give no guarantee of uninterrupted run of and access to the Interactive
|
|
361
|
+
Brokers Client Portal Web API. You should prepare for breaks in connectivity to IBKR servers and should not
|
|
362
|
+
depend on continuous uninterrupted connection and functionality. To partially reduce the potential risk use Paper Account credentials.
|
|
363
|
+
|
|
364
|
+
IBind is provided on an AS IS and AS AVAILABLE basis without any representation or endorsement made and without warranty
|
|
365
|
+
of any kind whether express or implied, including but not limited to the implied warranties of satisfactory quality,
|
|
366
|
+
fitness for a particular purpose, non-infringement, compatibility, security and accuracy. To the extent permitted by
|
|
367
|
+
law, IBind's authors will not be liable for any indirect or consequential loss or damage whatever (including without
|
|
368
|
+
limitation loss of business, opportunity, data, profits) arising out of or in connection with the use of IBind. IBind's
|
|
369
|
+
authors make no warranty that the functionality of IBind will be uninterrupted or error free, that defects will be
|
|
370
|
+
corrected or that IBind or the server that makes it available are free of viruses or anything else which may be harmful
|
|
371
|
+
or destructive.
|
|
372
|
+
|
|
373
|
+
## Acknowledgement
|
|
374
|
+
|
|
375
|
+
IBind has been enriched by incorporating work developed in collaboration with [Kinetic](https://www.kinetic.xyz/) and [Grant Stenger](https://github.com/GrantStenger), which now forms part of the initial open-source release. I appreciate their significant contribution to this community-driven initiative. Cheers Kinetic! 🍻
|
|
376
|
+
|
|
377
|
+
## Built by Voy
|
|
378
|
+
|
|
379
|
+
Hi! Thanks for checking out and using this library. If you are interested in discussing your project, require
|
|
380
|
+
mentorship, consider hiring me, or just wanna chat - I'm happy to talk.
|
|
381
|
+
|
|
382
|
+
You can email me to get in touch: hello@voyzan.com
|
|
383
|
+
|
|
384
|
+
Or if you'd just want to give something back, I've got a Buy Me A Coffee account:
|
|
385
|
+
|
|
386
|
+
<a href="https://www.buymeacoffee.com/voyzan" rel="nofollow">
|
|
387
|
+
<img src="https://raw.githubusercontent.com/Voyz/voyz_public/master/vz_BMC.png" alt="Buy Me A Coffee" style="max-width:100%;" width="192">
|
|
388
|
+
</a>
|
|
389
|
+
|
|
390
|
+
Thanks and have an awesome day 👋
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
[ibeam]: https://github.com/Voyz/ibeam
|
|
394
|
+
[examples]: https://github.com/Voyz/ibind/blob/master/examples
|
|
395
|
+
[issues]: https://github.com/Voyz/ibind/issues
|
|
396
|
+
[api-ibkr-client]: https://github.com/Voyz/ibind/wiki/API-Reference-%E2%80%90-IbkrClient
|
|
397
|
+
[ibkr-client-docs]: https://github.com/Voyz/ibind/wiki/Ibkr-Client
|
|
398
|
+
[ibkr-ws-client-docs]: https://github.com/Voyz/ibind/wiki/Ibkr-Ws-Client
|
|
399
|
+
|
|
400
|
+
[ibkr-docs]: https://ibkrcampus.com/ibkr-api-page/cpapi-v1/
|
|
401
|
+
[ibkr-endpoints]: https://ibkrcampus.com/ibkr-api-page/cpapi-v1/#endpoints
|
|
402
|
+
[ibkr-websocket]: https://ibkrcampus.com/ibkr-api-page/cpapi-v1/#websockets
|
|
403
|
+
[web-api]: https://www.interactivebrokers.com/campus/ibkr-api-page/webapi-doc
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
[wiki]: https://github.com/Voyz/ibind/wiki
|
|
407
|
+
[wiki-installation]: https://github.com/Voyz/ibind/wiki/Installation
|
|
408
|
+
[wiki-basic-concepts]: https://github.com/Voyz/ibind/wiki/Basic-Concepts
|
|
409
|
+
[wiki-ibind-configuration]: https://github.com/Voyz/ibind/wiki/IBind-Configuration
|
|
410
|
+
[wiki-ibkr-client]: https://github.com/Voyz/ibind/wiki/Ibkr-Client
|
|
411
|
+
[wiki-ibkr-ws-client]: https://github.com/Voyz/ibind/wiki/Ibkr-Ws-Client
|
|
412
|
+
|
|
413
|
+
[wiki-question-answer]: https://github.com/Voyz/ibind/wiki/Ibkr-Client#-place_order
|
|
414
|
+
[wiki-parallel-requests]: https://github.com/Voyz/ibind/wiki/Ibkr-Client#-marketdata_history_by_symbols
|
|
415
|
+
[wiki-rate-limiting]: https://github.com/Voyz/ibind/wiki/Ibkr-Client#-marketdata_history_by_symbols
|
|
416
|
+
[wiki-conid-unpacking]: https://github.com/Voyz/ibind/wiki/Ibkr-Client#-security_stocks_by_symbol
|
|
417
|
+
[wiki-advanced-api]: https://github.com/Voyz/ibind/wiki/Ibkr-Client#advanced-api
|
|
418
|
+
|
|
419
|
+
[wiki-ws-lifecycle]: https://github.com/Voyz/ibind/wiki/Ibkr-Ws-Client#-managing-the-lifecycle
|
|
420
|
+
[wiki-ws-queues]: https://github.com/Voyz/ibind/wiki/Ibkr-Ws-Client#-consuming-data
|
|
421
|
+
[wiki-ws-subscriptions]: https://github.com/Voyz/ibind/wiki/Ibkr-Ws-Client#-subscribing-and-unsubscribing
|
|
422
|
+
[wiki-ws-health-monitoring]: https://github.com/Voyz/ibind/wiki/Ibkr-Ws-Client#health-monitoring
|
|
423
|
+
[wiki-advanced-websocket]: https://github.com/Voyz/ibind/wiki/Advanced-WebSocket
|