ibapi-stable 10.37.2__py3-none-any.whl

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.
Files changed (57) hide show
  1. ibapi/__init__.py +16 -0
  2. ibapi/account_summary_tags.py +70 -0
  3. ibapi/client.py +4891 -0
  4. ibapi/client_utils.py +412 -0
  5. ibapi/comm.py +100 -0
  6. ibapi/commission_and_fees_report.py +31 -0
  7. ibapi/common.py +315 -0
  8. ibapi/connection.py +126 -0
  9. ibapi/const.py +12 -0
  10. ibapi/contract.py +265 -0
  11. ibapi/decoder.py +1711 -0
  12. ibapi/decoder_utils.py +420 -0
  13. ibapi/enum_implem.py +20 -0
  14. ibapi/errors.py +43 -0
  15. ibapi/execution.py +95 -0
  16. ibapi/ineligibility_reason.py +18 -0
  17. ibapi/message.py +186 -0
  18. ibapi/news.py +13 -0
  19. ibapi/object_implem.py +12 -0
  20. ibapi/order.py +263 -0
  21. ibapi/order_cancel.py +21 -0
  22. ibapi/order_condition.py +289 -0
  23. ibapi/order_state.py +117 -0
  24. ibapi/orderdecoder.py +539 -0
  25. ibapi/protobuf/CancelOrderRequest_pb2.py +38 -0
  26. ibapi/protobuf/ComboLeg_pb2.py +37 -0
  27. ibapi/protobuf/Contract_pb2.py +39 -0
  28. ibapi/protobuf/DeltaNeutralContract_pb2.py +37 -0
  29. ibapi/protobuf/ErrorMessage_pb2.py +37 -0
  30. ibapi/protobuf/ExecutionDetailsEnd_pb2.py +37 -0
  31. ibapi/protobuf/ExecutionDetails_pb2.py +39 -0
  32. ibapi/protobuf/ExecutionFilter_pb2.py +37 -0
  33. ibapi/protobuf/ExecutionRequest_pb2.py +38 -0
  34. ibapi/protobuf/Execution_pb2.py +37 -0
  35. ibapi/protobuf/GlobalCancelRequest_pb2.py +38 -0
  36. ibapi/protobuf/OpenOrder_pb2.py +40 -0
  37. ibapi/protobuf/OpenOrdersEnd_pb2.py +37 -0
  38. ibapi/protobuf/OrderAllocation_pb2.py +37 -0
  39. ibapi/protobuf/OrderCancel_pb2.py +37 -0
  40. ibapi/protobuf/OrderCondition_pb2.py +37 -0
  41. ibapi/protobuf/OrderState_pb2.py +38 -0
  42. ibapi/protobuf/OrderStatus_pb2.py +37 -0
  43. ibapi/protobuf/Order_pb2.py +51 -0
  44. ibapi/protobuf/PlaceOrderRequest_pb2.py +39 -0
  45. ibapi/protobuf/SoftDollarTier_pb2.py +37 -0
  46. ibapi/reader.py +49 -0
  47. ibapi/scanner.py +77 -0
  48. ibapi/server_versions.py +159 -0
  49. ibapi/softdollartier.py +16 -0
  50. ibapi/tag_value.py +22 -0
  51. ibapi/ticktype.py +117 -0
  52. ibapi/utils.py +233 -0
  53. ibapi/wrapper.py +885 -0
  54. ibapi_stable-10.37.2.dist-info/METADATA +136 -0
  55. ibapi_stable-10.37.2.dist-info/RECORD +57 -0
  56. ibapi_stable-10.37.2.dist-info/WHEEL +5 -0
  57. ibapi_stable-10.37.2.dist-info/top_level.txt +1 -0
ibapi/message.py ADDED
@@ -0,0 +1,186 @@
1
+ """
2
+ Copyright (C) 2025 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
+ High level IB message info.
8
+ """
9
+
10
+ # field types
11
+ INT = 1
12
+ STR = 2
13
+ FLT = 3
14
+
15
+
16
+ # incoming msg id's
17
+ class IN:
18
+ TICK_PRICE = 1
19
+ TICK_SIZE = 2
20
+ ORDER_STATUS = 3
21
+ ERR_MSG = 4
22
+ OPEN_ORDER = 5
23
+ ACCT_VALUE = 6
24
+ PORTFOLIO_VALUE = 7
25
+ ACCT_UPDATE_TIME = 8
26
+ NEXT_VALID_ID = 9
27
+ CONTRACT_DATA = 10
28
+ EXECUTION_DATA = 11
29
+ MARKET_DEPTH = 12
30
+ MARKET_DEPTH_L2 = 13
31
+ NEWS_BULLETINS = 14
32
+ MANAGED_ACCTS = 15
33
+ RECEIVE_FA = 16
34
+ HISTORICAL_DATA = 17
35
+ BOND_CONTRACT_DATA = 18
36
+ SCANNER_PARAMETERS = 19
37
+ SCANNER_DATA = 20
38
+ TICK_OPTION_COMPUTATION = 21
39
+ TICK_GENERIC = 45
40
+ TICK_STRING = 46
41
+ TICK_EFP = 47
42
+ CURRENT_TIME = 49
43
+ REAL_TIME_BARS = 50
44
+ FUNDAMENTAL_DATA = 51
45
+ CONTRACT_DATA_END = 52
46
+ OPEN_ORDER_END = 53
47
+ ACCT_DOWNLOAD_END = 54
48
+ EXECUTION_DATA_END = 55
49
+ DELTA_NEUTRAL_VALIDATION = 56
50
+ TICK_SNAPSHOT_END = 57
51
+ MARKET_DATA_TYPE = 58
52
+ COMMISSION_AND_FEES_REPORT = 59
53
+ POSITION_DATA = 61
54
+ POSITION_END = 62
55
+ ACCOUNT_SUMMARY = 63
56
+ ACCOUNT_SUMMARY_END = 64
57
+ VERIFY_MESSAGE_API = 65
58
+ VERIFY_COMPLETED = 66
59
+ DISPLAY_GROUP_LIST = 67
60
+ DISPLAY_GROUP_UPDATED = 68
61
+ VERIFY_AND_AUTH_MESSAGE_API = 69
62
+ VERIFY_AND_AUTH_COMPLETED = 70
63
+ POSITION_MULTI = 71
64
+ POSITION_MULTI_END = 72
65
+ ACCOUNT_UPDATE_MULTI = 73
66
+ ACCOUNT_UPDATE_MULTI_END = 74
67
+ SECURITY_DEFINITION_OPTION_PARAMETER = 75
68
+ SECURITY_DEFINITION_OPTION_PARAMETER_END = 76
69
+ SOFT_DOLLAR_TIERS = 77
70
+ FAMILY_CODES = 78
71
+ SYMBOL_SAMPLES = 79
72
+ MKT_DEPTH_EXCHANGES = 80
73
+ TICK_REQ_PARAMS = 81
74
+ SMART_COMPONENTS = 82
75
+ NEWS_ARTICLE = 83
76
+ TICK_NEWS = 84
77
+ NEWS_PROVIDERS = 85
78
+ HISTORICAL_NEWS = 86
79
+ HISTORICAL_NEWS_END = 87
80
+ HEAD_TIMESTAMP = 88
81
+ HISTOGRAM_DATA = 89
82
+ HISTORICAL_DATA_UPDATE = 90
83
+ REROUTE_MKT_DATA_REQ = 91
84
+ REROUTE_MKT_DEPTH_REQ = 92
85
+ MARKET_RULE = 93
86
+ PNL = 94
87
+ PNL_SINGLE = 95
88
+ HISTORICAL_TICKS = 96
89
+ HISTORICAL_TICKS_BID_ASK = 97
90
+ HISTORICAL_TICKS_LAST = 98
91
+ TICK_BY_TICK = 99
92
+ ORDER_BOUND = 100
93
+ COMPLETED_ORDER = 101
94
+ COMPLETED_ORDERS_END = 102
95
+ REPLACE_FA_END = 103
96
+ WSH_META_DATA = 104
97
+ WSH_EVENT_DATA = 105
98
+ HISTORICAL_SCHEDULE = 106
99
+ USER_INFO = 107
100
+ HISTORICAL_DATA_END = 108
101
+ CURRENT_TIME_IN_MILLIS = 109
102
+
103
+
104
+ # outgoing msg id's
105
+ class OUT:
106
+ REQ_MKT_DATA = 1
107
+ CANCEL_MKT_DATA = 2
108
+ PLACE_ORDER = 3
109
+ CANCEL_ORDER = 4
110
+ REQ_OPEN_ORDERS = 5
111
+ REQ_ACCT_DATA = 6
112
+ REQ_EXECUTIONS = 7
113
+ REQ_IDS = 8
114
+ REQ_CONTRACT_DATA = 9
115
+ REQ_MKT_DEPTH = 10
116
+ CANCEL_MKT_DEPTH = 11
117
+ REQ_NEWS_BULLETINS = 12
118
+ CANCEL_NEWS_BULLETINS = 13
119
+ SET_SERVER_LOGLEVEL = 14
120
+ REQ_AUTO_OPEN_ORDERS = 15
121
+ REQ_ALL_OPEN_ORDERS = 16
122
+ REQ_MANAGED_ACCTS = 17
123
+ REQ_FA = 18
124
+ REPLACE_FA = 19
125
+ REQ_HISTORICAL_DATA = 20
126
+ EXERCISE_OPTIONS = 21
127
+ REQ_SCANNER_SUBSCRIPTION = 22
128
+ CANCEL_SCANNER_SUBSCRIPTION = 23
129
+ REQ_SCANNER_PARAMETERS = 24
130
+ CANCEL_HISTORICAL_DATA = 25
131
+ REQ_CURRENT_TIME = 49
132
+ REQ_REAL_TIME_BARS = 50
133
+ CANCEL_REAL_TIME_BARS = 51
134
+ REQ_FUNDAMENTAL_DATA = 52
135
+ CANCEL_FUNDAMENTAL_DATA = 53
136
+ REQ_CALC_IMPLIED_VOLAT = 54
137
+ REQ_CALC_OPTION_PRICE = 55
138
+ CANCEL_CALC_IMPLIED_VOLAT = 56
139
+ CANCEL_CALC_OPTION_PRICE = 57
140
+ REQ_GLOBAL_CANCEL = 58
141
+ REQ_MARKET_DATA_TYPE = 59
142
+ REQ_POSITIONS = 61
143
+ REQ_ACCOUNT_SUMMARY = 62
144
+ CANCEL_ACCOUNT_SUMMARY = 63
145
+ CANCEL_POSITIONS = 64
146
+ VERIFY_REQUEST = 65
147
+ VERIFY_MESSAGE = 66
148
+ QUERY_DISPLAY_GROUPS = 67
149
+ SUBSCRIBE_TO_GROUP_EVENTS = 68
150
+ UPDATE_DISPLAY_GROUP = 69
151
+ UNSUBSCRIBE_FROM_GROUP_EVENTS = 70
152
+ START_API = 71
153
+ VERIFY_AND_AUTH_REQUEST = 72
154
+ VERIFY_AND_AUTH_MESSAGE = 73
155
+ REQ_POSITIONS_MULTI = 74
156
+ CANCEL_POSITIONS_MULTI = 75
157
+ REQ_ACCOUNT_UPDATES_MULTI = 76
158
+ CANCEL_ACCOUNT_UPDATES_MULTI = 77
159
+ REQ_SEC_DEF_OPT_PARAMS = 78
160
+ REQ_SOFT_DOLLAR_TIERS = 79
161
+ REQ_FAMILY_CODES = 80
162
+ REQ_MATCHING_SYMBOLS = 81
163
+ REQ_MKT_DEPTH_EXCHANGES = 82
164
+ REQ_SMART_COMPONENTS = 83
165
+ REQ_NEWS_ARTICLE = 84
166
+ REQ_NEWS_PROVIDERS = 85
167
+ REQ_HISTORICAL_NEWS = 86
168
+ REQ_HEAD_TIMESTAMP = 87
169
+ REQ_HISTOGRAM_DATA = 88
170
+ CANCEL_HISTOGRAM_DATA = 89
171
+ CANCEL_HEAD_TIMESTAMP = 90
172
+ REQ_MARKET_RULE = 91
173
+ REQ_PNL = 92
174
+ CANCEL_PNL = 93
175
+ REQ_PNL_SINGLE = 94
176
+ CANCEL_PNL_SINGLE = 95
177
+ REQ_HISTORICAL_TICKS = 96
178
+ REQ_TICK_BY_TICK_DATA = 97
179
+ CANCEL_TICK_BY_TICK_DATA = 98
180
+ REQ_COMPLETED_ORDERS = 99
181
+ REQ_WSH_META_DATA = 100
182
+ CANCEL_WSH_META_DATA = 101
183
+ REQ_WSH_EVENT_DATA = 102
184
+ CANCEL_WSH_EVENT_DATA = 103
185
+ REQ_USER_INFO = 104
186
+ REQ_CURRENT_TIME_IN_MILLIS = 105
ibapi/news.py ADDED
@@ -0,0 +1,13 @@
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
+ # TWS New Bulletins constants
7
+ NEWS_MSG = 1 # standard IB news bulleting message
8
+ EXCHANGE_AVAIL_MSG = (
9
+ 2 # control message specifying that an exchange is available for trading
10
+ )
11
+ EXCHANGE_UNAVAIL_MSG = (
12
+ 3 # control message specifying that an exchange is unavailable for trading
13
+ )
ibapi/object_implem.py ADDED
@@ -0,0 +1,12 @@
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 Object(object):
8
+ def __str__(self):
9
+ return "Object"
10
+
11
+ def __repr__(self):
12
+ return str(id(self)) + ": " + self.__str__()
ibapi/order.py ADDED
@@ -0,0 +1,263 @@
1
+ """
2
+ Copyright (C) 2025 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
+ from ibapi.const import UNSET_INTEGER, UNSET_DOUBLE, UNSET_DECIMAL, DOUBLE_INFINITY
7
+ from ibapi.object_implem import Object
8
+ from ibapi.softdollartier import SoftDollarTier
9
+ from ibapi.utils import decimalMaxString
10
+ from ibapi.utils import intMaxString
11
+ from ibapi.utils import floatMaxString
12
+ from ibapi.utils import longMaxString
13
+
14
+ # enum Origin
15
+ (CUSTOMER, FIRM, UNKNOWN) = range(3)
16
+
17
+ # enum AuctionStrategy
18
+ (AUCTION_UNSET, AUCTION_MATCH, AUCTION_IMPROVEMENT, AUCTION_TRANSPARENT) = range(4)
19
+
20
+ COMPETE_AGAINST_BEST_OFFSET_UP_TO_MID = DOUBLE_INFINITY
21
+
22
+
23
+ class OrderComboLeg(Object):
24
+ def __init__(self):
25
+ self.price = UNSET_DOUBLE # type: float
26
+
27
+ def __str__(self):
28
+ return f"{floatMaxString(self.price)}"
29
+
30
+
31
+ class Order(Object):
32
+ def __init__(self):
33
+ self.softDollarTier = SoftDollarTier("", "", "")
34
+ # order identifier
35
+ self.orderId = 0
36
+ self.clientId = 0
37
+ self.permId = 0
38
+
39
+ # main order fields
40
+ self.action = ""
41
+ self.totalQuantity = UNSET_DECIMAL
42
+ self.orderType = ""
43
+ self.lmtPrice = UNSET_DOUBLE
44
+ self.auxPrice = UNSET_DOUBLE
45
+
46
+ # extended order fields
47
+ self.tif = "" # "Time in Force" - DAY, GTC, etc.
48
+ self.activeStartTime = "" # for GTC orders
49
+ self.activeStopTime = "" # for GTC orders
50
+ self.ocaGroup = "" # one cancels all group name
51
+ self.ocaType = (
52
+ 0 # 1 = CANCEL_WITH_BLOCK, 2 = REDUCE_WITH_BLOCK, 3 = REDUCE_NON_BLOCK
53
+ )
54
+ self.orderRef = ""
55
+ self.transmit = True # if false, order will be created but not transmitted
56
+ self.parentId = 0 # Parent order id, to associate Auto STP or TRAIL orders with the original order.
57
+ self.blockOrder = False
58
+ self.sweepToFill = False
59
+ self.displaySize = 0
60
+ self.triggerMethod = 0 # 0=Default, 1=Double_Bid_Ask, 2=Last, 3=Double_Last, 4=Bid_Ask, 7=Last_or_Bid_Ask, 8=Mid-point
61
+ self.outsideRth = False
62
+ self.hidden = False
63
+ self.goodAfterTime = "" # Format: 20060505 08:00:00 {time zone}
64
+ self.goodTillDate = "" # Format: 20060505 08:00:00 {time zone}
65
+ self.rule80A = "" # Individual = 'I', Agency = 'A', AgentOtherMember = 'W', IndividualPTIA = 'J', AgencyPTIA = 'U', AgentOtherMemberPTIA = 'M', IndividualPT = 'K', AgencyPT = 'Y', AgentOtherMemberPT = 'N'
66
+ self.allOrNone = False
67
+ self.minQty = UNSET_INTEGER # type: int
68
+ self.percentOffset = UNSET_DOUBLE # type: float # REL orders only
69
+ self.overridePercentageConstraints = False
70
+ self.trailStopPrice = UNSET_DOUBLE # type: float
71
+ self.trailingPercent = UNSET_DOUBLE # type: float # TRAILLIMIT orders only
72
+
73
+ # financial advisors only
74
+ self.faGroup = ""
75
+ self.faMethod = ""
76
+ self.faPercentage = ""
77
+
78
+ # institutional (ie non-cleared) only
79
+ self.designatedLocation = "" # used only when shortSaleSlot=2
80
+ self.openClose = "" # O=Open, C=Close
81
+ self.origin = CUSTOMER # 0=Customer, 1=Firm
82
+ self.shortSaleSlot = (
83
+ 0
84
+ ) # type: int # 1 if you hold the shares, 2 if they will be delivered from elsewhere. Only for Action=SSHORT
85
+ self.exemptCode = -1
86
+
87
+ # SMART routing only
88
+ self.discretionaryAmt = 0
89
+ self.optOutSmartRouting = False
90
+
91
+ # BOX exchange orders only
92
+ self.auctionStrategy = (
93
+ AUCTION_UNSET
94
+ ) # type: int # AUCTION_MATCH, AUCTION_IMPROVEMENT, AUCTION_TRANSPARENT
95
+ self.startingPrice = UNSET_DOUBLE # type: float
96
+ self.stockRefPrice = UNSET_DOUBLE # type: float
97
+ self.delta = UNSET_DOUBLE # type: float
98
+
99
+ # pegged to stock and VOL orders only
100
+ self.stockRangeLower = UNSET_DOUBLE # type: float
101
+ self.stockRangeUpper = UNSET_DOUBLE # type: float
102
+
103
+ self.randomizePrice = False
104
+ self.randomizeSize = False
105
+
106
+ # VOLATILITY ORDERS ONLY
107
+ self.volatility = UNSET_DOUBLE # type: float
108
+ self.volatilityType = UNSET_INTEGER # type: int # 1=daily, 2=annual
109
+ self.deltaNeutralOrderType = ""
110
+ self.deltaNeutralAuxPrice = UNSET_DOUBLE # type: float
111
+ self.deltaNeutralConId = 0
112
+ self.deltaNeutralSettlingFirm = ""
113
+ self.deltaNeutralClearingAccount = ""
114
+ self.deltaNeutralClearingIntent = ""
115
+ self.deltaNeutralOpenClose = ""
116
+ self.deltaNeutralShortSale = False
117
+ self.deltaNeutralShortSaleSlot = 0
118
+ self.deltaNeutralDesignatedLocation = ""
119
+ self.continuousUpdate = False
120
+ self.referencePriceType = UNSET_INTEGER # type: int # 1=Average, 2 = BidOrAsk
121
+
122
+ # COMBO ORDERS ONLY
123
+ self.basisPoints = UNSET_DOUBLE # type: float # EFP orders only
124
+ self.basisPointsType = UNSET_INTEGER # type: int # EFP orders only
125
+
126
+ # SCALE ORDERS ONLY
127
+ self.scaleInitLevelSize = UNSET_INTEGER # type: int
128
+ self.scaleSubsLevelSize = UNSET_INTEGER # type: int
129
+ self.scalePriceIncrement = UNSET_DOUBLE # type: float
130
+ self.scalePriceAdjustValue = UNSET_DOUBLE # type: float
131
+ self.scalePriceAdjustInterval = UNSET_INTEGER # type: int
132
+ self.scaleProfitOffset = UNSET_DOUBLE # type: float
133
+ self.scaleAutoReset = False
134
+ self.scaleInitPosition = UNSET_INTEGER # type: int
135
+ self.scaleInitFillQty = UNSET_INTEGER # type: int
136
+ self.scaleRandomPercent = False
137
+ self.scaleTable = ""
138
+
139
+ # HEDGE ORDERS
140
+ self.hedgeType = "" # 'D' - delta, 'B' - beta, 'F' - FX, 'P' - pair
141
+ self.hedgeParam = "" # 'beta=X' value for beta hedge, 'ratio=Y' for pair hedge
142
+
143
+ # Clearing info
144
+ self.account = "" # IB account
145
+ self.settlingFirm = ""
146
+ self.clearingAccount = "" # True beneficiary of the order
147
+ self.clearingIntent = "" # "" (Default), "IB", "Away", "PTA" (PostTrade)
148
+
149
+ # ALGO ORDERS ONLY
150
+ self.algoStrategy = ""
151
+
152
+ self.algoParams = None # TagValueList
153
+ self.smartComboRoutingParams = None # TagValueList
154
+
155
+ self.algoId = ""
156
+
157
+ # What-if
158
+ self.whatIf = False
159
+
160
+ # Not Held
161
+ self.notHeld = False
162
+ self.solicited = False
163
+
164
+ # models
165
+ self.modelCode = ""
166
+
167
+ # order combo legs
168
+
169
+ self.orderComboLegs = None # OrderComboLegListSPtr
170
+
171
+ self.orderMiscOptions = None # TagValueList
172
+
173
+ # VER PEG2BENCH fields:
174
+ self.referenceContractId = 0
175
+ self.peggedChangeAmount = 0.0
176
+ self.isPeggedChangeAmountDecrease = False
177
+ self.referenceChangeAmount = 0.0
178
+ self.referenceExchangeId = ""
179
+ self.adjustedOrderType = ""
180
+
181
+ self.triggerPrice = UNSET_DOUBLE
182
+ self.adjustedStopPrice = UNSET_DOUBLE
183
+ self.adjustedStopLimitPrice = UNSET_DOUBLE
184
+ self.adjustedTrailingAmount = UNSET_DOUBLE
185
+ self.adjustableTrailingUnit = 0
186
+ self.lmtPriceOffset = UNSET_DOUBLE
187
+
188
+ self.conditions = [] # std::vector<std::shared_ptr<OrderCondition>>
189
+ self.conditionsCancelOrder = False
190
+ self.conditionsIgnoreRth = False
191
+
192
+ # ext operator
193
+ self.extOperator = ""
194
+
195
+ # native cash quantity
196
+ self.cashQty = UNSET_DOUBLE
197
+
198
+ self.mifid2DecisionMaker = ""
199
+ self.mifid2DecisionAlgo = ""
200
+ self.mifid2ExecutionTrader = ""
201
+ self.mifid2ExecutionAlgo = ""
202
+
203
+ self.dontUseAutoPriceForHedge = False
204
+
205
+ self.isOmsContainer = False
206
+
207
+ self.discretionaryUpToLimitPrice = False
208
+
209
+ self.autoCancelDate = ""
210
+ self.filledQuantity = UNSET_DECIMAL
211
+ self.refFuturesConId = 0
212
+ self.autoCancelParent = False
213
+ self.shareholder = ""
214
+ self.imbalanceOnly = False
215
+ self.routeMarketableToBbo = False
216
+ self.parentPermId = 0
217
+
218
+ self.usePriceMgmtAlgo = None
219
+ self.duration = UNSET_INTEGER
220
+ self.postToAts = UNSET_INTEGER
221
+ self.advancedErrorOverride = ""
222
+ self.manualOrderTime = ""
223
+ self.minTradeQty = UNSET_INTEGER
224
+ self.minCompeteSize = UNSET_INTEGER
225
+ self.competeAgainstBestOffset = UNSET_DOUBLE
226
+ self.midOffsetAtWhole = UNSET_DOUBLE
227
+ self.midOffsetAtHalf = UNSET_DOUBLE
228
+ self.customerAccount = ""
229
+ self.professionalCustomer = False
230
+ self.bondAccruedInterest = ""
231
+ self.includeOvernight = False
232
+ self.manualOrderIndicator = UNSET_INTEGER
233
+ self.submitter = ""
234
+
235
+ def __str__(self):
236
+ s = "%s,%s,%s:" % (
237
+ intMaxString(self.orderId),
238
+ intMaxString(self.clientId),
239
+ longMaxString(self.permId),
240
+ )
241
+
242
+ s += " %s %s %s@%s" % (
243
+ self.orderType,
244
+ self.action,
245
+ decimalMaxString(self.totalQuantity),
246
+ floatMaxString(self.lmtPrice),
247
+ )
248
+
249
+ s += f" {self.tif}"
250
+
251
+ if self.orderComboLegs:
252
+ s += " CMB("
253
+ for leg in self.orderComboLegs:
254
+ s += str(leg) + ","
255
+ s += ")"
256
+
257
+ if self.conditions:
258
+ s += " COND("
259
+ for cond in self.conditions:
260
+ s += str(cond) + ","
261
+ s += ")"
262
+
263
+ return s
ibapi/order_cancel.py ADDED
@@ -0,0 +1,21 @@
1
+ """
2
+ Copyright (C) 2024 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
+ from ibapi.const import UNSET_INTEGER
7
+ from ibapi.object_implem import Object
8
+ from ibapi.utils import intMaxString
9
+
10
+ class OrderCancel(Object):
11
+ def __init__(self):
12
+ self.manualOrderCancelTime = ""
13
+ self.extOperator = ""
14
+ self.manualOrderIndicator = UNSET_INTEGER
15
+
16
+ def __str__(self):
17
+ s = "manualOrderCancelTime: %s, extOperator: %s, manualOrderIndicator: %s" % (
18
+ self.manualOrderCancelTime, self.extOperator, intMaxString(self.manualOrderIndicator)
19
+ )
20
+
21
+ return s