Documentation
¶
Overview ¶
Package codec owns the real IBKR message encode/decode layer on top of package wire, including handshake parsing and server-version-aware field layouts validated against grounded captures.
Index ¶
- func Encode(sv int, msg OutboundMessage) ([]byte, error)
- func EncodeHandshakePrefix() []byte
- func EncodeLegacyServer(sv int, msg LegacyServerMessage) ([]byte, error)
- func EncodeVersionRange(minVer, maxVer int) []byte
- type APIConfig
- type APIError
- type APIPrecautionsConfig
- type APISettingsConfig
- type AccountDownloadEnd
- type AccountSummaryEnd
- type AccountSummaryRequest
- type AccountSummaryValue
- type AccountUpdateMultiEnd
- type AccountUpdateMultiValue
- type AccountUpdatesMultiRequest
- type AccountUpdatesRequest
- type BondContractDetails
- type CalcImpliedVolatilityRequest
- type CalcOptionPriceRequest
- type CancelAccountSummary
- type CancelAccountUpdatesMulti
- type CancelCalcImpliedVolatility
- type CancelCalcOptionPrice
- type CancelContractData
- type CancelHeadTimestamp
- type CancelHistogramData
- type CancelHistoricalData
- type CancelHistoricalTicks
- type CancelMarketDepth
- type CancelNewsBulletins
- type CancelOpenOrders
- type CancelOrderRequest
- type CancelPnL
- type CancelPnLSingle
- type CancelPositions
- type CancelPositionsMulti
- type CancelQuote
- type CancelRealTimeBars
- type CancelScannerSubscription
- type CancelTickByTick
- type CancelWSHEventData
- type CancelWSHMetaData
- type ComboLeg
- type CommissionReport
- type CompletedOrder
- type CompletedOrderEnd
- type CompletedOrdersRequest
- type ConfigRequest
- type ConfigResponse
- type Contract
- type ContractDetails
- type ContractDetailsEnd
- type ContractDetailsRequest
- type CurrentTime
- type CurrentTimeMillis
- type CurrentTimeMillisRequest
- type CurrentTimeRequest
- type DeltaNeutralContract
- type DeltaNeutralValidation
- type DepthExchangeEntry
- type DisplayGroupList
- type DisplayGroupUpdated
- type ExecutionDetail
- type ExecutionsEnd
- type ExecutionsRequest
- type ExerciseOptionsRequest
- type FamilyCodeEntry
- type FamilyCodes
- type FamilyCodesRequest
- type FundDetails
- type GlobalCancelRequest
- type HeadTimestamp
- type HeadTimestampRequest
- type HistogramDataEntry
- type HistogramDataRequest
- type HistogramDataResponse
- type HistoricalBar
- type HistoricalBarsEnd
- type HistoricalBarsRequest
- type HistoricalDataUpdate
- type HistoricalNewsEnd
- type HistoricalNewsItem
- type HistoricalNewsRequest
- type HistoricalScheduleResponse
- type HistoricalScheduleSession
- type HistoricalTickBidAskEntry
- type HistoricalTickEntry
- type HistoricalTickLastEntry
- type HistoricalTicksBidAskResponse
- type HistoricalTicksLastResponse
- type HistoricalTicksRequest
- type HistoricalTicksResponse
- type IneligibilityReason
- type LegacyServerMessage
- type LockAndExitConfig
- type MalformedCorrelation
- type MalformedInbound
- type ManagedAccounts
- type ManagedAccountsRequest
- type MarketDataReroute
- type MarketDataType
- type MarketDepthL2Update
- type MarketDepthRequest
- type MarketDepthReroute
- type MarketDepthUpdate
- type MarketRule
- type MarketRuleRequest
- type MatchingSymbols
- type MatchingSymbolsRequest
- type Message
- type MessageConfig
- type MktDepthExchanges
- type MktDepthExchangesRequest
- type NewsArticleRequest
- type NewsArticleResponse
- type NewsBulletin
- type NewsBulletinsRequest
- type NewsProviderEntry
- type NewsProviders
- type NewsProvidersRequest
- type NextValidID
- type OpenOrder
- type OpenOrderEnd
- type OpenOrdersRequest
- type OrderAllocation
- type OrderBound
- type OrderCondition
- type OrderDetails
- type OrderStatus
- type OrdersConfig
- type OrdersSmartRoutingConfig
- type OutboundMessage
- type PlaceOrderRequest
- type PnLRequest
- type PnLSingleRequest
- type PnLSingleValue
- type PnLValue
- type Position
- type PositionEnd
- type PositionMulti
- type PositionMultiEnd
- type PositionsMultiRequest
- type PositionsRequest
- type PriceIncrement
- type QueryDisplayGroupsRequest
- type QuoteRequest
- type RealTimeBar
- type RealTimeBarsRequest
- type ReceiveFA
- type ReqIDer
- type ReqIDsRequest
- type ReqMarketDataType
- type RequestFA
- type ScannerDataEntry
- type ScannerDataResponse
- type ScannerParameters
- type ScannerParametersRequest
- type ScannerSubscriptionRequest
- type SecDefOptParamsEnd
- type SecDefOptParamsRequest
- type SecDefOptParamsResponse
- type ServerInfo
- type SmartComponentEntry
- type SmartComponentsRequest
- type SmartComponentsResponse
- type SoftDollarTier
- type SoftDollarTiersRequest
- type SoftDollarTiersResponse
- type StartAPI
- type SubscribeToGroupEventsRequest
- type SymbolSample
- type TagValue
- type TickByTickData
- type TickByTickRequest
- type TickEFP
- type TickGeneric
- type TickNews
- type TickOptionComputation
- type TickPrice
- type TickReqParams
- type TickSize
- type TickSnapshotEnd
- type TickString
- type UnknownInbound
- type UnsubscribeFromGroupEventsRequest
- type UpdateAccountTime
- type UpdateAccountValue
- type UpdateDisplayGroupRequest
- type UpdatePortfolio
- type UserInfo
- type UserInfoRequest
- type WSHEventDataRequest
- type WSHEventDataResponse
- type WSHMetaDataRequest
- type WSHMetaDataResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
func Encode(sv int, msg OutboundMessage) ([]byte, error)
Encode encodes a message in the real TWS wire format (integer msg_id prefix).
func EncodeHandshakePrefix ¶
func EncodeHandshakePrefix() []byte
EncodeHandshakePrefix returns the raw API prefix bytes sent before framing begins.
func EncodeLegacyServer ¶
func EncodeLegacyServer(sv int, msg LegacyServerMessage) ([]byte, error)
EncodeLegacyServer encodes one of the testhost's retained symbolic server fixtures in the classic wire format. Production client traffic uses Encode.
func EncodeVersionRange ¶
EncodeVersionRange returns the version negotiation payload (to be length-framed by caller).
Types ¶
type APIConfig ¶
type APIConfig struct {
Precautions *APIPrecautionsConfig
Settings *APISettingsConfig
}
type APIPrecautionsConfig ¶
type APIPrecautionsConfig struct {
BypassOrderPrecautions *bool
BypassBondWarning *bool
BypassNegativeYieldConfirmation *bool
BypassCalledBondWarning *bool
BypassSameActionPairTradeWarning *bool
BypassFlaggedAccountsWarning *bool
BypassPriceBasedVolatilityWarning *bool
BypassRedirectOrderWarning *bool
BypassNoOverfillProtection *bool
BypassRouteMarketableToBBO *bool
}
type APISettingsConfig ¶
type APISettingsConfig struct {
ReadOnlyAPI *bool
TotalQuantityForMutualFunds *bool
DownloadOpenOrdersOnConnection *bool
IncludeVirtualFXPositions *bool
PrepareDailyPnL *bool
SendStatusUpdatesForVolatilityOrders *bool
EncodeAPIMessages *string
SocketPort *int
UseNegativeAutoRange *bool
CreateAPIMessageLogFile *bool
IncludeMarketDataInLogFile *bool
ExposeTradingScheduleToAPI *bool
SplitInsuredDepositFromCashBalance *bool
SendZeroPositionsForTodayOnly *bool
LetAPIAccountRequestsSwitchSubscription *bool
UseAccountGroupsWithAllocationMethods *bool
LoggingLevel *string
MasterClientID *int
BulkDataTimeout *int
ComponentExchangeSeparator *string
ShowForexDataInOneTenthPips *bool
AllowForexTradingInOneTenthPips *bool
RoundAccountValuesToNearestWholeNumber *bool
SendMarketDataInLotsForUSStocks *bool
ShowAdvancedOrderRejectInUI *bool
RejectMessagesAboveMaxRate *bool
MaintainConnectionOnIncorrectFields *bool
CompatibilityModeNASDAQStocks *bool
SendInstrumentTimezone *string
SendForexDataInCompatibilityMode *bool
MaintainAndResubmitOrdersOnReconnect *bool
HistoricalDataMaxSize *int
AutoReportNettingEventContractTrades *bool
OptionExerciseRequestType *string
AllowLocalhostOnly *bool
TrustedIPs []string
}
type AccountDownloadEnd ¶
type AccountDownloadEnd struct {
Account string
}
type AccountSummaryEnd ¶
type AccountSummaryEnd struct {
ReqID int
}
func (AccountSummaryEnd) RequestID ¶
func (m AccountSummaryEnd) RequestID() int
type AccountSummaryRequest ¶
type AccountSummaryValue ¶
type AccountSummaryValue struct {
ReqID int
Account string
Tag string
Value string
Currency string
}
func (AccountSummaryValue) RequestID ¶
func (m AccountSummaryValue) RequestID() int
type AccountUpdateMultiEnd ¶
type AccountUpdateMultiEnd struct {
ReqID int
}
func (AccountUpdateMultiEnd) RequestID ¶
func (m AccountUpdateMultiEnd) RequestID() int
type AccountUpdateMultiValue ¶
type AccountUpdateMultiValue struct {
ReqID int
Account string
ModelCode string
Key string
Value string
Currency string
}
func (AccountUpdateMultiValue) RequestID ¶
func (m AccountUpdateMultiValue) RequestID() int
type AccountUpdatesRequest ¶
type BondContractDetails ¶
type BondContractDetails struct {
ContractDetails
CUSIP string
Coupon string
Maturity string
IssueDate string
Ratings string
BondType string
CouponType string
Convertible bool
Callable bool
Putable bool
DescriptionAppend string
NextOptionDate string
NextOptionType string
NextOptionPartial bool
Notes string
}
BondContractDetails is the distinct classic message-18 response used for bonds. ContractDetails carries the common fields shared with message 10; the remaining fields retain the official bond callback shape.
func (BondContractDetails) RequestID ¶
func (m BondContractDetails) RequestID() int
type CalcOptionPriceRequest ¶
type CancelAccountSummary ¶
type CancelAccountSummary struct {
ReqID int
}
type CancelAccountUpdatesMulti ¶
type CancelAccountUpdatesMulti struct {
ReqID int
}
type CancelCalcImpliedVolatility ¶
type CancelCalcImpliedVolatility struct {
ReqID int
}
type CancelCalcOptionPrice ¶
type CancelCalcOptionPrice struct {
ReqID int
}
type CancelContractData ¶
type CancelContractData struct {
ReqID int
}
CancelContractData cancels an in-flight contract-details request. The Gateway introduced this as a protobuf-only message at server_version 215.
type CancelHeadTimestamp ¶
type CancelHeadTimestamp struct {
ReqID int
}
type CancelHistogramData ¶
type CancelHistogramData struct {
ReqID int
}
type CancelHistoricalData ¶
type CancelHistoricalData struct {
ReqID int
}
type CancelHistoricalTicks ¶
type CancelHistoricalTicks struct {
ReqID int
}
CancelHistoricalTicks cancels an in-flight historical-ticks request. The Gateway introduced this as a protobuf-only message at server_version 215.
type CancelMarketDepth ¶
type CancelNewsBulletins ¶
type CancelNewsBulletins struct{}
type CancelOpenOrders ¶
type CancelOpenOrders struct{}
type CancelOrderRequest ¶
type CancelOrderRequest struct {
OrderID int64
ManualOrderCancelTime string
ExtOperator string
ManualOrderIndicator string // empty = UNSET
}
CancelOrderRequest cancels an order (outbound msg_id=4).
type CancelPnLSingle ¶
type CancelPnLSingle struct {
ReqID int
}
type CancelPositions ¶
type CancelPositions struct{}
type CancelPositionsMulti ¶
type CancelPositionsMulti struct {
ReqID int
}
type CancelQuote ¶
type CancelQuote struct {
ReqID int
}
type CancelRealTimeBars ¶
type CancelRealTimeBars struct {
ReqID int
}
type CancelScannerSubscription ¶
type CancelScannerSubscription struct {
ReqID int
}
type CancelTickByTick ¶
type CancelTickByTick struct {
ReqID int
}
type CancelWSHEventData ¶
type CancelWSHEventData struct {
ReqID int
}
type CancelWSHMetaData ¶
type CancelWSHMetaData struct {
ReqID int
}
type CommissionReport ¶
type CompletedOrder ¶
type CompletedOrder struct {
OrderDetails
}
type CompletedOrderEnd ¶
type CompletedOrderEnd struct{}
type CompletedOrdersRequest ¶
type CompletedOrdersRequest struct {
APIOnly bool
}
type ConfigRequest ¶
type ConfigRequest struct {
ReqID int
}
type ConfigResponse ¶
type ConfigResponse struct {
ReqID int
LockAndExit *LockAndExitConfig
Messages []MessageConfig
API *APIConfig
Orders *OrdersConfig
}
func (ConfigResponse) RequestID ¶
func (m ConfigResponse) RequestID() int
type Contract ¶
type Contract struct {
ConID int
Symbol string
SecType string
Expiry string
Strike string
Right string
Multiplier string
Exchange string
Currency string
LocalSymbol string
TradingClass string
PrimaryExchange string
IncludeExpired bool
SecurityIDType string
SecurityID string
IssuerID string
ComboLegs []ComboLeg
DeltaNeutral *DeltaNeutralContract
}
Contract is the canonical internal contract model. Classic encoders select the request-specific subset they own; protobuf encoders use the complete shared Contract schema.
type ContractDetails ¶
type ContractDetails struct {
ReqID int
Contract Contract
MarketName string
MinTick string
PriceMagnifier int
OrderTypes string
ValidExchanges string
UnderConID int
LongName string
ContractMonth string
Industry string
Category string
Subcategory string
TimeZoneID string
TradingHours string
LiquidHours string
EconomicValueRule string
EconomicValueMultiplier string
SecurityIDs []TagValue
AggGroup int
UnderSymbol string
UnderSecType string
MarketRuleIDs string
RealExpirationDate string
LastTradeDate string
LastTradeTime string
StockType string
MinSize string
SizeIncrement string
SuggestedSizeIncrement string
EventContract1 string
EventContractDescription1 string
EventContractDescription2 string
MinAlgoSize string
LastPricePrecision string
LastSizePrecision string
Fund *FundDetails
IneligibilityReasons []IneligibilityReason
}
func (ContractDetails) RequestID ¶
func (m ContractDetails) RequestID() int
type ContractDetailsEnd ¶
type ContractDetailsEnd struct {
ReqID int
}
func (ContractDetailsEnd) RequestID ¶
func (m ContractDetailsEnd) RequestID() int
type ContractDetailsRequest ¶
type CurrentTime ¶
type CurrentTime struct {
Time string
}
type CurrentTimeMillis ¶
type CurrentTimeMillis struct {
TimeMs string
}
CurrentTimeMillis is the inbound currentTimeInMillis frame (IN 109): the server epoch time in milliseconds, no version field.
type CurrentTimeMillisRequest ¶
type CurrentTimeMillisRequest struct{}
CurrentTimeMillisRequest is the outbound reqCurrentTimeInMillis message (OUT 105): the bare message id with no version or fields, answered by a CurrentTimeMillis frame (IN 109).
type CurrentTimeRequest ¶
type CurrentTimeRequest struct{}
CurrentTimeRequest is the outbound reqCurrentTime message (OUT 49). The server responds asynchronously with a CurrentTime frame using the same numeric msg_id.
type DeltaNeutralContract ¶
type DeltaNeutralValidation ¶
type DeltaNeutralValidation struct {
ReqID int
Contract DeltaNeutralContract
}
func (DeltaNeutralValidation) RequestID ¶
func (m DeltaNeutralValidation) RequestID() int
type DepthExchangeEntry ¶
type DisplayGroupList ¶
func (DisplayGroupList) RequestID ¶
func (m DisplayGroupList) RequestID() int
type DisplayGroupUpdated ¶
func (DisplayGroupUpdated) RequestID ¶
func (m DisplayGroupUpdated) RequestID() int
type ExecutionDetail ¶
type ExecutionDetail struct {
ReqID int
OrderID int64
Contract Contract
ExecID string
Time string
Account string
Exchange string
Side string
Price string
PermID string
ClientID string
Liquidation string
CumulativeQuantity string
AveragePrice string
OrderRef string
EconomicValueRule string
EconomicValueMultiplier string
ModelCode string
LastLiquidity string
PendingPriceRevision string
Submitter string
OptExerciseOrLapseType string
}
func (ExecutionDetail) RequestID ¶
func (m ExecutionDetail) RequestID() int
type ExecutionsEnd ¶
type ExecutionsEnd struct {
ReqID int
}
func (ExecutionsEnd) RequestID ¶
func (m ExecutionsEnd) RequestID() int
type ExecutionsRequest ¶
type ExerciseOptionsRequest ¶
type FamilyCodeEntry ¶
type FamilyCodes ¶
type FamilyCodes struct {
Codes []FamilyCodeEntry
}
type FamilyCodesRequest ¶
type FamilyCodesRequest struct{}
type FundDetails ¶
type FundDetails struct {
Name string
Family string
Type string
FrontLoad string
BackLoad string
BackLoadTimeInterval string
ManagementFee string
Closed bool
ClosedForNewInvestors bool
ClosedForNewMoney bool
NotifyAmount string
MinimumInitialPurchase string
MinimumSubsequentPurchase string
BlueSkyStates string
BlueSkyTerritories string
DistributionPolicy string
AssetType string
}
type GlobalCancelRequest ¶
GlobalCancelRequest cancels all open orders (outbound msg_id=58).
type HeadTimestamp ¶
func (HeadTimestamp) RequestID ¶
func (m HeadTimestamp) RequestID() int
type HeadTimestampRequest ¶
type HistogramDataEntry ¶
type HistogramDataRequest ¶
type HistogramDataResponse ¶
type HistogramDataResponse struct {
ReqID int
Entries []HistogramDataEntry
}
func (HistogramDataResponse) RequestID ¶
func (m HistogramDataResponse) RequestID() int
type HistoricalBar ¶
type HistoricalBar struct {
ReqID int
Time string
Open string
High string
Low string
Close string
Volume string
WAP string
Count string
}
func (HistoricalBar) RequestID ¶
func (m HistoricalBar) RequestID() int
type HistoricalBarsEnd ¶
type HistoricalBarsEnd struct {
ReqID int
// StartDate and EndDate carry the dataset bounds echoed by the terminal
// IN 108 marker. Some live captures omit EndDate.
StartDate string
EndDate string
}
func (HistoricalBarsEnd) RequestID ¶
func (m HistoricalBarsEnd) RequestID() int
type HistoricalBarsRequest ¶
type HistoricalDataUpdate ¶
type HistoricalDataUpdate struct {
ReqID int
BarCount int
Time string
Open string
High string
Low string
Close string
Volume string
WAP string
}
func (HistoricalDataUpdate) RequestID ¶
func (m HistoricalDataUpdate) RequestID() int
type HistoricalNewsEnd ¶
func (HistoricalNewsEnd) RequestID ¶
func (m HistoricalNewsEnd) RequestID() int
type HistoricalNewsItem ¶
type HistoricalNewsItem struct {
ReqID int
Time string
ProviderCode string
ArticleID string
Headline string
}
func (HistoricalNewsItem) RequestID ¶
func (m HistoricalNewsItem) RequestID() int
type HistoricalNewsRequest ¶
type HistoricalScheduleResponse ¶
type HistoricalScheduleResponse struct {
ReqID int
StartDateTime string
EndDateTime string
TimeZone string
Sessions []HistoricalScheduleSession
}
HistoricalScheduleResponse is the decoded inbound response to a REQ_HISTORICAL_DATA request with whatToShow=SCHEDULE. Each session entry describes one contiguous trading window inside the requested duration. Live evidence: server_version 200 emits msg_id 106 with 5 header fields (reqID, startDateTime, endDateTime, timeZone, sessionCount) followed by 3 fields per session.
func (HistoricalScheduleResponse) RequestID ¶
func (m HistoricalScheduleResponse) RequestID() int
type HistoricalScheduleSession ¶
HistoricalScheduleSession describes one trading session entry inside a HistoricalScheduleResponse. IBKR emits three string fields per session: StartDateTime, EndDateTime, and RefDate (the calendar date the session belongs to, useful when a session crosses midnight).
type HistoricalTickEntry ¶
type HistoricalTickLastEntry ¶
type HistoricalTicksBidAskResponse ¶
type HistoricalTicksBidAskResponse struct {
ReqID int
Ticks []HistoricalTickBidAskEntry
Done bool
}
func (HistoricalTicksBidAskResponse) RequestID ¶
func (m HistoricalTicksBidAskResponse) RequestID() int
type HistoricalTicksLastResponse ¶
type HistoricalTicksLastResponse struct {
ReqID int
Ticks []HistoricalTickLastEntry
Done bool
}
func (HistoricalTicksLastResponse) RequestID ¶
func (m HistoricalTicksLastResponse) RequestID() int
type HistoricalTicksRequest ¶
type HistoricalTicksResponse ¶
type HistoricalTicksResponse struct {
ReqID int
Ticks []HistoricalTickEntry
Done bool
}
func (HistoricalTicksResponse) RequestID ¶
func (m HistoricalTicksResponse) RequestID() int
type IneligibilityReason ¶
type LegacyServerMessage ¶
type LegacyServerMessage interface {
// contains filtered or unexported methods
}
LegacyServerMessage is a Gateway-to-client message retained only for the testhost's legacy symbolic server fixtures. New replay coverage uses raw, captured server frames instead.
type LockAndExitConfig ¶
type MalformedCorrelation ¶
type MalformedCorrelation struct {
RequestID int
}
MalformedCorrelation is routing identity recovered by a message-specific classic layout after the outer frame boundary succeeded. It is deliberately absent for generic/protobuf recovery: a partial protobuf scan cannot prove last-one-wins singular-field identity.
type MalformedInbound ¶
type MalformedInbound struct {
MsgID int
Encoding protocol.BodyEncoding
Fields []string
Payload []byte
Correlation *MalformedCorrelation
Err error
}
MalformedInbound carries a self-contained frame with a trustworthy message ID whose body violates classic framing or did not match its registered decoder. The frame boundary remains trustworthy, so callers can report and skip this message without tearing down unrelated routes on the connection.
type ManagedAccounts ¶
type ManagedAccounts struct {
Accounts []string
}
type ManagedAccountsRequest ¶
type ManagedAccountsRequest struct{}
ManagedAccountsRequest is the outbound reqManagedAccts message (OUT 17). The server answers with the same ManagedAccounts callback used at bootstrap.
type MarketDataReroute ¶
func (MarketDataReroute) RequestID ¶
func (m MarketDataReroute) RequestID() int
type MarketDataType ¶
func (MarketDataType) RequestID ¶
func (m MarketDataType) RequestID() int
type MarketDepthL2Update ¶
type MarketDepthL2Update struct {
ReqID int
Position int
MarketMaker string
Operation int
Side int
Price string
Size string
IsSmartDepth bool
}
func (MarketDepthL2Update) RequestID ¶
func (m MarketDepthL2Update) RequestID() int
type MarketDepthRequest ¶
type MarketDepthReroute ¶
func (MarketDepthReroute) RequestID ¶
func (m MarketDepthReroute) RequestID() int
type MarketDepthUpdate ¶
type MarketDepthUpdate struct {
ReqID int
Position int
Operation int // 0=insert, 1=update, 2=delete
Side int // 0=ask, 1=bid
Price string
Size string
}
func (MarketDepthUpdate) RequestID ¶
func (m MarketDepthUpdate) RequestID() int
type MarketRule ¶
type MarketRule struct {
MarketRuleID int
Increments []PriceIncrement
}
type MarketRuleRequest ¶
type MarketRuleRequest struct {
MarketRuleID int
}
type MatchingSymbols ¶
type MatchingSymbols struct {
ReqID int
Symbols []SymbolSample
}
func (MatchingSymbols) RequestID ¶
func (m MatchingSymbols) RequestID() int
type MatchingSymbolsRequest ¶
type Message ¶
type Message any
Message is a decoded wire message.
type MessageConfig ¶
type MktDepthExchanges ¶
type MktDepthExchanges struct {
Exchanges []DepthExchangeEntry
}
type MktDepthExchangesRequest ¶
type MktDepthExchangesRequest struct{}
type NewsArticleRequest ¶
type NewsArticleResponse ¶
func (NewsArticleResponse) RequestID ¶
func (m NewsArticleResponse) RequestID() int
type NewsBulletin ¶
type NewsBulletinsRequest ¶
type NewsBulletinsRequest struct {
AllMessages bool
}
type NewsProviderEntry ¶
type NewsProviders ¶
type NewsProviders struct {
Providers []NewsProviderEntry
}
type NewsProvidersRequest ¶
type NewsProvidersRequest struct{}
type NextValidID ¶
type NextValidID struct {
OrderID int64
}
type OpenOrder ¶
type OpenOrder struct {
OrderID int64
OrderDetails
// Status at wire position r[92] of the live sv200 layout.
Status string
// OrderState margin/commission section (follows Status on the wire).
InitMarginBefore string
MaintMarginBefore string
EquityWithLoanBefore string
InitMarginChange string
MaintMarginChange string
EquityWithLoanChange string
InitMarginAfter string
MaintMarginAfter string
EquityWithLoanAfter string
Commission string
MinCommission string
MaxCommission string
CommissionCurrency string
MarginCurrency string
InitMarginBeforeOutsideRTH string
MaintMarginBeforeOutsideRTH string
EquityWithLoanBeforeOutsideRTH string
InitMarginChangeOutsideRTH string
MaintMarginChangeOutsideRTH string
EquityWithLoanChangeOutsideRTH string
InitMarginAfterOutsideRTH string
MaintMarginAfterOutsideRTH string
EquityWithLoanAfterOutsideRTH string
SuggestedSize string
RejectReason string
Allocations []OrderAllocation
WarningText string
}
type OpenOrderEnd ¶
type OpenOrderEnd struct{}
type OpenOrdersRequest ¶
type OpenOrdersRequest struct {
Scope string
}
type OrderAllocation ¶
type OrderBound ¶
type OrderCondition ¶
type OrderDetails ¶
type OrderDetails struct {
Contract Contract
ClientID string
OrderID string
ParentID string
Action string
Quantity string
OrderType string
LmtPrice string
AuxPrice string
TIF string
OcaGroup string
Account string
OpenClose string
Origin string
OrderRef string
PermID string
OutsideRTH string
Hidden string
DiscretionAmt string
GoodAfterTime string
Transmit string
FAGroup string
FAMethod string
FAPercentage string
ModelCode string
GoodTillDate string
Rule80A string
PercentOffset string
SettlingFirm string
ShortSaleSlot string
DesignatedLocation string
ExemptCode string
AuctionStrategy string
StartingPrice string
StockRefPrice string
Delta string
StockRangeLower string
StockRangeUpper string
DisplaySize string
SweepToFill string
AllOrNone string
MinQty string
OcaType string
TriggerMethod string
Volatility string
VolatilityType string
DeltaNeutralOrderType string
DeltaNeutralAuxPrice string
DeltaNeutralConID string
DeltaNeutralShortSale string
DeltaNeutralShortSaleSlot string
DeltaNeutralDesignatedLocation string
ContinuousUpdate string
ReferencePriceType string
TrailStopPrice string
TrailingPercent string
ComboLegsDescription string
OrderComboLegPrices []string
SmartComboRouting []TagValue
ScaleInitLevelSize string
ScaleSubsLevelSize string
ScalePriceIncrement string
ScalePriceAdjustValue string
ScalePriceAdjustInterval string
ScaleProfitOffset string
ScaleAutoReset string
ScaleInitPosition string
ScaleInitFillQty string
ScaleRandomPercent string
ScaleTable string
ActiveStartTime string
ActiveStopTime string
HedgeType string
HedgeParam string
HedgeMaxSize string
ClearingAccount string
ClearingIntent string
NotHeld string
AlgoStrategy string
AlgoParams []TagValue
Solicited string
WhatIf string
Status string
RandomizeSize string
RandomizePrice string
ReferenceContractID string
PeggedChangeAmountDecrease string
PeggedChangeAmount string
ReferenceChangeAmount string
ReferenceExchangeID string
Conditions []OrderCondition
ConditionsIgnoreRTH string
ConditionsCancelOrder string
AdjustedOrderType string
TriggerPrice string
StopPrice string
LmtPriceOffset string
AdjustedStopPrice string
AdjustedStopLimitPrice string
AdjustedTrailingAmount string
AdjustableTrailingUnit string
CashQty string
DontUseAutoPriceForHedge string
UsePriceMgmtAlgo string
AdvancedErrorOverride string
ManualOrderTime string
Deactivate string
PostOnly string
AllowPreOpen string
IgnoreOpenAuction string
SeekPriceImprovement string
WhatIfType string
IsOMSContainer string
AutoCancelDate string
Filled string
RefFuturesConID string
AutoCancelParent string
ImbalanceOnly string
RouteMarketableToBBO string
ParentPermID string
CompletedTime string
CompletedStatus string
MinTradeQty string
MinCompeteSize string
CompeteAgainstBestOffset string
MidOffsetAtWhole string
MidOffsetAtHalf string
CustomerAccount string
ProfessionalCustomer string
IncludeOvernight string
Submitter string
CommissionAndFees string
CommissionCurrency string
}
type OrderStatus ¶
type OrdersConfig ¶
type OrdersConfig struct {
SmartRouting *OrdersSmartRoutingConfig
}
type OutboundMessage ¶
type OutboundMessage interface {
// contains filtered or unexported methods
}
OutboundMessage is a client-to-Gateway message accepted by Encode. Its unexported method keeps wire encoding owned by this package.
type PlaceOrderRequest ¶
type PlaceOrderRequest struct {
OrderID int64
Contract Contract // 14 wire fields: conId through secId
// Core order fields
Action string // "BUY", "SELL", "SSHORT", "SLONG"
TotalQuantity string // decimal string
OrderType string // "MKT", "LMT", "STP", "STP LMT", "TRAIL", etc.
LmtPrice string // empty = UNSET
AuxPrice string // empty = UNSET
// Extended order fields
TIF string // "DAY", "GTC", "IOC", "GTD", "OPG", "FOK", "DTC"
OcaGroup string
Account string
OpenClose string
Origin string // "0" = customer
OrderRef string
Transmit string // "0" or "1"
ParentID string // "0" = no parent
BlockOrder string
SweepToFill string
DisplaySize string // always a decimal digit; "0" = unset iceberg display
TriggerMethod string // always a decimal digit; "0" = Default
OutsideRTH string
Hidden string
OrderComboLegPrices []string
SmartComboRoutingParams []TagValue
// FA fields
FAGroup string
FAMethod string
FAPercentage string
ModelCode string
// Short sale
ShortSaleSlot string
DesignatedLocation string
ExemptCode string // "-1" default
// Order type extensions
DiscretionaryAmt string
GoodAfterTime string
GoodTillDate string
OcaType string
Rule80A string
SettlingFirm string
AllOrNone string
MinQty string // empty = UNSET
PercentOffset string // empty = UNSET
AuctionStrategy string
StartingPrice string // empty = UNSET
StockRefPrice string // empty = UNSET
Delta string // empty = UNSET
StockRangeLower string // empty = UNSET
StockRangeUpper string // empty = UNSET
OverridePercentageConstraints string
// Volatility
Volatility string // empty = UNSET
VolatilityType string // empty = UNSET
DeltaNeutralOrderType string
DeltaNeutralAuxPrice string // empty = UNSET
ContinuousUpdate string
ReferencePriceType string // empty = UNSET
// Trailing
TrailStopPrice string // empty = UNSET
TrailingPercent string // empty = UNSET
// Scale
ScaleInitLevelSize string // empty = UNSET
ScaleSubsLevelSize string // empty = UNSET
ScalePriceIncrement string // empty = UNSET
ScalePriceAdjustValue string // empty = UNSET
ScalePriceAdjustInterval string // empty = UNSET
ScaleProfitOffset string // empty = UNSET
ScaleAutoReset string // empty = UNSET
ScaleInitPosition string // empty = UNSET
ScaleInitFillQty string // empty = UNSET
ScaleRandomPercent string // empty = UNSET
ScaleTable string
ActiveStartTime string
ActiveStopTime string
// Hedge
HedgeType string
HedgeParam string
// Misc
OptOutSmartRouting string
ClearingAccount string
ClearingIntent string
NotHeld string
AlgoStrategy string
AlgoParams []TagValue
AlgoID string
WhatIf string
OrderMiscOptions string
Solicited string
RandomizeSize string
RandomizePrice string
ReferenceContractID string
PeggedChangeAmountDecrease string
PeggedChangeAmount string
ReferenceChangeAmount string
ReferenceExchangeID string
// Conditions
Conditions []OrderCondition
ConditionsIgnoreRTH string
ConditionsCancelOrder string
// Adjusted order type
AdjustedOrderType string
TriggerPrice string // empty = UNSET
LmtPriceOffset string // empty = UNSET
AdjustedStopPrice string // empty = UNSET
AdjustedStopLimitPrice string // empty = UNSET
AdjustedTrailingAmount string // empty = UNSET
AdjustableTrailingUnit string
// Ext operator + soft dollar
ExtOperator string
SoftDollarName string
SoftDollarValue string
// Cash, MIFID, flags
CashQty string // empty = UNSET
Mifid2DecisionMaker string
Mifid2DecisionAlgo string
Mifid2ExecutionTrader string
Mifid2ExecutionAlgo string
DontUseAutoPriceForHedge string
IsOmsContainer string
DiscretionaryUpToLimitPrice string
UsePriceMgmtAlgo string // empty = UNSET
Duration string // empty = UNSET
PostToAts string // empty = UNSET
AutoCancelParent string
AdvancedErrorOverride string
ManualOrderTime string
CustomerAccount string
ProfessionalCustomer string
IncludeOvernight string
ManualOrderIndicator string // empty = UNSET
ImbalanceOnly string
Deactivate string
PostOnly string
AllowPreOpen string
IgnoreOpenAuction string
RouteMarketableToBBO string // empty = server default; 0 or 1 when explicit
SeekPriceImprovement string // empty = server default; 0 or 1 when explicit
WhatIfType string // empty = UNSET
HedgeMaxSize string // empty = UNSET
AttachedStopLossOrderID int64
AttachedStopLossOrderType string
AttachedTakeProfitOrderID int64
AttachedTakeProfitOrderType string
}
PlaceOrderRequest encodes a new or modified order (outbound msg_id=3). At server_version >= 145 there is no version field. All fields are strings on the wire; UNSET float/int values are encoded as empty string "".
type PnLRequest ¶
type PnLSingleRequest ¶
type PnLSingleValue ¶
type PnLSingleValue struct {
ReqID int
Position string
DailyPnL string
UnrealizedPnL string
RealizedPnL string
Value string
}
func (PnLSingleValue) RequestID ¶
func (m PnLSingleValue) RequestID() int
type PositionEnd ¶
type PositionEnd struct{}
type PositionMulti ¶
type PositionMulti struct {
ReqID int
Account string
ModelCode string
Contract Contract
Position string
AvgCost string
}
func (PositionMulti) RequestID ¶
func (m PositionMulti) RequestID() int
type PositionMultiEnd ¶
type PositionMultiEnd struct {
ReqID int
}
func (PositionMultiEnd) RequestID ¶
func (m PositionMultiEnd) RequestID() int
type PositionsMultiRequest ¶
type PositionsRequest ¶
type PositionsRequest struct{}
type PriceIncrement ¶
type QueryDisplayGroupsRequest ¶
type QueryDisplayGroupsRequest struct {
ReqID int
}
type QuoteRequest ¶
type RealTimeBar ¶
type RealTimeBar struct {
ReqID int
Time string
Open string
High string
Low string
Close string
Volume string
WAP string
Count string
}
func (RealTimeBar) RequestID ¶
func (m RealTimeBar) RequestID() int
type RealTimeBarsRequest ¶
type ReqIDer ¶
type ReqIDer interface{ RequestID() int }
ReqIDer is implemented by every inbound message the engine routes by request ID. OpenOrder, OrderStatus, and CompletedOrder deliberately do not implement it: they carry an order ID, not a request ID, and route through the order-handle dispatch instead.
type ReqIDsRequest ¶
type ReqIDsRequest struct {
NumIDs int
}
ReqIDsRequest is the outbound reqIds message (OUT 8). The server responds with a NextValidID frame (msg_id 9) carrying the next available order ID. NumIDs is a legacy parameter kept at 1 in the official EClient.
type ReqMarketDataType ¶
type ReqMarketDataType struct {
DataType int
}
type ScannerDataEntry ¶
type ScannerDataResponse ¶
type ScannerDataResponse struct {
ReqID int
Entries []ScannerDataEntry
}
func (ScannerDataResponse) RequestID ¶
func (m ScannerDataResponse) RequestID() int
type ScannerParameters ¶
type ScannerParameters struct {
XML string
}
type ScannerParametersRequest ¶
type ScannerParametersRequest struct{}
type ScannerSubscriptionRequest ¶
type ScannerSubscriptionRequest struct {
ReqID int
NumberOfRows int
Instrument string
LocationCode string
ScanCode string
AbovePrice string
BelowPrice string
AboveVolume string
MarketCapAbove string
MarketCapBelow string
MoodyRatingAbove string
MoodyRatingBelow string
SPRatingAbove string
SPRatingBelow string
MaturityDateAbove string
MaturityDateBelow string
CouponRateAbove string
CouponRateBelow string
ExcludeConvertible string
AverageOptionVolumeAbove string
ScannerSettingPairs string
StockTypeFilter string
FilterOptions []TagValue
SubscriptionOptions []TagValue
}
type SecDefOptParamsEnd ¶
type SecDefOptParamsEnd struct {
ReqID int
}
func (SecDefOptParamsEnd) RequestID ¶
func (m SecDefOptParamsEnd) RequestID() int
type SecDefOptParamsRequest ¶
type SecDefOptParamsResponse ¶
type SecDefOptParamsResponse struct {
ReqID int
Exchange string
UnderlyingConID int
TradingClass string
Multiplier string
Expirations []string
Strikes []string
}
func (SecDefOptParamsResponse) RequestID ¶
func (m SecDefOptParamsResponse) RequestID() int
type ServerInfo ¶
func DecodeServerInfo ¶
func DecodeServerInfo(payload []byte) (ServerInfo, error)
DecodeServerInfo parses the server info frame returned during the handshake.
type SmartComponentEntry ¶
type SmartComponentsRequest ¶
type SmartComponentsResponse ¶
type SmartComponentsResponse struct {
ReqID int
Components []SmartComponentEntry
}
func (SmartComponentsResponse) RequestID ¶
func (m SmartComponentsResponse) RequestID() int
type SoftDollarTier ¶
type SoftDollarTiersRequest ¶
type SoftDollarTiersRequest struct {
ReqID int
}
type SoftDollarTiersResponse ¶
type SoftDollarTiersResponse struct {
ReqID int
Tiers []SoftDollarTier
}
func (SoftDollarTiersResponse) RequestID ¶
func (m SoftDollarTiersResponse) RequestID() int
type SymbolSample ¶
type TickByTickData ¶
type TickByTickData struct {
ReqID int
TickType int
Time string
Price string
Size string
Exchange string
SpecialConditions string
BidPrice string
AskPrice string
BidSize string
AskSize string
MidPoint string
// TickAttrib bitmasks
TickAttribLast int
TickAttribBidAsk int
}
func (TickByTickData) RequestID ¶
func (m TickByTickData) RequestID() int
type TickByTickRequest ¶
type TickEFP ¶
type TickGeneric ¶
func (TickGeneric) RequestID ¶
func (m TickGeneric) RequestID() int
type TickNews ¶
type TickNews struct {
ReqID int
Time string
ProviderCode string
ArticleID string
Headline string
ExtraData string
}
TickNews is one contract-specific news headline delivered through a market data subscription. Time preserves IBKR's epoch-millisecond wire value.
type TickOptionComputation ¶
type TickOptionComputation struct {
ReqID int
TickType int
TickAttrib int
ImpliedVol string
Delta string
OptPrice string
PvDividend string
Gamma string
Vega string
Theta string
UndPrice string
}
func (TickOptionComputation) RequestID ¶
func (m TickOptionComputation) RequestID() int
type TickPrice ¶
type TickReqParams ¶
type TickReqParams struct {
ReqID int
MinTick string
BBOExchange string
SnapshotPermissions *int
LastPricePrecision string
LastSizePrecision string
}
func (TickReqParams) RequestID ¶
func (m TickReqParams) RequestID() int
type TickSnapshotEnd ¶
type TickSnapshotEnd struct {
ReqID int
}
func (TickSnapshotEnd) RequestID ¶
func (m TickSnapshotEnd) RequestID() int
type TickString ¶
func (TickString) RequestID ¶
func (m TickString) RequestID() int
type UnknownInbound ¶
type UnknownInbound struct {
MsgID int
Encoding protocol.BodyEncoding
Fields []string
Payload []byte
}
UnknownInbound carries a frame whose msg_id has no registered decoder. An unmapped id is not a protocol violation: the Gateway grows new message ids over time, and killing the session over one (the pre-fix failure mode) tears down every subscription and order handle. The engine surfaces these as session events so drift stays observable; the raw fields are preserved for diagnosis.
type UnsubscribeFromGroupEventsRequest ¶
type UnsubscribeFromGroupEventsRequest struct {
ReqID int
}
type UpdateAccountTime ¶
type UpdateAccountTime struct {
Timestamp string
}
type UpdateAccountValue ¶
type UpdatePortfolio ¶
type UserInfoRequest ¶
type UserInfoRequest struct {
ReqID int
}
type WSHEventDataRequest ¶
type WSHEventDataResponse ¶
func (WSHEventDataResponse) RequestID ¶
func (m WSHEventDataResponse) RequestID() int
type WSHMetaDataRequest ¶
type WSHMetaDataRequest struct {
ReqID int
}
type WSHMetaDataResponse ¶
func (WSHMetaDataResponse) RequestID ¶
func (m WSHMetaDataResponse) RequestID() int
Source Files
¶
- codec.go
- codec_account.go
- codec_account_proto207.go
- codec_cancel_proto215.go
- codec_config_proto219.go
- codec_contracts.go
- codec_contracts_proto205.go
- codec_historical.go
- codec_historical_proto208.go
- codec_marketdata.go
- codec_marketdata_proto206.go
- codec_misc.go
- codec_news.go
- codec_news_proto209.go
- codec_options_proto211.go
- codec_orders.go
- codec_orders_proto203.go
- codec_orders_proto204.go
- codec_orders_protobuf.go
- codec_protobuf.go
- codec_reference_proto212.go
- codec_scanner_proto210.go
- codec_session.go
- codec_session_proto213.go
- decoder.go
- doc.go
- encoder.go
- protobuf.go
- reqid.go