Hello,
While I very much appreciate that you don't support golang, I wonder if you can point me in a helpful direction, because I'm unable to find any useful docs at all. I'm rather lost, so I'm hoping you have some expertise you're willing to share.
Until mid-August, I was perfectly able to place orders using placeOrder. After my vacation, I find that exactly the same orders are now failing to go through and instead landing in the APIPending state. Unhelpfully, the docs say this is "infrequent", suggesting there might be a problem with the security definition and not much else.
I still receive errors as usual if I send obviously erroneous orders.
Do you have any insight on what might be causing this sudden change? How would I go about finding out why the orders are no longer being submitted correctly? (There have been no changes to the golang library I'm using.) Is there any further information that might be useful to you?
|
Logs would be the best initial indication of where to start.
|
Connection:
?
{"level":"info","ts": 1694722816.2040021,"caller":" [email protected]f1841ded5152/client.go:107"," msg":"Connect to client","host":"[hostname]. com","port":4002,"clientID": 1234} {"level":"info","ts": 1694722816.293527,"caller":" [email protected]f1841ded5152/client.go:177"," msg":"HandShake with TWS or GateWay"} {"level":"info","ts": 1694722816.3810427,"caller":" [email protected]f1841ded5152/client.go:223"," msg":"handShake info","serverVersion":161} {"level":"info","ts": 1694722816.3811238,"caller":" [email protected]f1841ded5152/client.go:224"," msg":"handShake info","connectionTime":" 20230914 13:20:17 PST"} {"level":"info","ts": 1694722816.5943294,"caller":" [email protected]f1841ded5152/client.go:272"," msg":"HandShake completed"} {"level":"info","ts": 1694722816.5943744,"caller":" [email protected]f1841ded5152/client.go:3047"," msg":"run client"} Order: {"OrderID":212017,"ClientID": 1234,"PermID":0,"Action":"BUY" ,"TotalQuantity":10," OrderType":"MKT","LimitPrice": 1.7976931348623157e+308," AuxPrice":1.7976931348623157e+ 308,"TIF":"DAY"," ActiveStartTime":""," ActiveStopTime":"","OCAGroup": "","OCAType":0,"OrderRef":""," Transmit":true,"ParentID":0," BlockOrder":false," SweepToFill":false," DisplaySize":0,"TriggerMethod" :0,"OutsideRTH":false,"Hidden" :false,"GoodAfterTime":""," GoodTillDate":""," OverridePercentageConstraints" :false,"Rule80A":""," AllOrNone":false,"MinQty": 9223372036854775807," PercentOffset":1. 7976931348623157e+308," TrailStopPrice":1. 7976931348623157e+308," TrailingPercent":1. 7976931348623157e+308," FAGroup":"","FAProfile":""," FAMethod":"","FAPercentage":"" ,"OpenClose":"O","Origin":0," ShortSaleSlot":0," DesignatedLocation":""," ExemptCode":-1," DiscretionaryAmount":0," ETradeOnly":true," FirmQuoteOnly":true," NBBOPriceCap":1. 7976931348623157e+308," OptOutSmartRouting":false," AuctionStrategy":0," StartingPrice":1. 7976931348623157e+308," StockRefPrice":1. 7976931348623157e+308,"Delta": 1.7976931348623157e+308," StockRangeLower":1. 7976931348623157e+308," StockRangeUpper":1. 7976931348623157e+308," RandomizePrice":false," RandomizeSize":false," Volatility":1. 7976931348623157e+308," VolatilityType": 9223372036854775807," DeltaNeutralOrderType":""," DeltaNeutralAuxPrice":1. 7976931348623157e+308," DeltaNeutralContractID":0," DeltaNeutralSettlingFirm":""," DeltaNeutralClearingAccount":" ","DeltaNeutralClearingIntent" :"","DeltaNeutralOpenClose":"" ,"DeltaNeutralShortSale": false," DeltaNeutralShortSaleSlot":0," DeltaNeutralDesignatedLocation ":"","ContinuousUpdate":false, "ReferencePriceType": 9223372036854775807," BasisPoints":1. 7976931348623157e+308," BasisPointsType": 9223372036854775807," ScaleInitLevelSize": 9223372036854775807," ScaleSubsLevelSize": 9223372036854775807," ScalePriceIncrement":1. 7976931348623157e+308," ScalePriceAdjustValue":1. 7976931348623157e+308," ScalePriceAdjustInterval": 9223372036854775807," ScaleProfitOffset":1. 7976931348623157e+308," ScaleAutoReset":false," ScaleInitPosition": 9223372036854775807," ScaleInitFillQty": 9223372036854775807," ScaleRandomPercent":false," ScaleTable":""," NotSuppScaleNumComponents":0," HedgeType":"","HedgeParam":"", "Account":"","SettlingFirm":"" ,"ClearingAccount":""," ClearingIntent":""," AlgoStrategy":"","AlgoParams": null,"SmartComboRoutingParams" :null,"AlgoID":"","WhatIf": false,"NotHeld":false," Solictied":false,"ModelCode":" ","OrderComboLegs":null," OrderMiscOptions":null," ReferenceContractID":0," PeggedChangeAmount":0," IsPeggedChangeAmountDecrease": false,"ReferenceChangeAmount": 0,"ReferenceExchangeID":""," AdjustedOrderType":""," TriggerPrice":1. 7976931348623157e+308," AdjustedStopPrice":1. 7976931348623157e+308," AdjustedStopLimitPrice":1. 7976931348623157e+308," AdjustedTrailingAmount":1. 7976931348623157e+308," AdjustableTrailingUnit":0," LimitPriceOffset":1. 7976931348623157e+308," Conditions":null," ConditionsCancelOrder":false," ConditionsIgnoreRth":false," ExtOperator":"","CashQty":1. 7976931348623157e+308," Mifid2DecisionMaker":""," Mifid2DecisionAlgo":""," Mifid2ExecutionTrader":""," Mifid2ExecutionAlgo":""," DontUseAutoPriceForHedge": false,"IsOmsContainer":false," DiscretionaryUpToLimitPrice": false,"AutoCancelDate":""," FilledQuantity":1. 7976931348623157e+308," RefFuturesConID":0," AutoCancelParent":false," Shareholder":""," ImbalanceOnly":false," RouteMarketableToBbo":false," ParentPermID":0," UsePriceMgmtAlgo":false," Duration":9223372036854775807, "PostToAts": 9223372036854775807," SoftDollarTier":{"Name":""," Value":"","DisplayName":""}} Contract: {"ContractID":76792991," Symbol":"TSLA","SecurityType": "STK","Expiry":"","Strike":0," Right":"","Multiplier":""," Exchange":"SMART","Currency":" USD","LocalSymbol":"TSLA"," TradingClass":"NMS"," PrimaryExchange":"NASDAQ"," IncludeExpired":false," SecurityIDType":""," SecurityID":""," ComboLegsDescription":""," ComboLegs":null," DeltaNeutralContract":null}
Wrapper (my local time is GMT+1):
?
2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:27 ? ? ? ?<NextValidID> ? {"reqID": 211959} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:18 ? ? ? ?<ConnectAck>... 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2104, "errString": "Market data farm connection is OK:njinternal"} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2107, "errString": "HMDS data farm connection is inactive but should be available upon demand.njhmdsint"} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2158, "errString": "Sec-def data farm connection is OK:secdefnj"} 2023-09-14T21:20:16.685+0100 ? ?INFO ? ?ib/wrapper.go:216 ? ? ? <ContractDetails> ? ? ? {"reqID": 1, "conDetails": "ContractDetails<Contract: Contract<CondID: 76792991, Symbol: TSLA, SecurityType: STK, Exchange: SMART, Currency: USD>, MarketName: NMS, UnderContractID: 0, LongName: TESLA INC>"} 2023-09-14T21:20:16.809+0100 ? ?INFO ? ?ib/wrapper.go:222 ? ? ? <ContractDetailsEnd> ? ?{"reqID": 1} 2023-09-14T21:20:17.898+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:17.983+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd> 2023-09-14T21:20:18.774+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:18.858+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd> 2023-09-14T21:20:19.774+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:19.858+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd>
?
|
Check if your golang implementation is compatible with the last stable version of TWS or IBGateway.
toggle quoted message
Show quoted text
El 14 sep. 2023, a la(s) 17:46, unclekensson@... escribi¨®:
? Connection:
?
{"level":"info","ts": 1694722816.2040021,"caller":" [email protected]f1841ded5152/client.go:107"," msg":"Connect to client","host":"[hostname]. com","port":4002,"clientID": 1234} {"level":"info","ts": 1694722816.293527,"caller":" [email protected]f1841ded5152/client.go:177"," msg":"HandShake with TWS or GateWay"} {"level":"info","ts": 1694722816.3810427,"caller":" [email protected]f1841ded5152/client.go:223"," msg":"handShake info","serverVersion":161} {"level":"info","ts": 1694722816.3811238,"caller":" [email protected]f1841ded5152/client.go:224"," msg":"handShake info","connectionTime":" 20230914 13:20:17 PST"} {"level":"info","ts": 1694722816.5943294,"caller":" [email protected]f1841ded5152/client.go:272"," msg":"HandShake completed"} {"level":"info","ts": 1694722816.5943744,"caller":" [email protected]f1841ded5152/client.go:3047"," msg":"run client"} Order: {"OrderID":212017,"ClientID": 1234,"PermID":0,"Action":"BUY" ,"TotalQuantity":10," OrderType":"MKT","LimitPrice": 1.7976931348623157e+308," AuxPrice":1.7976931348623157e+ 308,"TIF":"DAY"," ActiveStartTime":""," ActiveStopTime":"","OCAGroup": "","OCAType":0,"OrderRef":""," Transmit":true,"ParentID":0," BlockOrder":false," SweepToFill":false," DisplaySize":0,"TriggerMethod" :0,"OutsideRTH":false,"Hidden" :false,"GoodAfterTime":""," GoodTillDate":""," OverridePercentageConstraints" :false,"Rule80A":""," AllOrNone":false,"MinQty": 9223372036854775807," PercentOffset":1. 7976931348623157e+308," TrailStopPrice":1. 7976931348623157e+308," TrailingPercent":1. 7976931348623157e+308," FAGroup":"","FAProfile":""," FAMethod":"","FAPercentage":"" ,"OpenClose":"O","Origin":0," ShortSaleSlot":0," DesignatedLocation":""," ExemptCode":-1," DiscretionaryAmount":0," ETradeOnly":true," FirmQuoteOnly":true," NBBOPriceCap":1. 7976931348623157e+308," OptOutSmartRouting":false," AuctionStrategy":0," StartingPrice":1. 7976931348623157e+308," StockRefPrice":1. 7976931348623157e+308,"Delta": 1.7976931348623157e+308," StockRangeLower":1. 7976931348623157e+308," StockRangeUpper":1. 7976931348623157e+308," RandomizePrice":false," RandomizeSize":false," Volatility":1. 7976931348623157e+308," VolatilityType": 9223372036854775807," DeltaNeutralOrderType":""," DeltaNeutralAuxPrice":1. 7976931348623157e+308," DeltaNeutralContractID":0," DeltaNeutralSettlingFirm":""," DeltaNeutralClearingAccount":" ","DeltaNeutralClearingIntent" :"","DeltaNeutralOpenClose":"" ,"DeltaNeutralShortSale": false," DeltaNeutralShortSaleSlot":0," DeltaNeutralDesignatedLocation ":"","ContinuousUpdate":false, "ReferencePriceType": 9223372036854775807," BasisPoints":1. 7976931348623157e+308," BasisPointsType": 9223372036854775807," ScaleInitLevelSize": 9223372036854775807," ScaleSubsLevelSize": 9223372036854775807," ScalePriceIncrement":1. 7976931348623157e+308," ScalePriceAdjustValue":1. 7976931348623157e+308," ScalePriceAdjustInterval": 9223372036854775807," ScaleProfitOffset":1. 7976931348623157e+308," ScaleAutoReset":false," ScaleInitPosition": 9223372036854775807," ScaleInitFillQty": 9223372036854775807," ScaleRandomPercent":false," ScaleTable":""," NotSuppScaleNumComponents":0," HedgeType":"","HedgeParam":"", "Account":"","SettlingFirm":"" ,"ClearingAccount":""," ClearingIntent":""," AlgoStrategy":"","AlgoParams": null,"SmartComboRoutingParams" :null,"AlgoID":"","WhatIf": false,"NotHeld":false," Solictied":false,"ModelCode":" ","OrderComboLegs":null," OrderMiscOptions":null," ReferenceContractID":0," PeggedChangeAmount":0," IsPeggedChangeAmountDecrease": false,"ReferenceChangeAmount": 0,"ReferenceExchangeID":""," AdjustedOrderType":""," TriggerPrice":1. 7976931348623157e+308," AdjustedStopPrice":1. 7976931348623157e+308," AdjustedStopLimitPrice":1. 7976931348623157e+308," AdjustedTrailingAmount":1. 7976931348623157e+308," AdjustableTrailingUnit":0," LimitPriceOffset":1. 7976931348623157e+308," Conditions":null," ConditionsCancelOrder":false," ConditionsIgnoreRth":false," ExtOperator":"","CashQty":1. 7976931348623157e+308," Mifid2DecisionMaker":""," Mifid2DecisionAlgo":""," Mifid2ExecutionTrader":""," Mifid2ExecutionAlgo":""," DontUseAutoPriceForHedge": false,"IsOmsContainer":false," DiscretionaryUpToLimitPrice": false,"AutoCancelDate":""," FilledQuantity":1. 7976931348623157e+308," RefFuturesConID":0," AutoCancelParent":false," Shareholder":""," ImbalanceOnly":false," RouteMarketableToBbo":false," ParentPermID":0," UsePriceMgmtAlgo":false," Duration":9223372036854775807, "PostToAts": 9223372036854775807," SoftDollarTier":{"Name":""," Value":"","DisplayName":""}} Contract: {"ContractID":76792991," Symbol":"TSLA","SecurityType": "STK","Expiry":"","Strike":0," Right":"","Multiplier":""," Exchange":"SMART","Currency":" USD","LocalSymbol":"TSLA"," TradingClass":"NMS"," PrimaryExchange":"NASDAQ"," IncludeExpired":false," SecurityIDType":""," SecurityID":""," ComboLegsDescription":""," ComboLegs":null," DeltaNeutralContract":null}
Wrapper (my local time is GMT+1):
?
2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:27 ? ? ? ?<NextValidID> ? {"reqID": 211959} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:18 ? ? ? ?<ConnectAck>... 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2104, "errString": "Market data farm connection is OK:njinternal"} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2107, "errString": "HMDS data farm connection is inactive but should be available upon demand.njhmdsint"} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2158, "errString": "Sec-def data farm connection is OK:secdefnj"} 2023-09-14T21:20:16.685+0100 ? ?INFO ? ?ib/wrapper.go:216 ? ? ? <ContractDetails> ? ? ? {"reqID": 1, "conDetails": "ContractDetails<Contract: Contract<CondID: 76792991, Symbol: TSLA, SecurityType: STK, Exchange: SMART, Currency: USD>, MarketName: NMS, UnderContractID: 0, LongName: TESLA INC>"} 2023-09-14T21:20:16.809+0100 ? ?INFO ? ?ib/wrapper.go:222 ? ? ? <ContractDetailsEnd> ? ?{"reqID": 1} 2023-09-14T21:20:17.898+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:17.983+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd> 2023-09-14T21:20:18.774+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:18.858+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd> 2023-09-14T21:20:19.774+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:19.858+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd>
?
|
I suspect it is not since the GoLang API implements TWS API version 161 and we are at 178 now. Version 161 was introduced three years ago around TWS API 972.
Traditionally connecting clients that use "old API versions" worked just fine even if they were talking with brand-spanking-new TWS/IBGW. Client and TWS/IBGW negotiate the highest common API level during connection and limit the features they use to that level. API implementations provided by IBKR have lots of code just to make sure that works.
During the transition from 9xx versions to V10 TWS API, version 163 introduced "fractional sizes" and caused massive changes for all requests and responses that have a size/quantity field (orders, execution, commission, market data, historical data,....). Version 163 changed the data type for all those fields from Integer to Decimal and it was not just another addon-feature that can easily be ignored.
My suspicion is that your issue relates to the missing fractional size support by your client. The only real solution is to implement all missing API features up to and including to 163 (and probably even higher) in the GoLang TWS API implementation.
A short-term work-around may be that you look for the oldest standalone TWS/IBGW you can find. Hopefully that version is more tolerant to pre-163 clients. That may buy you some time to get the GoLang API upgraded but eventually, IBKR will force you to upgrade. I'd start with the current "latest" V10.19.
Massive changes took place in TWS/IBGW over the last three years and I wish I could tell you something else. But we finally moved from API 985 to 10.19 earlier in the year for similar reasons.
´³¨¹°ù²µ±ð²Ô
On Thu, Sep 14, 2023 at 06:06 PM, Franco Chiesa Docampo wrote:
toggle quoted message
Show quoted text
Check if your golang implementation is compatible with the last stable version of TWS or IBGateway.
El 14 sep. 2023, a la(s) 17:46, unclekensson@... escribi¨®:
Connection:
?
{"level":"info","ts": 1694722816.2040021,"caller":" [email protected]f1841ded5152/client.go:107"," msg":"Connect to client","host":"[hostname]. com","port":4002,"clientID": 1234} {"level":"info","ts": 1694722816.293527,"caller":" [email protected]f1841ded5152/client.go:177"," msg":"HandShake with TWS or GateWay"} {"level":"info","ts":1694722816.3810427,"caller":"[email protected]f1841ded5152/client.go:223","msg":"handShake info","serverVersion":161}{"level":"info","ts": 1694722816.3811238,"caller":" [email protected]f1841ded5152/client.go:224"," msg":"handShake info","connectionTime":" 20230914 13:20:17 PST"} {"level":"info","ts": 1694722816.5943294,"caller":" [email protected]f1841ded5152/client.go:272"," msg":"HandShake completed"} {"level":"info","ts": 1694722816.5943744,"caller":" [email protected]f1841ded5152/client.go:3047"," msg":"run client"} Order: {"OrderID":212017,"ClientID": 1234,"PermID":0,"Action":"BUY" ,"TotalQuantity":10," OrderType":"MKT","LimitPrice": 1.7976931348623157e+308," AuxPrice":1.7976931348623157e+ 308,"TIF":"DAY"," ActiveStartTime":""," ActiveStopTime":"","OCAGroup": "","OCAType":0,"OrderRef":""," Transmit":true,"ParentID":0," BlockOrder":false," SweepToFill":false," DisplaySize":0,"TriggerMethod" :0,"OutsideRTH":false,"Hidden" :false,"GoodAfterTime":""," GoodTillDate":""," OverridePercentageConstraints" :false,"Rule80A":""," AllOrNone":false,"MinQty": 9223372036854775807," PercentOffset":1. 7976931348623157e+308," TrailStopPrice":1. 7976931348623157e+308," TrailingPercent":1. 7976931348623157e+308," FAGroup":"","FAProfile":""," FAMethod":"","FAPercentage":"" ,"OpenClose":"O","Origin":0," ShortSaleSlot":0," DesignatedLocation":""," ExemptCode":-1," DiscretionaryAmount":0," ETradeOnly":true," FirmQuoteOnly":true," NBBOPriceCap":1. 7976931348623157e+308," OptOutSmartRouting":false," AuctionStrategy":0," StartingPrice":1. 7976931348623157e+308," StockRefPrice":1. 7976931348623157e+308,"Delta": 1.7976931348623157e+308," StockRangeLower":1. 7976931348623157e+308," StockRangeUpper":1. 7976931348623157e+308," RandomizePrice":false," RandomizeSize":false," Volatility":1. 7976931348623157e+308," VolatilityType": 9223372036854775807," DeltaNeutralOrderType":""," DeltaNeutralAuxPrice":1. 7976931348623157e+308," DeltaNeutralContractID":0," DeltaNeutralSettlingFirm":""," DeltaNeutralClearingAccount":" ","DeltaNeutralClearingIntent" :"","DeltaNeutralOpenClose":"" ,"DeltaNeutralShortSale": false," DeltaNeutralShortSaleSlot":0," DeltaNeutralDesignatedLocation ":"","ContinuousUpdate":false, "ReferencePriceType": 9223372036854775807," BasisPoints":1. 7976931348623157e+308," BasisPointsType": 9223372036854775807," ScaleInitLevelSize": 9223372036854775807," ScaleSubsLevelSize": 9223372036854775807," ScalePriceIncrement":1. 7976931348623157e+308," ScalePriceAdjustValue":1. 7976931348623157e+308," ScalePriceAdjustInterval": 9223372036854775807," ScaleProfitOffset":1. 7976931348623157e+308," ScaleAutoReset":false," ScaleInitPosition": 9223372036854775807," ScaleInitFillQty": 9223372036854775807," ScaleRandomPercent":false," ScaleTable":""," NotSuppScaleNumComponents":0," HedgeType":"","HedgeParam":"", "Account":"","SettlingFirm":"" ,"ClearingAccount":""," ClearingIntent":""," AlgoStrategy":"","AlgoParams": null,"SmartComboRoutingParams" :null,"AlgoID":"","WhatIf": false,"NotHeld":false," Solictied":false,"ModelCode":" ","OrderComboLegs":null," OrderMiscOptions":null," ReferenceContractID":0," PeggedChangeAmount":0," IsPeggedChangeAmountDecrease": false,"ReferenceChangeAmount": 0,"ReferenceExchangeID":""," AdjustedOrderType":""," TriggerPrice":1. 7976931348623157e+308," AdjustedStopPrice":1. 7976931348623157e+308," AdjustedStopLimitPrice":1. 7976931348623157e+308," AdjustedTrailingAmount":1. 7976931348623157e+308," AdjustableTrailingUnit":0," LimitPriceOffset":1. 7976931348623157e+308," Conditions":null," ConditionsCancelOrder":false," ConditionsIgnoreRth":false," ExtOperator":"","CashQty":1. 7976931348623157e+308," Mifid2DecisionMaker":""," Mifid2DecisionAlgo":""," Mifid2ExecutionTrader":""," Mifid2ExecutionAlgo":""," DontUseAutoPriceForHedge": false,"IsOmsContainer":false," DiscretionaryUpToLimitPrice": false,"AutoCancelDate":""," FilledQuantity":1. 7976931348623157e+308," RefFuturesConID":0," AutoCancelParent":false," Shareholder":""," ImbalanceOnly":false," RouteMarketableToBbo":false," ParentPermID":0," UsePriceMgmtAlgo":false," Duration":9223372036854775807, "PostToAts": 9223372036854775807," SoftDollarTier":{"Name":""," Value":"","DisplayName":""}} Contract: {"ContractID":76792991," Symbol":"TSLA","SecurityType": "STK","Expiry":"","Strike":0," Right":"","Multiplier":""," Exchange":"SMART","Currency":" USD","LocalSymbol":"TSLA"," TradingClass":"NMS"," PrimaryExchange":"NASDAQ"," IncludeExpired":false," SecurityIDType":""," SecurityID":""," ComboLegsDescription":""," ComboLegs":null," DeltaNeutralContract":null}
Wrapper (my local time is GMT+1):
?
2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:27 ? ? ? ?<NextValidID> ? {"reqID": 211959} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:18 ? ? ? ?<ConnectAck>... 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2104, "errString": "Market data farm connection is OK:njinternal"} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2107, "errString": "HMDS data farm connection is inactive but should be available upon demand.njhmdsint"} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2158, "errString": "Sec-def data farm connection is OK:secdefnj"} 2023-09-14T21:20:16.685+0100 ? ?INFO ? ?ib/wrapper.go:216 ? ? ? <ContractDetails> ? ? ? {"reqID": 1, "conDetails": "ContractDetails<Contract: Contract<CondID: 76792991, Symbol: TSLA, SecurityType: STK, Exchange: SMART, Currency: USD>, MarketName: NMS, UnderContractID: 0, LongName: TESLA INC>"} 2023-09-14T21:20:16.809+0100 ? ?INFO ? ?ib/wrapper.go:222 ? ? ? <ContractDetailsEnd> ? ?{"reqID": 1} 2023-09-14T21:20:17.898+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:17.983+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd> 2023-09-14T21:20:18.774+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:18.858+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd> 2023-09-14T21:20:19.774+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:19.858+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd>
?
|
A closer look at historical TWS API source code revealed that TWS API version 161 was actually introduced more than two years ago (but less than three) n tws-api-9.85.2 and not 9.72 as I had suggested. We held on to 9.85.2 ourselves until earlier this year when we moved to API 10.19 (version 176) once our client framework and the most important applications properly supported Decimal size fields.
´³¨¹°ù²µ±ð²Ô
toggle quoted message
Show quoted text
On Thu, Sep 14, 2023 at 06:58 PM, ´³¨¹°ù²µ±ð²Ô Reinold wrote:
I suspect it is not since the GoLang API implements TWS API version 161 and we are at 178 now. Version 161 was introduced three years ago around TWS API 972.
Traditionally connecting clients that use "old API versions" worked just fine even if they were talking with brand-spanking-new TWS/IBGW. Client and TWS/IBGW negotiate the highest common API level during connection and limit the features they use to that level. API implementations provided by IBKR have lots of code just to make sure that works.
During the transition from 9xx versions to V10 TWS API, version 163 introduced "fractional sizes" and caused massive changes for all requests and responses that have a size/quantity field (orders, execution, commission, market data, historical data,....). Version 163 changed the data type for all those fields from Integer to Decimal and it was not just another addon-feature that can easily be ignored.
My suspicion is that your issue relates to the missing fractional size support by your client. The only real solution is to implement all missing API features up to and including to 163 (and probably even higher) in the GoLang TWS API implementation.
A short-term work-around may be that you look for the oldest standalone TWS/IBGW you can find. Hopefully that version is more tolerant to pre-163 clients. That may buy you some time to get the GoLang API upgraded but eventually, IBKR will force you to upgrade. I'd start with the current "latest" V10.19.
Massive changes took place in TWS/IBGW over the last three years and I wish I could tell you something else. But we finally moved from API 985 to 10.19 earlier in the year for similar reasons.
´³¨¹°ù²µ±ð²Ô
On Thu, Sep 14, 2023 at 06:06 PM, Franco Chiesa Docampo wrote:
Check if your golang implementation is compatible with the last stable version of TWS or IBGateway.
El 14 sep. 2023, a la(s) 17:46, unclekensson@... escribi¨®:
Connection:
?
{"level":"info","ts": 1694722816.2040021,"caller":" [email protected]f1841ded5152/client.go:107"," msg":"Connect to client","host":"[hostname]. com","port":4002,"clientID": 1234} {"level":"info","ts": 1694722816.293527,"caller":" [email protected]f1841ded5152/client.go:177"," msg":"HandShake with TWS or GateWay"} {"level":"info","ts":1694722816.3810427,"caller":"[email protected]f1841ded5152/client.go:223","msg":"handShake info","serverVersion":161}{"level":"info","ts": 1694722816.3811238,"caller":" [email protected]f1841ded5152/client.go:224"," msg":"handShake info","connectionTime":" 20230914 13:20:17 PST"} {"level":"info","ts": 1694722816.5943294,"caller":" [email protected]f1841ded5152/client.go:272"," msg":"HandShake completed"} {"level":"info","ts": 1694722816.5943744,"caller":" [email protected]f1841ded5152/client.go:3047"," msg":"run client"} Order: {"OrderID":212017,"ClientID": 1234,"PermID":0,"Action":"BUY" ,"TotalQuantity":10," OrderType":"MKT","LimitPrice": 1.7976931348623157e+308," AuxPrice":1.7976931348623157e+ 308,"TIF":"DAY"," ActiveStartTime":""," ActiveStopTime":"","OCAGroup": "","OCAType":0,"OrderRef":""," Transmit":true,"ParentID":0," BlockOrder":false," SweepToFill":false," DisplaySize":0,"TriggerMethod" :0,"OutsideRTH":false,"Hidden" :false,"GoodAfterTime":""," GoodTillDate":""," OverridePercentageConstraints" :false,"Rule80A":""," AllOrNone":false,"MinQty": 9223372036854775807," PercentOffset":1. 7976931348623157e+308," TrailStopPrice":1. 7976931348623157e+308," TrailingPercent":1. 7976931348623157e+308," FAGroup":"","FAProfile":""," FAMethod":"","FAPercentage":"" ,"OpenClose":"O","Origin":0," ShortSaleSlot":0," DesignatedLocation":""," ExemptCode":-1," DiscretionaryAmount":0," ETradeOnly":true," FirmQuoteOnly":true," NBBOPriceCap":1. 7976931348623157e+308," OptOutSmartRouting":false," AuctionStrategy":0," StartingPrice":1. 7976931348623157e+308," StockRefPrice":1. 7976931348623157e+308,"Delta": 1.7976931348623157e+308," StockRangeLower":1. 7976931348623157e+308," StockRangeUpper":1. 7976931348623157e+308," RandomizePrice":false," RandomizeSize":false," Volatility":1. 7976931348623157e+308," VolatilityType": 9223372036854775807," DeltaNeutralOrderType":""," DeltaNeutralAuxPrice":1. 7976931348623157e+308," DeltaNeutralContractID":0," DeltaNeutralSettlingFirm":""," DeltaNeutralClearingAccount":" ","DeltaNeutralClearingIntent" :"","DeltaNeutralOpenClose":"" ,"DeltaNeutralShortSale": false," DeltaNeutralShortSaleSlot":0," DeltaNeutralDesignatedLocation ":"","ContinuousUpdate":false, "ReferencePriceType": 9223372036854775807," BasisPoints":1. 7976931348623157e+308," BasisPointsType": 9223372036854775807," ScaleInitLevelSize": 9223372036854775807," ScaleSubsLevelSize": 9223372036854775807," ScalePriceIncrement":1. 7976931348623157e+308," ScalePriceAdjustValue":1. 7976931348623157e+308," ScalePriceAdjustInterval": 9223372036854775807," ScaleProfitOffset":1. 7976931348623157e+308," ScaleAutoReset":false," ScaleInitPosition": 9223372036854775807," ScaleInitFillQty": 9223372036854775807," ScaleRandomPercent":false," ScaleTable":""," NotSuppScaleNumComponents":0," HedgeType":"","HedgeParam":"", "Account":"","SettlingFirm":"" ,"ClearingAccount":""," ClearingIntent":""," AlgoStrategy":"","AlgoParams": null,"SmartComboRoutingParams" :null,"AlgoID":"","WhatIf": false,"NotHeld":false," Solictied":false,"ModelCode":" ","OrderComboLegs":null," OrderMiscOptions":null," ReferenceContractID":0," PeggedChangeAmount":0," IsPeggedChangeAmountDecrease": false,"ReferenceChangeAmount": 0,"ReferenceExchangeID":""," AdjustedOrderType":""," TriggerPrice":1. 7976931348623157e+308," AdjustedStopPrice":1. 7976931348623157e+308," AdjustedStopLimitPrice":1. 7976931348623157e+308," AdjustedTrailingAmount":1. 7976931348623157e+308," AdjustableTrailingUnit":0," LimitPriceOffset":1. 7976931348623157e+308," Conditions":null," ConditionsCancelOrder":false," ConditionsIgnoreRth":false," ExtOperator":"","CashQty":1. 7976931348623157e+308," Mifid2DecisionMaker":""," Mifid2DecisionAlgo":""," Mifid2ExecutionTrader":""," Mifid2ExecutionAlgo":""," DontUseAutoPriceForHedge": false,"IsOmsContainer":false," DiscretionaryUpToLimitPrice": false,"AutoCancelDate":""," FilledQuantity":1. 7976931348623157e+308," RefFuturesConID":0," AutoCancelParent":false," Shareholder":""," ImbalanceOnly":false," RouteMarketableToBbo":false," ParentPermID":0," UsePriceMgmtAlgo":false," Duration":9223372036854775807, "PostToAts": 9223372036854775807," SoftDollarTier":{"Name":""," Value":"","DisplayName":""}} Contract: {"ContractID":76792991," Symbol":"TSLA","SecurityType": "STK","Expiry":"","Strike":0," Right":"","Multiplier":""," Exchange":"SMART","Currency":" USD","LocalSymbol":"TSLA"," TradingClass":"NMS"," PrimaryExchange":"NASDAQ"," IncludeExpired":false," SecurityIDType":""," SecurityID":""," ComboLegsDescription":""," ComboLegs":null," DeltaNeutralContract":null}
Wrapper (my local time is GMT+1):
?
2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:27 ? ? ? ?<NextValidID> ? {"reqID": 211959} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:18 ? ? ? ?<ConnectAck>... 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2104, "errString": "Market data farm connection is OK:njinternal"} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2107, "errString": "HMDS data farm connection is inactive but should be available upon demand.njhmdsint"} 2023-09-14T21:20:16.594+0100 ? ?INFO ? ?ib/wrapper.go:573 ? ? ? <Error> {"reqID": -1, "errCode": 2158, "errString": "Sec-def data farm connection is OK:secdefnj"} 2023-09-14T21:20:16.685+0100 ? ?INFO ? ?ib/wrapper.go:216 ? ? ? <ContractDetails> ? ? ? {"reqID": 1, "conDetails": "ContractDetails<Contract: Contract<CondID: 76792991, Symbol: TSLA, SecurityType: STK, Exchange: SMART, Currency: USD>, MarketName: NMS, UnderContractID: 0, LongName: TESLA INC>"} 2023-09-14T21:20:16.809+0100 ? ?INFO ? ?ib/wrapper.go:222 ? ? ? <ContractDetailsEnd> ? ?{"reqID": 1} 2023-09-14T21:20:17.898+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:17.983+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd> 2023-09-14T21:20:18.774+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:18.858+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd> 2023-09-14T21:20:19.774+0100 ? ?INFO ? ?ib/wrapper.go:176 ? ? ? <OrderStatus> ? {"orderID": 212017, "status": "ApiPending", "filled": 0, "remaining": 10, "avgFillPrice": 0} 2023-09-14T21:20:19.858+0100 ? ?INFO ? ?ib/wrapper.go:171 ? ? ? <OpenOrderEnd>
?
|
Aha! That certainly looks like a plausible explanation. Thanks, ´³¨¹°ù²µ±ð²Ô! (And Franco!)
|
Hi Uncle, I managed to place a market MKT and LMT order by completing some fields in the PlaceOrder message buffer. Check it out here: . Hope it?helps.
toggle quoted message
Show quoted text
Aha! That certainly looks like a plausible explanation. Thanks, ´³¨¹°ù²µ±ð²Ô! (And Franco!)
|
I'm now having a seemingly identical problem using IB's python client -- I can only imagine I'm doing something boneheaded, but without documentation on the error, I'm a bit stuck.
Running on v177, I set up an order like so:
??????? con = Contract() ??????? con.conId = 76792991 ??????? con.symbol = "TSLA" ??????? con.secType = "STK" ??????? con.strike = 0. ??????? con.exchange = "SMART" ??????? con.primaryExchange = "NASDAQ" ??????? con.currency = "USD" ??????? con.tradingClass = "NMS" ??????? con.localSymbol = "TSLA"
??????? order = Order() ??????? order.action = "BUY" ??????? order.totalQuantity = 1. ??????? order.orderType = "MKT" ??????? order.tif = "IOC" ??????? order.account = "[account name]" ??????? app.placeOrder([order id], con, order)
This sends:
3-[order id]-76792991-TSLA-STK--0.0---SMART-NASDAQ-USD-TSLA-NMS---BUY-1.0-MKT---IOC--[account name]--0--1-0-0-0-0-0-0-0--0-------0---1-0---0---0-0--0------0-----0-----------0---0-0---0--0-0-0-0--1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-0----1.7976931348623157e+308-----0-0-0--2147483647-2147483647-0---
... but a call to openOrders gives
OrderStatus. Id: [order id] Status: ApiPending Filled: 0 Remaining: 1 AvgFillPrice: 0 PermId: 0 ParentId: 0 LastFillPrice: 0 ClientId: 3 WhyHeld:? MktCapPrice: 0
As I say, I imagine I'm setting something up incorrectly. If anyone can point me towards what (or even where to look), I'd be super grateful.
|
First of all, order status ApiPending is not an error condition. It is the state of your order(s) right after you placed them. And the section of the does provide high-level descriptions of when to expect the various order stats. They say for :
ApiPending - Indicates order has not yet been sent to IB server, for instance if there is a delay in receiving the security definition. Uncommonly received.
I'd review the contract definition and you should seriously think about requesting a well configured contract from IBKR via instead of initializing various fields yourselves. For example, I am not sure why you set a "strike" for am STK instrument, and initialize trading class, symbol, and local symbol will have important fields initialized with meaningful values.
And then you use a Time in Force of IOT. Does the behavior change if you place the order with a simpler TIF of, say GTC or DAY?
´³¨¹°ù²µ±ð²Ô
On Sun, Oct 1, 2023 at 03:22 PM, Colin Beveridge wrote:
I'm now having a seemingly identical problem using IB's python client -- I can only imagine I'm doing something boneheaded, but without documentation on the error, I'm a bit stuck.
Running on v177, I set up an order like so:
??????? con = Contract() ??????? con.conId = 76792991 ??????? con.symbol = "TSLA" ??????? con.secType = "STK" ??????? con.strike = 0. ??????? con.exchange = "SMART" ??????? con.primaryExchange = "NASDAQ" ??????? con.currency = "USD" ??????? con.tradingClass = "NMS" ??????? con.localSymbol = "TSLA"
??????? order = Order() ??????? order.action = "BUY" ??????? order.totalQuantity = 1. ??????? order.orderType = "MKT" ??????? order.tif = "IOC" ??????? order.account = "[account name]" ??????? app.placeOrder([order id], con, order)
This sends:
3-[order id]-76792991-TSLA-STK--0.0---SMART-NASDAQ-USD-TSLA-NMS---BUY-1.0-MKT---IOC--[account name]--0--1-0-0-0-0-0-0-0--0-------0---1-0---0---0-0--0------0-----0-----------0---0-0---0--0-0-0-0--1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-0----1.7976931348623157e+308-----0-0-0--2147483647-2147483647-0---
... but a call to openOrders gives
OrderStatus. Id: [order id] Status: ApiPending Filled: 0 Remaining: 1 AvgFillPrice: 0 PermId: 0 ParentId: 0 LastFillPrice: 0 ClientId: 3 WhyHeld:? MktCapPrice: 0
As I say, I imagine I'm setting something up incorrectly. If anyone can point me towards what (or even where to look), I'd be super grateful.
|
Thanks, ´³¨¹°ù²µ±ð²Ô, being less of a doofus with the contract definition seems to have helped.
?
(I had seen that documentation -- I stand by my opinion that it could be better documented; I think that "Uncommonly received" is a less helpful message than, say, "if this occurs repeatedly, check you are sending a properly-defined contract". In any case, I hope future people hitting the same problem[^0] will find this thread and find it helpful.) [^0]: Even if it's just me, I'm ok with that.
|