ibapi-stable 10.37.2__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.
- ibapi_stable-10.37.2/PKG-INFO +136 -0
- ibapi_stable-10.37.2/README.md +110 -0
- ibapi_stable-10.37.2/ibapi/ibapi/__init__.py +16 -0
- ibapi_stable-10.37.2/ibapi/ibapi/account_summary_tags.py +70 -0
- ibapi_stable-10.37.2/ibapi/ibapi/client.py +4891 -0
- ibapi_stable-10.37.2/ibapi/ibapi/client_utils.py +412 -0
- ibapi_stable-10.37.2/ibapi/ibapi/comm.py +100 -0
- ibapi_stable-10.37.2/ibapi/ibapi/commission_and_fees_report.py +31 -0
- ibapi_stable-10.37.2/ibapi/ibapi/common.py +315 -0
- ibapi_stable-10.37.2/ibapi/ibapi/connection.py +126 -0
- ibapi_stable-10.37.2/ibapi/ibapi/const.py +12 -0
- ibapi_stable-10.37.2/ibapi/ibapi/contract.py +265 -0
- ibapi_stable-10.37.2/ibapi/ibapi/decoder.py +1711 -0
- ibapi_stable-10.37.2/ibapi/ibapi/decoder_utils.py +420 -0
- ibapi_stable-10.37.2/ibapi/ibapi/enum_implem.py +20 -0
- ibapi_stable-10.37.2/ibapi/ibapi/errors.py +43 -0
- ibapi_stable-10.37.2/ibapi/ibapi/execution.py +95 -0
- ibapi_stable-10.37.2/ibapi/ibapi/ineligibility_reason.py +18 -0
- ibapi_stable-10.37.2/ibapi/ibapi/message.py +186 -0
- ibapi_stable-10.37.2/ibapi/ibapi/news.py +13 -0
- ibapi_stable-10.37.2/ibapi/ibapi/object_implem.py +12 -0
- ibapi_stable-10.37.2/ibapi/ibapi/order.py +263 -0
- ibapi_stable-10.37.2/ibapi/ibapi/order_cancel.py +21 -0
- ibapi_stable-10.37.2/ibapi/ibapi/order_condition.py +289 -0
- ibapi_stable-10.37.2/ibapi/ibapi/order_state.py +117 -0
- ibapi_stable-10.37.2/ibapi/ibapi/orderdecoder.py +539 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/CancelOrderRequest_pb2.py +38 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/ComboLeg_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/Contract_pb2.py +39 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/DeltaNeutralContract_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/ErrorMessage_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/ExecutionDetailsEnd_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/ExecutionDetails_pb2.py +39 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/ExecutionFilter_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/ExecutionRequest_pb2.py +38 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/Execution_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/GlobalCancelRequest_pb2.py +38 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/OpenOrder_pb2.py +40 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/OpenOrdersEnd_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/OrderAllocation_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/OrderCancel_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/OrderCondition_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/OrderState_pb2.py +38 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/OrderStatus_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/Order_pb2.py +51 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/PlaceOrderRequest_pb2.py +39 -0
- ibapi_stable-10.37.2/ibapi/ibapi/protobuf/SoftDollarTier_pb2.py +37 -0
- ibapi_stable-10.37.2/ibapi/ibapi/reader.py +49 -0
- ibapi_stable-10.37.2/ibapi/ibapi/scanner.py +77 -0
- ibapi_stable-10.37.2/ibapi/ibapi/server_versions.py +159 -0
- ibapi_stable-10.37.2/ibapi/ibapi/softdollartier.py +16 -0
- ibapi_stable-10.37.2/ibapi/ibapi/tag_value.py +22 -0
- ibapi_stable-10.37.2/ibapi/ibapi/ticktype.py +117 -0
- ibapi_stable-10.37.2/ibapi/ibapi/utils.py +233 -0
- ibapi_stable-10.37.2/ibapi/ibapi/wrapper.py +885 -0
- ibapi_stable-10.37.2/ibapi/ibapi_stable.egg-info/PKG-INFO +136 -0
- ibapi_stable-10.37.2/ibapi/ibapi_stable.egg-info/SOURCES.txt +60 -0
- ibapi_stable-10.37.2/ibapi/ibapi_stable.egg-info/dependency_links.txt +1 -0
- ibapi_stable-10.37.2/ibapi/ibapi_stable.egg-info/requires.txt +1 -0
- ibapi_stable-10.37.2/ibapi/ibapi_stable.egg-info/top_level.txt +1 -0
- ibapi_stable-10.37.2/pyproject.toml +46 -0
- ibapi_stable-10.37.2/setup.cfg +4 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ibapi-stable
|
|
3
|
+
Version: 10.37.2
|
|
4
|
+
Summary: Interactive Brokers Python API
|
|
5
|
+
Author-email: Interactive Brokers LLC <api@interactivebrokers.com>
|
|
6
|
+
Maintainer: IB API Automated Publisher
|
|
7
|
+
Project-URL: Homepage, https://interactivebrokers.github.io/tws-api
|
|
8
|
+
Project-URL: Documentation, https://ibkrcampus.com/ibkr-api-page/
|
|
9
|
+
Project-URL: Repository, https://github.com/yourusername/ibapi
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/yourusername/ibapi/issues
|
|
11
|
+
Keywords: interactive brokers,ibapi,tws,trading,api
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
15
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Requires-Python: >=3.1
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: protobuf==5.29.3
|
|
26
|
+
|
|
27
|
+
# IB API Python - Automated Publisher
|
|
28
|
+
|
|
29
|
+
This project automatically downloads the Interactive Brokers TWS API Python client and publishes it to PyPI.
|
|
30
|
+
|
|
31
|
+
## Overview
|
|
32
|
+
|
|
33
|
+
The Interactive Brokers TWS API is distributed as a zip file containing multiple language bindings. This project:
|
|
34
|
+
|
|
35
|
+
1. Downloads the latest TWS API zip file from https://interactivebrokers.github.io/
|
|
36
|
+
2. Extracts only the Python client (`IBJts/source/pythonclient`)
|
|
37
|
+
3. Commits the extracted code to a git branch
|
|
38
|
+
4. Tags the commit with the API version number
|
|
39
|
+
5. (Future) Publishes to PyPI automatically
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
### Method 1: Automatic (if web access is unrestricted)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Get the download URL from the IB website
|
|
47
|
+
python get_download_url.py
|
|
48
|
+
|
|
49
|
+
# Update the IB API using the URL from above
|
|
50
|
+
python update_ibapi.py <download_url>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Method 2: Manual URL
|
|
54
|
+
|
|
55
|
+
If automatic scraping doesn't work (e.g., due to firewall/proxy restrictions):
|
|
56
|
+
|
|
57
|
+
1. Open https://interactivebrokers.github.io/ in your browser
|
|
58
|
+
2. Find the download link in the table (usually the third row: `tr.linebottom:nth-child(3) > td:nth-child(2) > a`)
|
|
59
|
+
3. Right-click and copy the link address
|
|
60
|
+
4. Run the update script:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python update_ibapi.py <download_url>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Example:
|
|
67
|
+
```bash
|
|
68
|
+
python update_ibapi.py https://interactivebrokers.github.io/downloads/twsapi_macunix.1040.01.zip
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## How It Works
|
|
72
|
+
|
|
73
|
+
### Version Detection
|
|
74
|
+
|
|
75
|
+
The version is automatically extracted from the zip filename. For example:
|
|
76
|
+
- `twsapi_macunix.1040.01.zip` → version `1040.01`
|
|
77
|
+
- `twsapi_macunix.1051.00.zip` → version `1051.00`
|
|
78
|
+
|
|
79
|
+
### Git Workflow
|
|
80
|
+
|
|
81
|
+
1. The Python client code is copied to the `ibapi/` directory
|
|
82
|
+
2. Changes are committed with message: `Update IB API to version X.XX`
|
|
83
|
+
3. A git tag is created: `vX.XX`
|
|
84
|
+
|
|
85
|
+
### File Structure
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
ibapi-python/
|
|
89
|
+
├── README.md # This file
|
|
90
|
+
├── get_download_url.py # Helper script to fetch download URL
|
|
91
|
+
├── update_ibapi.py # Main automation script
|
|
92
|
+
├── scrape_and_publish.py # Legacy script (alternative method)
|
|
93
|
+
└── ibapi/ # IB Python client code (created after first run)
|
|
94
|
+
├── client.py
|
|
95
|
+
├── wrapper.py
|
|
96
|
+
└── ...
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Requirements
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install requests beautifulsoup4
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Manual Steps (Alternative)
|
|
106
|
+
|
|
107
|
+
If you prefer to do it manually:
|
|
108
|
+
|
|
109
|
+
1. Download the TWS API zip from https://interactivebrokers.github.io/
|
|
110
|
+
2. Extract the zip file
|
|
111
|
+
3. Copy `IBJts/source/pythonclient/*` to `ibapi/` in this repository
|
|
112
|
+
4. Commit and tag:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git add ibapi/
|
|
116
|
+
git commit -m "Update IB API to version X.XX"
|
|
117
|
+
git tag -a vX.XX -m "Version X.XX"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Future Enhancements
|
|
121
|
+
|
|
122
|
+
- [ ] Automatic publishing to PyPI
|
|
123
|
+
- [ ] GitHub Actions workflow for scheduled checks
|
|
124
|
+
- [ ] Version comparison to detect updates
|
|
125
|
+
- [ ] Automated testing of the Python client
|
|
126
|
+
- [ ] setup.py for PyPI packaging
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
The IB API code is proprietary to Interactive Brokers. This automation tool is provided as-is.
|
|
131
|
+
|
|
132
|
+
## Support
|
|
133
|
+
|
|
134
|
+
For issues with:
|
|
135
|
+
- The IB API itself: Contact Interactive Brokers
|
|
136
|
+
- This automation tool: Open an issue in this repository
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# IB API Python - Automated Publisher
|
|
2
|
+
|
|
3
|
+
This project automatically downloads the Interactive Brokers TWS API Python client and publishes it to PyPI.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Interactive Brokers TWS API is distributed as a zip file containing multiple language bindings. This project:
|
|
8
|
+
|
|
9
|
+
1. Downloads the latest TWS API zip file from https://interactivebrokers.github.io/
|
|
10
|
+
2. Extracts only the Python client (`IBJts/source/pythonclient`)
|
|
11
|
+
3. Commits the extracted code to a git branch
|
|
12
|
+
4. Tags the commit with the API version number
|
|
13
|
+
5. (Future) Publishes to PyPI automatically
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
### Method 1: Automatic (if web access is unrestricted)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Get the download URL from the IB website
|
|
21
|
+
python get_download_url.py
|
|
22
|
+
|
|
23
|
+
# Update the IB API using the URL from above
|
|
24
|
+
python update_ibapi.py <download_url>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Method 2: Manual URL
|
|
28
|
+
|
|
29
|
+
If automatic scraping doesn't work (e.g., due to firewall/proxy restrictions):
|
|
30
|
+
|
|
31
|
+
1. Open https://interactivebrokers.github.io/ in your browser
|
|
32
|
+
2. Find the download link in the table (usually the third row: `tr.linebottom:nth-child(3) > td:nth-child(2) > a`)
|
|
33
|
+
3. Right-click and copy the link address
|
|
34
|
+
4. Run the update script:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python update_ibapi.py <download_url>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
```bash
|
|
42
|
+
python update_ibapi.py https://interactivebrokers.github.io/downloads/twsapi_macunix.1040.01.zip
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## How It Works
|
|
46
|
+
|
|
47
|
+
### Version Detection
|
|
48
|
+
|
|
49
|
+
The version is automatically extracted from the zip filename. For example:
|
|
50
|
+
- `twsapi_macunix.1040.01.zip` → version `1040.01`
|
|
51
|
+
- `twsapi_macunix.1051.00.zip` → version `1051.00`
|
|
52
|
+
|
|
53
|
+
### Git Workflow
|
|
54
|
+
|
|
55
|
+
1. The Python client code is copied to the `ibapi/` directory
|
|
56
|
+
2. Changes are committed with message: `Update IB API to version X.XX`
|
|
57
|
+
3. A git tag is created: `vX.XX`
|
|
58
|
+
|
|
59
|
+
### File Structure
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
ibapi-python/
|
|
63
|
+
├── README.md # This file
|
|
64
|
+
├── get_download_url.py # Helper script to fetch download URL
|
|
65
|
+
├── update_ibapi.py # Main automation script
|
|
66
|
+
├── scrape_and_publish.py # Legacy script (alternative method)
|
|
67
|
+
└── ibapi/ # IB Python client code (created after first run)
|
|
68
|
+
├── client.py
|
|
69
|
+
├── wrapper.py
|
|
70
|
+
└── ...
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Requirements
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install requests beautifulsoup4
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Manual Steps (Alternative)
|
|
80
|
+
|
|
81
|
+
If you prefer to do it manually:
|
|
82
|
+
|
|
83
|
+
1. Download the TWS API zip from https://interactivebrokers.github.io/
|
|
84
|
+
2. Extract the zip file
|
|
85
|
+
3. Copy `IBJts/source/pythonclient/*` to `ibapi/` in this repository
|
|
86
|
+
4. Commit and tag:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git add ibapi/
|
|
90
|
+
git commit -m "Update IB API to version X.XX"
|
|
91
|
+
git tag -a vX.XX -m "Version X.XX"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Future Enhancements
|
|
95
|
+
|
|
96
|
+
- [ ] Automatic publishing to PyPI
|
|
97
|
+
- [ ] GitHub Actions workflow for scheduled checks
|
|
98
|
+
- [ ] Version comparison to detect updates
|
|
99
|
+
- [ ] Automated testing of the Python client
|
|
100
|
+
- [ ] setup.py for PyPI packaging
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
The IB API code is proprietary to Interactive Brokers. This automation tool is provided as-is.
|
|
105
|
+
|
|
106
|
+
## Support
|
|
107
|
+
|
|
108
|
+
For issues with:
|
|
109
|
+
- The IB API itself: Contact Interactive Brokers
|
|
110
|
+
- This automation tool: Open an issue in this repository
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (C) 2023 Interactive Brokers LLC. All rights reserved. This code is subject to the terms
|
|
3
|
+
and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
""" Package implementing the Python API for the TWS/IB Gateway """
|
|
7
|
+
|
|
8
|
+
VERSION = {"major": 10, "minor": 37, "micro": 2}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_version_string():
|
|
12
|
+
# Version string with preserved leading zeros
|
|
13
|
+
return "10.37.02"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__version__ = get_version_string()
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (C) 2019 Interactive Brokers LLC. All rights reserved. This code is subject to the terms
|
|
3
|
+
and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AccountSummaryTags:
|
|
8
|
+
AccountType = "AccountType"
|
|
9
|
+
NetLiquidation = "NetLiquidation"
|
|
10
|
+
TotalCashValue = "TotalCashValue"
|
|
11
|
+
SettledCash = "SettledCash"
|
|
12
|
+
AccruedCash = "AccruedCash"
|
|
13
|
+
BuyingPower = "BuyingPower"
|
|
14
|
+
EquityWithLoanValue = "EquityWithLoanValue"
|
|
15
|
+
PreviousDayEquityWithLoanValue = "PreviousDayEquityWithLoanValue"
|
|
16
|
+
GrossPositionValue = "GrossPositionValue"
|
|
17
|
+
ReqTEquity = "ReqTEquity"
|
|
18
|
+
ReqTMargin = "ReqTMargin"
|
|
19
|
+
SMA = "SMA"
|
|
20
|
+
InitMarginReq = "InitMarginReq"
|
|
21
|
+
MaintMarginReq = "MaintMarginReq"
|
|
22
|
+
AvailableFunds = "AvailableFunds"
|
|
23
|
+
ExcessLiquidity = "ExcessLiquidity"
|
|
24
|
+
Cushion = "Cushion"
|
|
25
|
+
FullInitMarginReq = "FullInitMarginReq"
|
|
26
|
+
FullMaintMarginReq = "FullMaintMarginReq"
|
|
27
|
+
FullAvailableFunds = "FullAvailableFunds"
|
|
28
|
+
FullExcessLiquidity = "FullExcessLiquidity"
|
|
29
|
+
LookAheadNextChange = "LookAheadNextChange"
|
|
30
|
+
LookAheadInitMarginReq = "LookAheadInitMarginReq"
|
|
31
|
+
LookAheadMaintMarginReq = "LookAheadMaintMarginReq"
|
|
32
|
+
LookAheadAvailableFunds = "LookAheadAvailableFunds"
|
|
33
|
+
LookAheadExcessLiquidity = "LookAheadExcessLiquidity"
|
|
34
|
+
HighestSeverity = "HighestSeverity"
|
|
35
|
+
DayTradesRemaining = "DayTradesRemaining"
|
|
36
|
+
Leverage = "Leverage"
|
|
37
|
+
|
|
38
|
+
AllTags = ",".join(
|
|
39
|
+
(
|
|
40
|
+
AccountType,
|
|
41
|
+
NetLiquidation,
|
|
42
|
+
TotalCashValue,
|
|
43
|
+
SettledCash,
|
|
44
|
+
AccruedCash,
|
|
45
|
+
BuyingPower,
|
|
46
|
+
EquityWithLoanValue,
|
|
47
|
+
PreviousDayEquityWithLoanValue,
|
|
48
|
+
GrossPositionValue,
|
|
49
|
+
ReqTEquity,
|
|
50
|
+
ReqTMargin,
|
|
51
|
+
SMA,
|
|
52
|
+
InitMarginReq,
|
|
53
|
+
MaintMarginReq,
|
|
54
|
+
AvailableFunds,
|
|
55
|
+
ExcessLiquidity,
|
|
56
|
+
Cushion,
|
|
57
|
+
FullInitMarginReq,
|
|
58
|
+
FullMaintMarginReq,
|
|
59
|
+
FullAvailableFunds,
|
|
60
|
+
FullExcessLiquidity,
|
|
61
|
+
LookAheadNextChange,
|
|
62
|
+
LookAheadInitMarginReq,
|
|
63
|
+
LookAheadMaintMarginReq,
|
|
64
|
+
LookAheadAvailableFunds,
|
|
65
|
+
LookAheadExcessLiquidity,
|
|
66
|
+
HighestSeverity,
|
|
67
|
+
DayTradesRemaining,
|
|
68
|
+
Leverage,
|
|
69
|
+
)
|
|
70
|
+
)
|