ibkr

package module
v0.0.64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseUrl        = "https://localhost:5000"
	DefaultPrefixEndpoint = "/v1/api"
)
View Source
const (
	OrderSideBuy  = OrderSide("BUY")
	OrderSideSell = OrderSide("SELL")
)
View Source
const (
	ExchangeTypeNYSE   = ExchangeType("NYSE")
	ExchangeTypeBATS   = ExchangeType("BATS")
	ExchangeTypeISLAND = ExchangeType("ISLAND")
	ExchangeTypeNASDAQ = ExchangeType("NASDAQ")
	ExchangeTypeAEB    = ExchangeType("AEB")
	ExchangeTypeBVME   = ExchangeType("BVME")
	ExchangeTypeSWX    = ExchangeType("SWX")
	ExchangeTypeIBIS   = ExchangeType("IBIS")
	ExchangeTypeLSE    = ExchangeType("LSE")
	ExchangeTypeSBF    = ExchangeType("SBF")
	ExchangeTypeVIRTX  = ExchangeType("VIRTX")
	ExchangeTypeASX    = ExchangeType("ASX")
	ExchangeTypeOSEJPN = ExchangeType("OSE.JPN")
	ExchangeTypeSGX    = ExchangeType("SGX")
	ExchangeTypeTSEJ   = ExchangeType("TSEJ")
)
View Source
const (
	SecurityTypeStock                 = SecurityType("STK")
	SecurityTypeOption                = SecurityType("OPT")
	SecurityTypeFuture                = SecurityType("FUT")
	SecurityTypeContractForDifference = SecurityType("CFD")
	SecurityTypeWarrant               = SecurityType("WAR")
	SecurityTypeForex                 = SecurityType("CASH")
	SecurityTypeMutualFund            = SecurityType("FND")
	SecurityTypeBond                  = SecurityType("BND")
	SecurityTypeInterCommoditySpreads = SecurityType("ICS")
)
View Source
const (
	MessageTopicSubscribeMarketData             = "smd"
	MessageTopicUnsubscribeMarketData           = "umd"
	MessageTopicSubscribeHistoricalMarketData   = "smh"
	MessageTopicUnsubscribeHistoricalMarketData = "umh"
	MessageTopicSubscribeBookTrader             = "sbd"
	MessageTopicUnsubscribeBookTrader           = "ubd"
	MessageTopicSubscribeAccountSummary         = "ssd"
	MessageTopicUnsubscribeAccountSummary       = "usd"
	MessageTopicSubscribeAccountLedger          = "sld"
	MessageTopicUnsubscribeAccountLedger        = "uld"
	MessageTopicSubscribeOrder                  = "sor"
	MessageTopicUnsubscribeOrder                = "uor"
	MessageTopicSubscribePnL                    = "spl"
	MessageTopicUnsubscribePnL                  = "upl"
	MessageTopicSubscribeTradesData             = "str"
	MessageTopicUnsubscribeTradesData           = "utr"

	UnsolicitedMessageTopicAccountUpdates   = "act"
	UnsolicitedMessageTopicAuthStatus       = "sts"
	UnsolicitedMessageTopicBulletins        = "blt"
	UnsolicitedMessageTopicSystemConnection = "system"
	UnsolicitedMessageTopicNotifications    = "ntf"
)
View Source
const (
	OrderStatusInactive      = OrderStatus("Inactive")
	OrderStatusPendingSubmit = OrderStatus("PendingSubmit")
	OrderStatusPreSubmitted  = OrderStatus("PreSubmitted")
	OrderStatusSubmitted     = OrderStatus("Submitted")
	OrderStatusFilled        = OrderStatus("Filled")
	OrderStatusPendingCancel = OrderStatus("PendingCancel")
	OrderStatusCancelled     = OrderStatus("Cancelled")
	OrderStatusWarnState     = OrderStatus("WarnState")
)
View Source
const (
	OrderStatusFilterValueInactive      = OrderStatusFilterValue("inactive")
	OrderStatusFilterValuePendingSubmit = OrderStatusFilterValue("pending_submit")
	OrderStatusFilterValuePreSubmitted  = OrderStatusFilterValue("pre_submitted")
	OrderStatusFilterValueSubmitted     = OrderStatusFilterValue("submitted")
	OrderStatusFilterValueFilled        = OrderStatusFilterValue("filled")
	OrderStatusFilterValuePendingCancel = OrderStatusFilterValue("pending_cancel")
	OrderStatusFilterValueCancelled     = OrderStatusFilterValue("cancelled")
	OrderStatusFilterValueWarnState     = OrderStatusFilterValue("warnState")
)
View Source
const (
	OrderTypeMarket               = OrderType("MKT")
	OrderTypeMarketToLimit        = OrderType("MTL")
	OrderTypeLimit                = OrderType("LMT")
	OrderTypeStop                 = OrderType("STP")
	OrderTypeRelative             = OrderType("REL")
	OrderTypeBoxTop               = OrderType("BOX TOP")
	OrderTypeLimitIfTouched       = OrderType("LIT")
	OrderTypeLimitOnClose         = OrderType("LOC")
	OrderTypeMarketIfTouch        = OrderType("MIT")
	OrderTypeMarketOnClose        = OrderType("MOC")
	OrderTypeMarketWithProtection = OrderType("MKT PRT")
	OrderTypePassiveRelative      = OrderType("PASSV REL")
	OrderTypePeggedToStock        = OrderType("PEG STK")
	OrderTypePeggedToBenchmark    = OrderType("PEG BENCH")
	OrderTypePeggedToMarket       = OrderType("PEG MKT")
	OrderTypeStopLimit            = OrderType("STP LMT")
	OrderTypeStopWithProtection   = OrderType("STP PRT")
	OrderTypeRelativeLimitCombo   = OrderType("REL + LMT")
	OrderTypeRelativeMarketCombo  = OrderType("REL + MKT")
)

https://www.interactivebrokers.com/campus/ibkr-api-page/order-types/

View Source
const (
	TimeInForceDAY = TimeInForce("DAY")
	TimeInForceGTC = TimeInForce("GTC")
	TimeInForceIOC = TimeInForce("IOC")
	TimeInForceOPG = TimeInForce("OPG")
	TimeInForceGTD = TimeInForce("GTD")
	TimeInForceFOK = TimeInForce("FOK")
	TimeInForceDTC = TimeInForce("DTC")
	TimeInForcePAX = TimeInForce("PAX")
)
View Source
const (
	IBAlgorithmAccumulateDistribute        = IBAlgorithm("AD")
	IBAlgorithmAccumulateDistributeAlt     = IBAlgorithm("AccuDistr")
	IBAlgorithmAccumulateAdaptive          = IBAlgorithm("Adaptive")
	IBAlgorithmArrivalPrice                = IBAlgorithm("ArrivalPx")
	IBAlgorithmBalanceImpactRisk           = IBAlgorithm("BalanceImpactRisk")
	IBAlgorithmClosePrice                  = IBAlgorithm("ClosePx")
	IBAlgorithmDarkIce                     = IBAlgorithm("DarkIce")
	IBAlgorithmMiddlePrice                 = IBAlgorithm("MIDPRICE")
	IBAlgorithmMinimiseImpact              = IBAlgorithm("MinImpact")
	IBAlgorithmPercentageOfVolume          = IBAlgorithm("PctVol")
	IBAlgorithmPriceVariantPercentage      = IBAlgorithm("PctVolPx")
	IBAlgorithmPricePriceVariantPercentage = IBAlgorithm("PctVolPx")
	IBAlgorithmSizeVariantPercentage       = IBAlgorithm("PctVolSz")
	IBAlgorithmTimeVariantPercentage       = IBAlgorithm("PctVolTm")
	IBAlgorithmTWAP                        = IBAlgorithm("Twap")
	IBAlgorithmVWAP                        = IBAlgorithm("Vwap")
)
View Source
const (
	AdaptivePriorityUrgent  = AdaptivePriority("Urgent")
	AdaptivePriorityNormal  = AdaptivePriority("Normal")
	AdaptivePriorityPatient = AdaptivePriority("Patient")
)
View Source
const (
	TrailingTypeAmount  = TrailingType("amt")
	TrailingTypePercent = TrailingType("%")
)
View Source
const (
	SortDirectionAscending  = SortDirection("a")
	SortDirectionDescending = SortDirection("d")

	PositionSidePut  = PositionSide("Put")
	PositionSideCall = PositionSide("Call")

	PeriodTypeOneDay    = PeriodType("1D")
	PeriodTypeSevenDays = PeriodType("7D")
	PeriodTypeOneWeek   = PeriodType("1W")
	PeriodTypeOneMonth  = PeriodType("1M")
)
View Source
const (
	ChildOrderTypeAttached  = ChildOrderType("A")
	ChildOrderTypeBetaHedge = ChildOrderType("B")
	ChildOrderTypeNoChild   = ChildOrderType("0")
)
View Source
const (
	SuppressibleMessageId_O163   = SuppressibleMessageId("o163")   // The following order exceeds the price percentage limit
	SuppressibleMessageId_O354   = SuppressibleMessageId("o354")   // You are submitting an order without market data. We strongly recommend against this as it may result in erroneous and unexpected trades. Are you sure you want to submit this order?
	SuppressibleMessageId_O382   = SuppressibleMessageId("o382")   // The following value exceeds the tick size limit
	SuppressibleMessageId_O383   = SuppressibleMessageId("o383")   // The following order "BUY 650 AAPL NASDAQ.NMS" size exceeds the Size Limit of 500. Are you sure you want to submit this order?
	SuppressibleMessageId_O403   = SuppressibleMessageId("o403")   // This order will most likely trigger and fill immediately. Are you sure you want to submit this order?
	SuppressibleMessageId_O451   = SuppressibleMessageId("o451")   // The following order "BUY 650 AAPL NASDAQ.NMS" value estimate of 124,995.00 USD exceeds the Total Value Limit of 100,000 USD. Are you sure you want to submit this order?
	SuppressibleMessageId_O2136  = SuppressibleMessageId("o2136")  // Mixed allocation order warning
	SuppressibleMessageId_O2137  = SuppressibleMessageId("o2137")  // Cross side order warning
	SuppressibleMessageId_O2165  = SuppressibleMessageId("o2165")  // Warns that instrument does not support trading in fractions outside regular trading hours
	SuppressibleMessageId_O10082 = SuppressibleMessageId("o10082") // Called Bond warning
	SuppressibleMessageId_O10138 = SuppressibleMessageId("o10138") // The following order size modification exceeds the size modification limit.
	SuppressibleMessageId_O10151 = SuppressibleMessageId("o10151") // Warns about risks with Market Orders
	SuppressibleMessageId_O10152 = SuppressibleMessageId("o10152") // Warns about risks associated with stop orders once they become active
	SuppressibleMessageId_O10153 = SuppressibleMessageId("o10153") // <h4>Confirm Mandatory Cap Price</h4>To avoid trading at a price that is not consistent with a fair and orderly market, IB may set a cap (for a buy order) or sell order). THIS MAY CAUSE AN ORDER THAT WOULD OTHERWISE BE MARKETABLE TO NOT BE TRADED.
	SuppressibleMessageId_O10164 = SuppressibleMessageId("o10164") // Traders are responsible for understanding cash quantity details, which are provided on a best efforts basis only.
	SuppressibleMessageId_O10223 = SuppressibleMessageId("o10223") // <h4>Cash Quantity Order Confirmation</h4>Orders that express size using a monetary value (cash quantity) are provided on a non-guaranteed basis. The system simulates the order by cancelling it once the specified amount is spent (for buy orders) or collected (for sell orders). In addition to the monetary value, the order uses a maximum size that is calculated using the Cash Quantity Estimate Factor, which you can modify in Presets.
	SuppressibleMessageId_O10288 = SuppressibleMessageId("o10288") // Warns about risks associated with market orders for Crypto
	SuppressibleMessageId_O10331 = SuppressibleMessageId("o10331") // You are about to submit a stop order. Please be aware of the various stop order types available and the risks associated with each one. Are you sure you want to submit this order?
	SuppressibleMessageId_O10332 = SuppressibleMessageId("o10332") // OSL Digital Securities LTD Crypto Order Warning
	SuppressibleMessageId_O10333 = SuppressibleMessageId("o10333") // Option Exercise at the Money warning
	SuppressibleMessageId_O10334 = SuppressibleMessageId("o10334") // Warns that order will be placed into current omnibus account instead of currently selected global account.
	SuppressibleMessageId_O10335 = SuppressibleMessageId("o10335") // Serves internal Rapid Entry window.
	SuppressibleMessageId_O10336 = SuppressibleMessageId("o10336") // This security has limited liquidity. If you choose to trade this security, there is a heightened risk that you may not be able to close your position at the time you wish, at a price you wish, and/or without incurring a loss. Confirm that you understand the risks of trading illiquid securities. Are you sure you want to submit this order?
	SuppressibleMessageId_P6     = SuppressibleMessageId("p6")     // This order will be distributed over multiple accounts. We strongly suggest you familiarize yourself with our allocation facilities before submitting orders.
	SuppressibleMessageId_P12    = SuppressibleMessageId("p12")    // If your order is not immediately executable, our systems may, depending on market conditions, reject your order if its limit price is more than the allowed amount away from the reference price at that time. If this happens, you will not receive a fill. This is a control designed to ensure that we comply with our regulatory obligations to avoid submitting disruptive orders to the marketplace. Use the Price Management Algo?
)
View Source
const (
	DefaultWebsocketBaseURL        = "wss://localhost:5000"
	DefaultWebsocketPrefixEndpoint = "/v1/api/ws"
)

Variables

View Source
var (
	// ErrBadRequest :
	// Need to send the request with GET / POST (must be capitalized)
	ErrBadRequest = errors.New("bad request")
	// ErrInvalidRequest :
	// 1. Need to use the correct key to access;
	// 2. Need to put authentication params in the request header
	ErrInvalidRequest = errors.New("authentication failed")
	// ErrForbiddenRequest :
	// Possible causes:
	// 1. IP rate limit breached;
	// 2. You send GET request with an empty json body;
	// 3. You are using U.S IP
	ErrForbiddenRequest = errors.New("access denied")
	// ErrPathNotFound :
	// Possible causes:
	// 1. Wrong path;
	// 2. Category value does not match account mode
	ErrPathNotFound = errors.New("path not found")
)

Functions

func IsErrWebsocketClosed added in v0.0.12

func IsErrWebsocketClosed(err error) bool

IsErrWebsocketClosed :

func SetLogger

func SetLogger(l *log.Logger)

Types

type AccountLedgerItem added in v0.0.56

type AccountLedgerItem struct {
	AcctCode                string  `json:"acctcode"`
	CashBalance             float64 `json:"cashbalance"`
	Currency                string  `json:"currency"`
	ExchangeRate            float64 `json:"exchangerate"`
	FutureMarketValue       float64 `json:"futuremarketvalue"`
	FutureOptionMarketValue float64 `json:"futureoptionmarketvalue"`
	FuturesOnlyPnl          float64 `json:"futuresonlypnl"`
	Interest                float64 `json:"interest"`
	NetLiquidationValue     float64 `json:"netliquidationvalue"`
	RealizedPnl             float64 `json:"realizedpnl"`
	SettledCash             float64 `json:"settledcash"`
	StockMarketValue        float64 `json:"stockmarketvalue"`
	StockOptionMarketValue  float64 `json:"stockoptionmarketvalue"`
	TbillsMarketValue       float64 `json:"tbillsmarketvalue"`
	TbondsMarketValue       float64 `json:"tbondsmarketvalue"`
	Timestamp               int64   `json:"timestamp"`
	UnrealizedPnl           float64 `json:"unrealizedpnl"`
}

type AccountProfitAndLossInfo added in v0.0.6

type AccountProfitAndLossInfo struct {
	RowType         int     `json:"rowType"` // Returns the positional value of the returned account. Always returns 1 for individual accounts.
	DailyPnL        float64 `json:"dpl"`     // Daily PnL for the specified account profile.
	NetLiquidity    float64 `json:"nl"`      // Net Liquidity for the specified account profile.
	UnPnL           float64 `json:"upl"`     // Unrealized PnL for the specified account profile.
	ExcessLiquidity float64 `json:"el"`      // Excess Liquidity for the specified account profile.
	MarginValue     float64 `json:"mv"`      // Margin value for the specified account profile.
}

type AccountProfitAndLossResponse added in v0.0.6

type AccountProfitAndLossResponse struct {
	UserPnL map[string]AccountProfitAndLossInfo `json:"upnl"`
}

func (*AccountProfitAndLossResponse) GetUserPnL added in v0.0.6

type AccountService added in v0.0.6

type AccountService struct {
	// contains filtered or unexported fields
}

AccountService :

func (*AccountService) GetProfitAndLoss added in v0.0.6

func (s *AccountService) GetProfitAndLoss() (*AccountProfitAndLossResponse, error)

type AccountServiceI added in v0.0.6

type AccountServiceI interface {
	GetProfitAndLoss() (*AccountProfitAndLossResponse, error)
}

type AdaptivePriority added in v0.0.43

type AdaptivePriority string

type AuthStatusInfo added in v0.0.11

type AuthStatusInfo struct {
	Authenticated bool       `json:"authenticated"`
	Competing     bool       `json:"competing"`
	Connected     bool       `json:"connected"`
	Message       string     `json:"message"`
	MAC           string     `json:"MAC"`
	ServerInfo    ServerInfo `json:"serverInfo"`
	HardwareInfo  string     `json:"hardware_info"`
	Fail          string     `json:"fail"`
}

type CancelOrderParam added in v0.0.42

type CancelOrderParam struct {
	AccountId string
	OrderId   int64
}

type CancelOrderResponse added in v0.0.42

type CancelOrderResponse struct {
	Msg        string `json:"msg,omitempty"`
	OrderId    int64  `json:"order_id,omitempty"`
	ContractId int    `json:"conid,omitempty"`
	AccountId  string `json:"account,omitempty"`
	Error      string `json:"error,omitempty"`
}

type ChildOrderType added in v0.0.51

type ChildOrderType string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client :

func NewClient

func NewClient(restBaseUrl, restEndpointPrefix string, skipTlsVerify bool) *Client

NewClient :

func NewDefaultClient added in v0.0.8

func NewDefaultClient() *Client

NewDefaultClient :

func (*Client) Request

func (c *Client) Request(req *http.Request, dst interface{}) error

Request :

func (*Client) RequestFull added in v0.0.42

func (c *Client) RequestFull(req *http.Request, conciseResponse bool, dst interface{}) ([]byte, error)

RequestFull :

func (*Client) Service added in v0.0.3

func (c *Client) Service() ClientServiceI

Service :

func (*Client) WithBaseURL

func (c *Client) WithBaseURL(url string) *Client

WithBaseURL :

func (*Client) WithDebug

func (c *Client) WithDebug(debug bool) *Client

WithDebug :

func (*Client) WithHTTPClient

func (c *Client) WithHTTPClient(httpClient *http.Client) *Client

WithHTTPClient :

func (*Client) WithLogger

func (c *Client) WithLogger(logger *log.Logger) *Client

WithLogger :

func (*Client) WithReferer

func (c *Client) WithReferer(referer string) *Client

type ClientService added in v0.0.3

type ClientService struct {
	// contains filtered or unexported fields
}

ClientService :

func (*ClientService) Account added in v0.0.6

func (s *ClientService) Account() AccountServiceI

Account :

func (*ClientService) Contract added in v0.0.8

func (s *ClientService) Contract() ContractServiceI

Contract :

func (*ClientService) Order added in v0.0.42

func (s *ClientService) Order() OrdersServiceI

Order :

func (*ClientService) OrderMonitoring added in v0.0.51

func (s *ClientService) OrderMonitoring() OrderMonitoringServiceI

OrderMonitoring :

func (*ClientService) Portfolio added in v0.0.42

func (s *ClientService) Portfolio() PortfolioServiceI

Portfolio :

func (*ClientService) Session added in v0.0.9

func (s *ClientService) Session() SessionServiceI

Session :

type ClientServiceI added in v0.0.3

type ClientServiceI interface {
	Session() SessionServiceI
	Account() AccountServiceI
	Contract() ContractServiceI
	Order() OrdersServiceI
	OrderMonitoring() OrderMonitoringServiceI
	Portfolio() PortfolioServiceI
}

ClientServiceI :

type CombinationPositionItem added in v0.0.42

type CombinationPositionItem struct {
	Name        string                   `json:"name"`
	Description string                   `json:"description"`
	Legs        []CombinationPositionLeg `json:"legs"`
	Positions   []PositionInfo           `json:"positions"`
}

type CombinationPositionLeg added in v0.0.42

type CombinationPositionLeg struct {
	ContractId int     `json:"conid"`
	Ratio      float64 `json:"ratio"`
}

type ContractIdItem added in v0.0.9

type ContractIdItem struct {
	Ticker     string `json:"ticker"`
	ContractId int    `json:"conid"`
	Exchange   string `json:"exchange"`
}

type ContractRuleOrderDefaultItem added in v0.0.9

type ContractRuleOrderDefaultItem struct {
	Lp string `json:"LP,omitempty"`
}

type ContractRules added in v0.0.9

type ContractRules struct {
	AlgoEligible      bool                                    `json:"algoEligible"`
	OvernightEligible bool                                    `json:"overnightEligible"`
	CostReport        bool                                    `json:"costReport"`
	CanTradeAcctIds   []string                                `json:"canTradeAcctIds"`
	Error             *string                                 `json:"error,omitempty"`
	OrderTypes        []string                                `json:"orderTypes"`
	IbAlgoTypes       []string                                `json:"ibAlgoTypes"`
	FraqTypes         []string                                `json:"fraqTypes"`
	ForceOrderPreview bool                                    `json:"forceOrderPreview"`
	CqtTypes          []string                                `json:"cqtTypes"`
	OrderDefaults     map[string]ContractRuleOrderDefaultItem `json:"orderDefaults,omitempty"`
	OrderTypesOutside []string                                `json:"orderTypesOutside"`
	DefaultSize       float64                                 `json:"defaultSize"`
	CashSize          float64                                 `json:"cashSize"`
	SizeIncrement     float64                                 `json:"sizeIncrement"`
	TifTypes          []string                                `json:"tifTypes"`
	TifDefaults       map[string]interface{}                  `json:"tifDefaults"`
	LimitPrice        float64                                 `json:"limitPrice"`
	StopPrice         float64                                 `json:"stopprice"`
	OrderOrigination  *string                                 `json:"orderOrigination"`
	Preview           bool                                    `json:"preview"`
	DisplaySize       *string                                 `json:"displaySize,omitempty"`
	FraqInt           int                                     `json:"fraqInt"`
	CashCcy           string                                  `json:"cashCcy"`
	CashQtyIncr       float64                                 `json:"cashQtyIncr"`
	PriceMagnifier    *string                                 `json:"priceMagnifier"`
	NegativeCapable   bool                                    `json:"negativeCapable"`
	IncrementType     int                                     `json:"incrementType"`
	IncrementRules    []IncrementRule                         `json:"incrementRules"`
	HasSecondary      bool                                    `json:"hasSecondary"`
	Increment         float64                                 `json:"increment"`
	IncrementDigits   int                                     `json:"incrementDigits"`
}

type ContractSection added in v0.0.44

type ContractSection struct {
	SecType    string `json:"secType"`
	Exchange   string `json:"exchange,omitempty"`
	ContractId string `json:"conid,omitempty"`
	Months     string `json:"months,omitempty"`
}

type ContractService added in v0.0.8

type ContractService struct {
	// contains filtered or unexported fields
}

func (*ContractService) GetAllContractIds added in v0.0.9

func (s *ContractService) GetAllContractIds(exchange ExchangeType) (*[]ContractIdItem, error)

func (*ContractService) GetContractFullAllInfoAndRules added in v0.0.9

func (s *ContractService) GetContractFullAllInfoAndRules(contractId int, isBuy *bool) (*GetContractAllInfoAndRulesResponse, error)

func (*ContractService) GetContractInfoByContractId added in v0.0.9

func (s *ContractService) GetContractInfoByContractId(contractId int) (*GetContractInfoResponse, error)

func (*ContractService) GetCurrencyExchangeRate added in v0.0.9

func (s *ContractService) GetCurrencyExchangeRate(source, target string) (*GetCurrencyExchangeRateResponse, error)

func (*ContractService) GetCurrencyPairs added in v0.0.9

func (s *ContractService) GetCurrencyPairs(currency string) (*map[string][]CurrencyPairItem, error)

func (*ContractService) GetSecurityFuturesBySymbol added in v0.0.9

func (s *ContractService) GetSecurityFuturesBySymbol(symbols []string) (*map[string][]FuturesInfoItem, error)

func (*ContractService) GetSecurityStocksBySymbol added in v0.0.9

func (s *ContractService) GetSecurityStocksBySymbol(symbols []string) (*map[string][]StockInfoItem, error)

func (*ContractService) GetTradingScheduleBySymbol added in v0.0.9

func (s *ContractService) GetTradingScheduleBySymbol(query TradingScheduleQuery) (*[]GetTradingScheduleResponse, error)

func (*ContractService) SearchContractBySymbol added in v0.0.9

func (s *ContractService) SearchContractBySymbol(query SearchContractBySymbolQuery) (*[]SearchContractBySymbolItem, error)

func (*ContractService) SearchContractRules added in v0.0.9

func (s *ContractService) SearchContractRules(query SearchContractRulesQuery) (*ContractRules, error)

func (*ContractService) SearchSecurityDefinitionByContactId added in v0.0.9

func (s *ContractService) SearchSecurityDefinitionByContactId(contractIds []int) (*SearchSecurityDefinitionResponse, error)

type ContractServiceI added in v0.0.8

type ContractServiceI interface {
	GetAllContractIds(exchange ExchangeType) (*[]ContractIdItem, error)
	SearchSecurityDefinitionByContactId(contractIds []int) (*SearchSecurityDefinitionResponse, error)
	GetContractInfoByContractId(contractId int) (*GetContractInfoResponse, error)
	GetCurrencyPairs(currency string) (*map[string][]CurrencyPairItem, error)
	GetCurrencyExchangeRate(source, target string) (*GetCurrencyExchangeRateResponse, error)
	GetContractFullAllInfoAndRules(contractId int, isBuy *bool) (*GetContractAllInfoAndRulesResponse, error)
	SearchContractBySymbol(query SearchContractBySymbolQuery) (*[]SearchContractBySymbolItem, error)
	SearchContractRules(query SearchContractRulesQuery) (*ContractRules, error)
	GetSecurityFuturesBySymbol(symbols []string) (*map[string][]FuturesInfoItem, error)
	GetSecurityStocksBySymbol(symbols []string) (*map[string][]StockInfoItem, error)
	GetTradingScheduleBySymbol(query TradingScheduleQuery) (*[]GetTradingScheduleResponse, error)
}

type CurrencyPairItem added in v0.0.9

type CurrencyPairItem struct {
	Symbol     string `json:"symbol"`
	ContractId int    `json:"conid"`
	CcyPair    string `json:"ccyPair"`
}

type DisplayRule added in v0.0.9

type DisplayRule struct {
	Magnification   int             `json:"magnification"`
	DisplayRuleStep DisplayRuleStep `json:"displayRuleStep"`
}

type DisplayRuleStep added in v0.0.9

type DisplayRuleStep struct {
	DecimalDigits int     `json:"decimalDigits"`
	LowerEdge     float64 `json:"lowerEdge"`
	WholeDigits   int     `json:"wholeDigits"`
}

type ErrHandler added in v0.0.12

type ErrHandler func(isWebsocketClosed bool, err error)

ErrHandler :

type ExchangeType added in v0.0.8

type ExchangeType string

type FuturesInfoItem added in v0.0.9

type FuturesInfoItem struct {
	Symbol               string `json:"symbol"`
	ContractId           int    `json:"conid"`
	UnderlyingContractId int    `json:"underlyingConid"`
	ExpirationDate       int    `json:"expirationDate"`
	LastTradeDate        int    `json:"ltd"`
	ShortFuturesCutOff   int    `json:"shortFuturesCutOff"`
	LongFuturesCutOff    int    `json:"longFuturesCutOff"`
}

type GetContractAllInfoAndRulesResponse added in v0.0.9

type GetContractAllInfoAndRulesResponse struct {
	CfiCode                   string        `json:"cfi_code"`
	Symbol                    string        `json:"symbol"`
	Cusip                     *string       `json:"cusip,omitempty"`
	ExpiryFull                *string       `json:"expiry_full,omitempty"`
	ContractId                int           `json:"con_id"`
	MaturityDate              *string       `json:"maturity_date,omitempty"`
	Industry                  string        `json:"industry"`
	InstrumentType            string        `json:"instrument_type"'`
	TradingClass              string        `json:"trading_class"`
	ValidExchanges            string        `json:"valid_exchanges"`
	AllowSellLong             bool          `json:"allow_sell_long"`
	IsZeroCommissionSecurity  bool          `json:"is_zero_commission_security"`
	LocalSymbol               string        `json:"local_symbol"`
	ContractClarificationType *string       `json:"contract_clarification_type,omitempty"`
	Classifier                *string       `json:"classifier,omitempty"`
	Currency                  string        `json:"currency"`
	Text                      *string       `json:"text,omitempty"`
	UnderlyingContractId      int           `json:"underlying_con_id"`
	RegularTradingHour        bool          `json:"r_t_h"`
	Multiplier                *string       `json:"multiplier,omitempty"`
	UnderlyingIssuer          *string       `json:"underlying_issuer,omitempty"`
	ContractMonth             *string       `json:"contract_month,omitempty"`
	CompanyName               string        `json:"company_name"`
	SmartAvailable            bool          `json:"smart_available"`
	Exchange                  string        `json:"exchange"`
	Category                  string        `json:"category"`
	Rules                     ContractRules `json:"rules"`
}

type GetContractInfoResponse added in v0.0.9

type GetContractInfoResponse struct {
	CfiCode                   string  `json:"cfi_code"`
	Symbol                    string  `json:"symbol"`
	Cusip                     *string `json:"cusip,omitempty"`
	ExpiryFull                *string `json:"expiry_full,omitempty"`
	ContractId                int     `json:"con_id"`
	MaturityDate              *string `json:"maturity_date,omitempty"`
	Industry                  string  `json:"industry"`
	InstrumentType            string  `json:"instrument_type"'`
	TradingClass              string  `json:"trading_class"`
	ValidExchanges            string  `json:"valid_exchanges"`
	AllowSellLong             bool    `json:"allow_sell_long"`
	IsZeroCommissionSecurity  bool    `json:"is_zero_commission_security"`
	LocalSymbol               string  `json:"local_symbol"`
	ContractClarificationType *string `json:"contract_clarification_type,omitempty"`
	Classifier                *string `json:"classifier,omitempty"`
	Currency                  string  `json:"currency"`
	Text                      *string `json:"text,omitempty"`
	UnderlyingContractId      int     `json:"underlying_con_id"`
	RegularTradingHour        bool    `json:"r_t_h"`
	Multiplier                *string `json:"multiplier,omitempty"`
	UnderlyingIssuer          *string `json:"underlying_issuer,omitempty"`
	ContractMonth             *string `json:"contract_month,omitempty"`
	CompanyName               string  `json:"company_name"`
	SmartAvailable            bool    `json:"smart_available"`
	Exchange                  string  `json:"exchange"`
	Category                  string  `json:"category"`
}

type GetCurrencyExchangeRateResponse added in v0.0.9

type GetCurrencyExchangeRateResponse struct {
	Rate float64 `json:"rate"`
}

type GetLiveOrdersParam added in v0.0.51

type GetLiveOrdersParam struct {
	StatusValueFilters []OrderStatusFilterValue
	/* Please be aware that filtering orders using the /iserver/account/orders endpoint will prevent order details from coming through over the websocket “sor” topic. To resolve this issue, developers should set “force=true” in a follow-up /iserver/account/orders call to clear any cached behavior surrounding the endpoint prior to calling for the websocket request */
	Force bool
}

type GetLiveOrdersResponse added in v0.0.51

type GetLiveOrdersResponse struct {
	Orders   []LiveOrderItem `json:"orders,omitempty"`
	Snapshot bool            `json:"snapshot"`
}

type GetPositionParam added in v0.0.42

type GetPositionParam struct {
	AccountId string         `json:"accountId"`
	PageId    int            `json:"pageId"`
	Model     string         `json:"model"`
	Sort      string         `json:"sort"`
	Direction *SortDirection `json:"direction"`
	Period    *PeriodType    `json:"period"`
}

type GetTradesParam added in v0.0.51

type GetTradesParam struct {
	// Specify the number of days to receive executions for, up to a maximum of 7 days.
	// If unspecified, only the current day is returned.
	Days *int
}

type GetTradingScheduleResponse added in v0.0.17

type GetTradingScheduleResponse struct {
	Id           string                `json:"id,omitempty"`
	TradeVenueId string                `json:"tradeVenueId,omitempty"`
	Exchange     string                `json:"exchange,omitempty"`
	Description  string                `json:"description,omitempty"`
	Timezone     string                `json:"timezone,omitempty"`
	Schedules    []TradingScheduleItem `json:"schedules"`
}

type IBAlgorithm added in v0.0.42

type IBAlgorithm string

type IServerInfo added in v0.0.11

type IServerInfo struct {
	AuthStatus AuthStatusInfo `json:"authStatus"`
}

type IncrementRule added in v0.0.9

type IncrementRule struct {
	LowerEdge float64 `json:"lowerEdge"`
	Increment float64 `json:"increment"`
}

type LiveOrderItem added in v0.0.51

type LiveOrderItem struct {
	AccountId          string  `json:"acct"`
	ContractIdExchange string  `json:"conidex,omitempty"`
	ContractId         int     `json:"conid,omitempty"`
	OrderId            int64   `json:"orderId,omitempty"`
	CashCcy            string  `json:"cashCcy,omitempty"`
	SizeAndFills       string  `json:"sizeAndFills,omitempty"`
	OrderDesc          string  `json:"orderDesc,omitempty"`
	Description1       string  `json:"description1,omitempty"` // Returns the local symbol of the order
	Ticker             string  `json:"ticker,omitempty"`
	SecurityType       string  `json:"secType,omitempty"`
	ListingExchange    string  `json:"listingExchange,omitempty"`
	RemainingQuantity  float64 `json:"remainingQuantity,omitempty"`
	FilledQuantity     float64 `json:"filledQuantity,omitempty"`
	CompanyName        string  `json:"companyName,omitempty"`
	Status             string  `json:"status,omitempty"`
	OrderCcpStatus     string  `json:"order_ccp_status,omitempty"`
	OrigOrderType      string  `json:"origOrderType,omitempty"`
	SupportsTaxOpt     string  `json:"supportsTaxOpt,omitempty"`
	LastExecutionTime  string  `json:"lastExecutionTime"`
	LastExecutionTimeR int64   `json:"lastExecutionTime_r"`
	OrderType          string  `json:"orderType"`
	BgColor            string  `json:"bgColor,omitempty"`
	FgColor            string  `json:"fgColor,omitempty"`
	OrderRef           string  `json:"order_ref,omitempty"` // User defined string used to identify the order. Value is set using “cOID” field while placing an order.
	TimeInForce        string  `json:"timeInForce,omitempty"`

	Side         string  `json:"side,omitempty"`
	AveragePrice float64 `json:"avgPrice,omitempty"`
}

type MessageTopic added in v0.0.36

type MessageTopic string

type OrderMonitoringService added in v0.0.51

type OrderMonitoringService struct {
	// contains filtered or unexported fields
}

func (*OrderMonitoringService) GetLiveOrders added in v0.0.51

func (*OrderMonitoringService) GetStatus added in v0.0.51

func (s *OrderMonitoringService) GetStatus(orderId int) (*OrderStatusItem, error)

func (*OrderMonitoringService) GetTrades added in v0.0.51

func (s *OrderMonitoringService) GetTrades(param GetTradesParam) (*[]TradeItem, error)

type OrderMonitoringServiceI added in v0.0.51

type OrderMonitoringServiceI interface {
	GetLiveOrders(param GetLiveOrdersParam) (*GetLiveOrdersResponse, error)
	GetTrades(param GetTradesParam) (*[]TradeItem, error)
	GetStatus(orderId int) (*OrderStatusItem, error)
}

type OrderSide added in v0.0.42

type OrderSide string

type OrderStatus added in v0.0.41

type OrderStatus string

type OrderStatusFilterValue added in v0.0.41

type OrderStatusFilterValue string

type OrderStatusItem added in v0.0.51

type OrderStatusItem struct {
	RequestId                    string  `json:"request_id,omitempty"`
	OrderId                      int64   `json:"order_id,omitempty"`
	ContractIdExchange           string  `json:"conidex,omitempty"`
	ContractId                   int     `json:"conid,omitempty"`
	Symbol                       string  `json:"symbol,omitempty"`
	Side                         string  `json:"side,omitempty"`
	ContractDescription1         string  `json:"contract_description_1,omitempty"`
	ListingExchange              string  `json:"listing_exchange,omitempty"`
	CompanyName                  string  `json:"company_name,omitempty"`
	Size                         float64 `json:"size,omitempty"`
	TotalSize                    float64 `json:"total_size,omitempty"`
	Currency                     string  `json:"currency,omitempty"`
	AccountId                    string  `json:"account,omitempty"`
	OrderType                    string  `json:"order_type,omitempty"`
	CumulativeFill               string  `json:"cum_fill,omitempty"`
	OrderStatus                  string  `json:"order_status,omitempty"`
	OrderCcpStatus               string  `json:"order_ccp_status,omitempty"`
	OrderStatusDescription       string  `json:"order_status_description,omitempty"`
	TimeInFore                   string  `json:"tif,omitempty"`
	BgColor                      string  `json:"bg_color,omitempty"`
	FgColor                      string  `json:"fg_color,omitempty"`
	OrderNotEditable             bool    `json:"order_not_editable"`
	CannotCancelOrder            bool    `json:"cannot_cancel_order"`
	DeactivateOrder              bool    `json:"deactivate_order"`
	SecType                      string  `json:"sec_type,omitempty"`
	AvailableChartPeriods        string  `json:"available_chart_periods,omitempty"`
	OrderDescription             string  `json:"order_description,omitempty"`
	OrderDescriptionWithContract string  `json:"order_description_with_contract,omitempty"`
	AlertActive                  int     `json:"alert_active,omitempty"`
	ChildOrderType               string  `json:"child_order_type,omitempty"`
	OrderClearingAccount         string  `json:"order_clearing_account,omitempty"`
	SizeAndFills                 string  `json:"size_and_fills,omitempty"`
	ExitStrategyDisplayPrice     string  `json:"exit_strategy_display_price,omitempty"`
	ExitStrategyChartDescription string  `json:"exit_strategy_chart_description,omitempty"`
	AveragePrice                 string  `json:"average_price,omitempty"`
	AllowedDuplicateOpposite     string  `json:"allowed_duplicate_opposite,omitempty"`
	OrderTime                    string  `json:"order_time,omitempty"`
}

type OrderType added in v0.0.42

type OrderType string

type OrdersService added in v0.0.42

type OrdersService struct {
	// contains filtered or unexported fields
}

func (*OrdersService) CancelOrder added in v0.0.42

func (s *OrdersService) CancelOrder(param CancelOrderParam) (*CancelOrderResponse, error)

func (*OrdersService) PlaceOrder added in v0.0.42

func (s *OrdersService) PlaceOrder(orders []PlaceOrderParam) (*PlaceOrderResponse, error)

func (*OrdersService) PlaceOrderReplyConfirmation added in v0.0.42

func (*OrdersService) RespondServerPrompt added in v0.0.42

func (s *OrdersService) RespondServerPrompt(param RespondServerPromptParam) (*RespondServerPromptResponse, error)

func (*OrdersService) SuppressMessages added in v0.0.61

func (s *OrdersService) SuppressMessages(messageIds []string) (*SuppressMessagesResponse, error)

type OrdersServiceI added in v0.0.42

type OrdersServiceI interface {
	PlaceOrder(orders []PlaceOrderParam) (*PlaceOrderResponse, error)
	CancelOrder(param CancelOrderParam) (*CancelOrderResponse, error)
	PlaceOrderReplyConfirmation(param PlaceOrderReplyConfirmationParam) (*PlaceOrderReplyConfirmationResponse, error)
	RespondServerPrompt(param RespondServerPromptParam) (*RespondServerPromptResponse, error)
	SuppressMessages(messageIds []string) (*SuppressMessagesResponse, error)
}

type PeriodType added in v0.0.42

type PeriodType string

type PingServerResponse added in v0.0.9

type PingServerResponse struct {
	Session    string            `json:"session"`
	SsoExpires int               `json:"ssoExpires"`
	Collission bool              `json:"collission"`
	UserId     int               `json:"userId"`
	Hmds       map[string]string `json:"hmds,omitempty"`
	IServer    IServerInfo       `json:"iserver"`
}

type PlaceOrderAlternateResult added in v0.0.42

type PlaceOrderAlternateResult struct {
	Id           string   `json:"id"`
	Message      []string `json:"message"`
	IsSuppressed bool     `json:"isSuppressed"`
	MessageIds   []string `json:"messageIds"`
}

type PlaceOrderNormalResult added in v0.0.42

type PlaceOrderNormalResult struct {
	OrderId        string      `json:"order_id"`
	OrderStatus    OrderStatus `json:"order_status"`
	EncryptMessage string      `json:"encrypt_message"`
}

type PlaceOrderParam added in v0.0.42

type PlaceOrderParam struct {
	AccountId                  string                 `json:"acctId"`
	ContractId                 int                    `json:"conid"`
	ContractIdExchange         string                 `json:"conidex"`
	ManualIndicator            bool                   `json:"manualIndicator"`
	ExternalOperator           string                 `json:"extOperator,omitempty"`
	ContractSecurityType       string                 `json:"secType,omitempty"` // sample:265598:STK
	CustomOrderId              string                 `json:"cOID,omitempty"`
	ParentId                   string                 `json:"parentId,omitempty"`
	OrderType                  OrderType              `json:"orderType"`
	ListingExchange            string                 `json:"listingExchange,omitempty"`
	IsSingleGroup              bool                   `json:"isSingleGroup"`
	OutsideRegularTradingHours bool                   `json:"outsideRTH"`
	Price                      *float64               `json:"price,omitempty"`
	AuxPrice                   *float64               `json:"auxPrice,omitempty"`
	Side                       string                 `json:"side"`
	Ticker                     string                 `json:"ticker,omitempty"`
	TimeInForce                TimeInForce            `json:"tif"`
	TrailingAmount             *float64               `json:"trailingAmt,omitempty"`
	TrailingType               TrailingType           `json:"trailingType,omitempty"`
	AllOrNone                  bool                   `json:"allOrNone"`
	CustomerAccount            string                 `json:"customerAccount,omitempty"`
	IsProCustomer              bool                   `json:"isProCustomer"`
	Referrer                   string                 `json:"referrer,omitempty"`
	Quantity                   float64                `json:"quantity"`
	CashQty                    *float64               `json:"cashQty"`
	FxQty                      *float64               `json:"fxQty,omitempty"`
	UseAdaptive                *bool                  `json:"useAdaptive,omitempty"`
	IsCcyConversion            *bool                  `json:"isCcyConv,omitempty"'`
	AllocationMethod           string                 `json:"allocationMethod,omitempty"`
	ManualOrderTime            *int                   `json:"manualOrderTime,omitempty"`
	Deactivated                *bool                  `json:"deactivated,omitempty"`
	Strategy                   string                 `json:"strategy,omitempty"`
	StrategyParameters         map[string]interface{} `json:"strategyParameters,omitempty"`
}

type PlaceOrderRejectResult added in v0.0.42

type PlaceOrderRejectResult struct {
	Error string `json:"error"`
}

type PlaceOrderReplyConfirmationParam added in v0.0.42

type PlaceOrderReplyConfirmationParam struct {
	ReplyId   string `json:"-"`
	Confirmed bool   `json:"confirmed"`
}

type PlaceOrderReplyConfirmationResponse added in v0.0.42

type PlaceOrderReplyConfirmationResponse struct {
	NormalResults []PlaceOrderNormalResult `json:"-"`
	Error         string                   `json:"error,omitempty"`
}

type PlaceOrderResponse added in v0.0.42

type PlaceOrderResponse struct {
	NormalResults    *[]PlaceOrderNormalResult
	AlternateResults *[]PlaceOrderAlternateResult
	RejectResult     *PlaceOrderRejectResult
}

type PortfolioAccountInfo added in v0.0.42

type PortfolioAccountInfo struct {
	Id                      string                 `json:"id"`
	PrepaidCryptoZ          bool                   `json:"PrepaidCrypto-Z"`
	PrepaidCryptoP          bool                   `json:"PrepaidCrypto-P"`
	BrokerageAccess         bool                   `json:"brokerageAccess"`
	AccountId               string                 `json:"accountId"`
	AccountVan              string                 `json:"accountVan"`
	AccountTitle            string                 `json:"accountTitle"`
	DisplayName             string                 `json:"displayName"`
	AccountAlias            string                 `json:"accountAlias"`
	AccountStatus           int64                  `json:"accountStatus"` // When the account was opened in unix time.
	Currency                string                 `json:"currency"`
	AccountType             string                 `json:"type"`
	TradingType             string                 `json:"tradingType"`
	BusinessType            string                 `json:"businessType"`
	IbEntity                string                 `json:"ibEntity"`
	FinancialAdvisorClient  bool                   `json:"faClient"`
	ClearingStatus          string                 `json:"clearingStatus"` // Status of the Account Potential Values: O: Open; P or N: Pending; A: Abandoned; R: Rejected; C: Closed.
	Vovestor                bool                   `json:"covestor"`
	NoClientTrading         bool                   `json:"noClientTrading"`
	TrackVirtualFXPortfolio bool                   `json:"trackVirtualFXPortfolio"`
	Parent                  PortfolioAccountParent `json:"parent"`
	Desc                    string                 `json:"desc"`
}

type PortfolioAccountParent added in v0.0.42

type PortfolioAccountParent struct {
	MoneyManagerClientAccount []string `json:"mmc"`
	AccountId                 string   `json:"accountId"`           // Account Number for Money Manager Client
	IsMParent                 bool     `json:"isMParent,omitempty"` // Returns if this is a Multiplex Parent Account
	IsMChild                  bool     `json:"isMChild,omitempty"`  // Returns if this is a Multiplex Child Account
	IsMultiplex               bool     `json:"isMultiplex"`         // Is a Multiplex Account. These are account models with individual account being parent and managed account being child.
}

type PortfolioService added in v0.0.42

type PortfolioService struct {
	// contains filtered or unexported fields
}

func (*PortfolioService) GetAccounts added in v0.0.42

func (s *PortfolioService) GetAccounts() (*[]PortfolioAccountInfo, error)

func (*PortfolioService) GetCombinationPositions added in v0.0.42

func (s *PortfolioService) GetCombinationPositions(accountId string, nocache bool) (*[]CombinationPositionItem, error)

func (*PortfolioService) GetLedger added in v0.0.56

func (s *PortfolioService) GetLedger(accountId string) (*map[string]AccountLedgerItem, error)

func (*PortfolioService) GetPositionByContractId added in v0.0.42

func (s *PortfolioService) GetPositionByContractId(contractId int) (*PositionInfo, error)

func (*PortfolioService) GetPositions added in v0.0.42

func (s *PortfolioService) GetPositions(param GetPositionParam) (*[]PositionInfo, error)

func (*PortfolioService) GetPositionsNew added in v0.0.42

func (s *PortfolioService) GetPositionsNew(param GetPositionParam) (*[]PositionNewInfo, error)

func (*PortfolioService) GetSpecificAccount added in v0.0.42

func (s *PortfolioService) GetSpecificAccount(accountId string) (*PortfolioAccountInfo, error)

func (*PortfolioService) GetSubAccounts added in v0.0.42

func (s *PortfolioService) GetSubAccounts() (*[]PortfolioAccountInfo, error)

func (*PortfolioService) GetSubAccountsWithLargeAccountStructures added in v0.0.42

func (s *PortfolioService) GetSubAccountsWithLargeAccountStructures() (*[]PortfolioAccountInfo, error)

type PortfolioServiceI added in v0.0.42

type PortfolioServiceI interface {
	GetAccounts() (*[]PortfolioAccountInfo, error)
	GetSubAccounts() (*[]PortfolioAccountInfo, error)
	GetSubAccountsWithLargeAccountStructures() (*[]PortfolioAccountInfo, error)
	GetSpecificAccount(accountId string) (*PortfolioAccountInfo, error)
	GetCombinationPositions(accountId string, nocache bool) (*[]CombinationPositionItem, error)
	GetPositions(param GetPositionParam) (*[]PositionInfo, error)
	GetPositionsNew(param GetPositionParam) (*[]PositionNewInfo, error)
	GetPositionByContractId(contractId int) (*PositionInfo, error)
	GetLedger(accountId string) (*map[string]AccountLedgerItem, error)
}

type PositionInfo added in v0.0.42

type PositionInfo struct {
	AccountId     string  `json:"acctId"`
	ContractId    int     `json:"conid"`
	ContractDesc  string  `json:"contractDesc"`
	Position      float64 `json:"position"`
	MarketPrice   float64 `json:"mktPrice"`
	MarketValue   float64 `json:"mktValue"`
	Currency      string  `json:"currency"`
	AverageCost   float64 `json:"avgCost"`
	AveragePrice  float64 `json:"avgPrice"`
	RealizedPnl   float64 `json:"realizedPnl"`
	UnrealizedPnl float64 `json:"unrealizedPnl"`
	AssetClass    string  `json:"assetClass"`
	PutOrCall     string  `json:"putOrCall,omitempty"`
}

type PositionNewInfo added in v0.0.42

type PositionNewInfo struct {
	Position      float64 `json:"position"`
	ContractId    string  `json:"conid"`
	AverageCost   float64 `json:"avgCost"`
	AveragePrice  float64 `json:"avgPrice"`
	Currency      string  `json:"currency"`
	Description   string  `json:"description"` // Returns the local symbol of the order.
	IsLastToLoq   bool    `json:"isLastToLoq"`
	MarketPrice   float64 `json:"marketPrice"`
	MarketValue   float64 `json:"marketValue"`
	RealizedPnl   float64 `json:"realizedPnl"`
	SecurityType  string  `json:"secType"`
	Timestamp     int64   `json:"timestamp"`
	UnrealizedPnl float64 `json:"unrealizedPnl"`
	AssetClass    string  `json:"assetClass"`
	Sector        string  `json:"sector"`
	Group         string  `json:"group"`
	Model         string  `json:"model"`
}

type PositionSide added in v0.0.42

type PositionSide string

type RespondServerPromptParam added in v0.0.42

type RespondServerPromptParam struct {
	OrderId int64  `json:"orderId"`
	ReqId   string `json:"reqId"`
	Text    string `json:"text"`
}

type RespondServerPromptResponse added in v0.0.42

type RespondServerPromptResponse struct {
	Result string
}

type ScheduleSession added in v0.0.9

type ScheduleSession struct {
	OpeningTime string `json:"openingTime"`
	ClosingTime string `json:"closingTime"`
	Prop        string `json:"prop"`
}

type ScheduleTradingTime added in v0.0.9

type ScheduleTradingTime struct {
	OpeningTime     string `json:"openingTime"`
	ClosingTime     string `json:"closingTime"`
	CancelDayOrders string `json:"cancelDayOrders"`
}

type SearchContractBySymbolItem added in v0.0.9

type SearchContractBySymbolItem struct {
	ContractId    string            `json:"conid"`
	CompanyHeader string            `json:"companyHeader"`
	CompanyName   string            `json:"companyName"`
	Symbol        string            `json:"symbol"`
	Description   *string           `json:"description,omitempty"`
	Restricted    *string           `json:"restricted,omitempty"`
	Sections      []ContractSection `json:"sections"`
}

type SearchContractBySymbolQuery added in v0.0.9

type SearchContractBySymbolQuery struct {
	Symbol       string
	Name         *bool
	SecurityType *SecurityType
}

type SearchContractRulesQuery added in v0.0.9

type SearchContractRulesQuery struct {
	ContractId  int     `json:"conid"`
	Exchange    *string `json:"exchange,omitempty"`
	IsBuy       *bool   `json:"isBuy,omitempty"`
	ModifyOrder *bool   `json:"modifyOrder,omitempty"`
	OrderId     *int    `json:"orderId,omitempty"`
}

type SearchSecurityDefinitionItem added in v0.0.9

type SearchSecurityDefinitionItem struct {
	ContractId      int             `json:"conid"`
	Currency        string          `json:"currency"`
	Time            int             `json:"time"`
	ChineseName     string          `json:"chineseName"`
	AllExchanges    string          `json:"allExchanges"`
	ListingExchange string          `json:"listingExchange"`
	CountryCode     string          `json:"countryCode"`
	Name            string          `json:"name"`
	AssetClass      string          `json:"assetClass"`
	Expiry          *string         `json:"expiry,omitempty"`
	LastTradingDay  *string         `json:"lastTradingDay,omitempty"`
	Group           string          `json:"group"`
	PutOrCall       *string         `json:"putOrCall,omitempty"`
	Sector          string          `json:"sector"`
	SectorGroup     string          `json:"sectorGroup"`
	Strike          string          `json:"strike"`
	Ticker          string          `json:"ticker"`
	UndContractId   int             `json:"undConid"`
	Multiplier      float64         `json:"multiplier"`
	Type            string          `json:"type"`
	HasOptions      bool            `json:"hasOptions"`
	FullName        string          `json:"fullName"`
	IsUS            bool            `json:"isUS"`
	IncrementRules  []IncrementRule `json:"incrementRules"`
	DisplaceRule    DisplayRule     `json:"displayRule"`
	IsEventContract bool            `json:"isEventContract"`
	PageSize        int             `json:"pageSize"`
}

type SearchSecurityDefinitionResponse added in v0.0.9

type SearchSecurityDefinitionResponse struct {
	SecurityDefinitions []SearchSecurityDefinitionItem `json:"SearchSecurityDefinitionItem"`
}

type SecurityType added in v0.0.9

type SecurityType string

type ServerInfo added in v0.0.9

type ServerInfo struct {
	ServerName    string `json:"serverName"`
	ServerVersion string `json:"serverVersion"`
}

type SessionService added in v0.0.9

type SessionService struct {
	// contains filtered or unexported fields
}

SessionService :

func (*SessionService) PostAuthStatus added in v0.0.9

func (s *SessionService) PostAuthStatus() (*AuthStatusInfo, error)

func (*SessionService) PostPingServer added in v0.0.9

func (s *SessionService) PostPingServer() (*PingServerResponse, error)

type SessionServiceI added in v0.0.9

type SessionServiceI interface {
	PostAuthStatus() (*AuthStatusInfo, error)
	PostPingServer() (*PingServerResponse, error)
}

type SortDirection added in v0.0.42

type SortDirection string

type StockContractItem added in v0.0.9

type StockContractItem struct {
	ContractId int    `json:"conid"`
	Exchange   string `json:"exchange"`
	IsUS       bool   `json:"isUS"`
}

type StockInfoItem added in v0.0.9

type StockInfoItem struct {
	Name        string              `json:"name"`
	ChineseName string              `json:"chineseName"`
	AssetClass  string              `json:"assetClass"`
	Contracts   []StockContractItem `json:"contracts"`
}

type SuppressMessagesResponse added in v0.0.61

type SuppressMessagesResponse struct {
	Status string
}

type SuppressibleMessageId added in v0.0.61

type SuppressibleMessageId string

type TimeInForce added in v0.0.42

type TimeInForce string

type TradeItem added in v0.0.51

type TradeItem struct {
	ExecutionId          string  `json:"execution_id,omitempty"`
	Symbol               string  `json:"symbol,omitempty"`
	SupportsTaxOpt       string  `json:"supports_tax_opt,omitempty"`
	Side                 string  `json:"side,omitempty"`
	OrderDescription     string  `json:"order_description,omitempty"`
	OrderRef             string  `json:"order_ref,omitempty"`
	TradeTime            string  `json:"trade_time,omitempty"`
	TradeTimeR           int64   `json:"trade_time_r,omitempty"`
	Size                 float64 `json:"size,omitempty"`
	Price                string  `json:"price,omitempty"`
	Submitter            string  `json:"submitter,omitempty"`
	Exchange             string  `json:"exchange,omitempty"`
	Commission           string  `json:"commission,omitempty"`
	NetAmount            float64 `json:"net_amount,omitempty"`
	Account              string  `json:"account,omitempty"`
	AccountCode          string  `json:"accountCode,omitempty"`
	CompanyName          string  `json:"company_name,omitempty"`
	ContractDescription1 string  `json:"contract_description_1,omitempty"`
	SecType              string  `json:"sec_type,omitempty"`
	ListingExchange      string  `json:"listing_exchange,omitempty"` // Returns the primary listing exchange of the contract.
	ContractId           int     `json:"conid,omitempty"`
	ContractIdExchange   string  `json:"conidEx,omitempty"`
	ClearingId           string  `json:"clearing_id,omitempty"`
	ClearingName         string  `json:"clearing_name,omitempty"`
	LiquidationTrade     string  `json:"liquidation_trade,omitempty"`
	IsEventTrading       string  `json:"is_event_trading,omitempty"`
}

type TradingScheduleItem added in v0.0.9

type TradingScheduleItem struct {
	ClearingCycleEndTime string                `json:"clearingCycleEndTime"`
	TradingScheduleDate  string                `json:"tradingScheduleDate"`
	Sessions             []ScheduleSession     `json:"sessions"`
	TradingTimes         []ScheduleTradingTime `json:"tradingtimes"`
}

type TradingScheduleQuery added in v0.0.9

type TradingScheduleQuery struct {
	AssetClass     string  `json:"assetClass"`
	ContractId     int     `json:"conid"`
	Symbol         string  `json:"symbol"`
	Exchange       *string `json:"exchange,omitempty"`
	ExchangeFilter *string `json:"exchangeFilter,omitempty"`
}

type TrailingType added in v0.0.42

type TrailingType string

type WebSocketClient added in v0.0.12

type WebSocketClient struct {
	// contains filtered or unexported fields
}

WebSocketClient :

func NewDefaultWebsocketClient added in v0.0.12

func NewDefaultWebsocketClient() *WebSocketClient

NewDefaultWebsocketClient :

func NewWebsocketClient added in v0.0.12

func NewWebsocketClient(wsBaseUrl string, wsPrefixEndpoint string, skipTlsVerify bool) *WebSocketClient

NewWebsocketClient :

func (*WebSocketClient) Service added in v0.0.12

Service :

func (*WebSocketClient) WithBaseURL added in v0.0.12

func (c *WebSocketClient) WithBaseURL(url string) *WebSocketClient

WithBaseURL :

func (*WebSocketClient) WithDebug added in v0.0.12

func (c *WebSocketClient) WithDebug(debug bool) *WebSocketClient

WithDebug :

func (*WebSocketClient) WithLogger added in v0.0.12

func (c *WebSocketClient) WithLogger(logger *log.Logger) *WebSocketClient

WithLogger :

func (*WebSocketClient) WithPrefixEndpoint added in v0.0.12

func (c *WebSocketClient) WithPrefixEndpoint(prefixEndpoint string) *WebSocketClient

WithPrefixEndpoint :

func (*WebSocketClient) WithSkipTLSVersify added in v0.0.12

func (c *WebSocketClient) WithSkipTLSVersify(skipTlsVerify bool) *WebSocketClient

WithSkipTLSVersify :

type WebsocketAccountAllowFeatures added in v0.0.38

type WebsocketAccountAllowFeatures struct {
	ShowGFIS               bool   `json:"showGFIS,omitempty"`
	ShowEUCostReport       bool   `json:"showEUCostReport,omitempty"`
	AllowEventContract     bool   `json:"allowEventContract,omitempty"`
	AllowFXConv            bool   `json:"allowFXConv,omitempty"`
	AllowFinancialLens     bool   `json:"allowFinancialLens,omitempty"`
	AllowMTA               bool   `json:"allowMTA,omitempty"`
	AllowTypeAhead         bool   `json:"allowTypeAhead,omitempty"`
	AllowEventTrading      bool   `json:"allowEventTrading,omitempty"`
	SnapshotRefreshTimeout int    `json:"snapshotRefreshTimeout,omitempty"`
	LiteUser               bool   `json:"liteUser,omitempty"`
	ShowWebNews            bool   `json:"showWebNews,omitempty"`
	Research               bool   `json:"research,omitempty"`
	DebugPnl               bool   `json:"debugPnl,omitempty"`
	ShowTaxOpt             bool   `json:"showTaxOpt,omitempty"`
	ShowImpactDashboard    bool   `json:"showImpactDashboard,omitempty"`
	AllowDynAccount        bool   `json:"allowDynAccount,omitempty"`
	AllowCrypto            bool   `json:"allowCrypto,omitempty"`
	AllowedAssetTypes      string `json:"allowedAssetTypes,omitempty"`
}

type WebsocketClientService added in v0.0.12

type WebsocketClientService struct {
	// contains filtered or unexported fields
}

WebsocketClientService :

func (*WebsocketClientService) Private added in v0.0.18

func (s *WebsocketClientService) Private(sessionToken string) (*WebsocketPrivateService, error)

Private :

func (*WebsocketClientService) PrivateWithSourceIP added in v0.0.18

func (s *WebsocketClientService) PrivateWithSourceIP(sessionToken, sourceIP string) (*WebsocketPrivateService, error)

PrivateWithSourceIP :

func (*WebsocketClientService) Public added in v0.0.12

func (s *WebsocketClientService) Public(sessionToken string) (*WebsocketPublicService, error)

Public :

func (*WebsocketClientService) PublicWithSourceIP added in v0.0.12

func (s *WebsocketClientService) PublicWithSourceIP(sessionToken, sourceIP string) (*WebsocketPublicService, error)

PublicWithSourceIP :

type WebsocketClientServiceI added in v0.0.12

type WebsocketClientServiceI interface {
	Public(sessionToken string) (*WebsocketPublicService, error)
	PublicWithSourceIP(sessionToken string, sourceIP string) (*WebsocketPublicService, error)
	Private(sessionToken string) (*WebsocketPrivateService, error)
	PrivateWithSourceIP(sessionToken string, sourceIP string) (*WebsocketPrivateService, error)
}

WebsocketClientServiceI :

type WebsocketPrivateAccountLedgerItem added in v0.0.41

type WebsocketPrivateAccountLedgerItem struct {
	Key                       string  `json:"key"`
	SecondKey                 string  `json:"secondKey,omitempty"`
	Timestamp                 int64   `json:"timestamp,omitempty"`
	Dividends                 float64 `json:"dividends,omitempty"`
	ExchangeRate              float64 `json:"exchangeRate,omitempty"`
	Funds                     float64 `json:"funds,omitempty"`
	AccountCode               string  `json:"acctCode,omitempty"`
	CashBalance               float64 `json:"cashbalance,omitempty"`
	CashBalanceFXSegment      float64 `json:"cashBalanceFXSegment,omitempty"`
	CommodityMarketValue      float64 `json:"commodityMarketValue,omitempty"`
	CorporateBondsMarketValue float64 `json:"corporateBondsMarketValue,omitempty"`
	MarketValue               float64 `json:"marketValue,omitempty"`
	OptionMarketValue         float64 `json:"optionMarketValue,omitempty"`
	Interest                  float64 `json:"interest,omitempty"`
	IssueOptionsMarketValue   float64 `json:"issueOptionsMarketValue,omitempty"`
	MoneyFunds                float64 `json:"moneyFunds,omitempty"`
	NetLiquidationValue       float64 `json:"netLiquidationValue,omitempty"`
	RealizedPnl               float64 `json:"realizedPnl,omitempty"`
	UnrealizedPnl             float64 `json:"unrealizedPnl,omitempty"`
	SettledCash               float64 `json:"settledCash,omitempty"`
	Severity                  float64 `json:"severity,omitempty"`
	StockMarketValue          float64 `json:"stockMarketValue,omitempty"`
	TBillsMarketValue         float64 `json:"tBillsMarketValue,omitempty"`
	TBondsMarketValue         float64 `json:"tBondsMarketValue,omitempty"`
	WarrantsMarketValue       float64 `json:"warrantsMarketValue,omitempty"`
}

type WebsocketPrivateAccountLedgerParam added in v0.0.18

type WebsocketPrivateAccountLedgerParam struct {
	AccountId string
	Keys      []string
	Fields    []string
}

type WebsocketPrivateAccountLedgerResponse added in v0.0.18

type WebsocketPrivateAccountLedgerResponse struct {
	Result []WebsocketPrivateAccountLedgerItem `json:"result"`
}

type WebsocketPrivateAccountSummaryParam added in v0.0.18

type WebsocketPrivateAccountSummaryParam struct {
	AccountId string
	Keys      []string
	Fields    []string
}

type WebsocketPrivateAccountSummaryResponse added in v0.0.18

type WebsocketPrivateAccountSummaryResponse struct {
	Result map[string]interface{} `json:"result"`
}

type WebsocketPrivateOrder added in v0.0.41

type WebsocketPrivateOrder struct {
	AccountId          string  `json:"acct,omitempty"`
	ContractId         int     `json:"conid,omitempty"`
	OrderId            int64   `json:"orderId,omitempty"`
	CashCcy            string  `json:"cashCcy,omitempty"`
	SizeAndFills       string  `json:"sizeAndFills,omitempty"`
	OrderDesc          string  `json:"orderDesc,omitempty"`
	Description1       string  `json:"description1,omitempty"`
	Ticker             string  `json:"ticker,omitempty"`
	SecurityType       string  `json:"secType,omitempty"`
	ListingExchange    string  `json:"listingExchange,omitempty"`
	RemainingQuantity  float64 `json:"remainingQuantity,omitempty"`
	FilledQuantity     float64 `json:"filledQuantity,omitempty"`
	CompanyName        string  `json:"companyName,omitempty"`
	Status             string  `json:"status,omitempty"`
	OrderCcpStatus     string  `json:"order_ccp_status,omitempty"`
	OrigOrderType      string  `json:"origOrderType,omitempty"`
	SupportsTaxOpt     string  `json:"supportsTaxOpt,omitempty"`
	LastExecutionTime  string  `json:"lastExecutionTime"`
	LastExecutionTimeR int64   `json:"lastExecutionTime_r,omitempty"` // Returns the epoch time of the most recent execution on the order.
	OrderType          string  `json:"orderType"`
	BgColor            string  `json:"bgColor,omitempty"`
	FgColor            string  `json:"fgColor,omitempty"`
	OrderRef           string  `json:"order_ref,omitempty"` // User defined string used to identify the order. Value is set using “cOID” field while placing an order.
	TimeInForce        string  `json:"timeInForce,omitempty"`
	Side               string  `json:"side,omitempty"`
	Price              float64 `json:"price,omitempty"`
}

type WebsocketPrivateOrderParam added in v0.0.18

type WebsocketPrivateOrderParam struct {
	Status []string
}

type WebsocketPrivateOrderResponse added in v0.0.18

type WebsocketPrivateOrderResponse struct {
	Orders   []WebsocketPrivateOrder `json:"orders"`
	Snapshot bool                    `json:"snapshot,omitempty"`
}

type WebsocketPrivateOrderResponseV2 added in v0.0.62

type WebsocketPrivateOrderResponseV2 struct {
	Orders []WebsocketPrivateOrderV2 `json:"args"`
}

type WebsocketPrivateOrderV2 added in v0.0.62

type WebsocketPrivateOrderV2 struct {
	AccountId          string  `json:"acct,omitempty"`
	Exchange           string  `json:"exchange,omitempty"`
	ContractIdExchange string  `json:"conidex,omitempty"`
	ContractId         int     `json:"conid,omitempty"`
	Account            string  `json:"account,omitempty"`
	OrderId            int64   `json:"orderId,omitempty"`
	CashCcy            string  `json:"cashCcy,omitempty"`
	SizeAndFills       string  `json:"sizeAndFills,omitempty"`
	OrderDesc          string  `json:"orderDesc,omitempty"`
	Description1       string  `json:"description1,omitempty"`
	Ticker             string  `json:"ticker,omitempty"`
	SecurityType       string  `json:"secType,omitempty"`
	ListingExchange    string  `json:"listingExchange,omitempty"`
	RemainingQuantity  float64 `json:"remainingQuantity,omitempty"`
	FilledQuantity     float64 `json:"filledQuantity,omitempty"`
	TotalSize          float64 `json:"totalSize,omitempty"`
	CompanyName        string  `json:"companyName,omitempty"`
	Status             string  `json:"status,omitempty"`
	OrderCcpStatus     string  `json:"order_ccp_status,omitempty"`
	OrigOrderType      string  `json:"origOrderType,omitempty"`
	SupportsTaxOpt     string  `json:"supportsTaxOpt,omitempty"`
	LastExecutionTime  string  `json:"lastExecutionTime,omitempty"`
	LastExecutionTimeR int64   `json:"lastExecutionTime_r,omitempty"` // Returns the epoch time of the most recent execution on the order.
	OrderType          string  `json:"orderType,omitempty"`
	BgColor            string  `json:"bgColor,omitempty"`
	FgColor            string  `json:"fgColor,omitempty"`
	OrderRef           string  `json:"order_ref,omitempty"`
	IsEventTrading     string  `json:"isEventTrading,omitempty"`
	Price              string  `json:"price,omitempty"`
	TimeInForce        string  `json:"timeInForce,omitempty"`
	Side               string  `json:"side,omitempty"`
}

type WebsocketPrivatePnLResponse added in v0.0.18

type WebsocketPrivatePnLResponse struct {
	Topic string      `json:"topic"`
	Args  interface{} `json:"args"`
}

type WebsocketPrivateService added in v0.0.18

type WebsocketPrivateService struct {
	// contains filtered or unexported fields
}

func (*WebsocketPrivateService) Close added in v0.0.18

func (s *WebsocketPrivateService) Close() error

Close :

func (*WebsocketPrivateService) Ping added in v0.0.18

func (s *WebsocketPrivateService) Ping() error

Ping :

func (*WebsocketPrivateService) Run added in v0.0.18

func (s *WebsocketPrivateService) Run() error

Run :

func (*WebsocketPrivateService) SetAccountUpdatesChan added in v0.0.38

func (s *WebsocketPrivateService) SetAccountUpdatesChan(channel chan *WebsocketUnsolicitedAccountUpdatesResponse)

func (*WebsocketPrivateService) SetAuthStatusChan added in v0.0.38

func (s *WebsocketPrivateService) SetAuthStatusChan(channel chan *WebsocketUnsolicitedAuthStatusResponse)

func (*WebsocketPrivateService) SetBulletinsChan added in v0.0.38

func (s *WebsocketPrivateService) SetBulletinsChan(channel chan *WebsocketUnsolicitedBulletinsResponse)

func (*WebsocketPrivateService) SetNotificationsChan added in v0.0.38

func (s *WebsocketPrivateService) SetNotificationsChan(channel chan *WebsocketUnsolicitedNotificationsResponse)

func (*WebsocketPrivateService) SetSystemChan added in v0.0.38

func (*WebsocketPrivateService) Start added in v0.0.18

func (s *WebsocketPrivateService) Start(ctx context.Context, errHandler ErrHandler) error

Start :

func (*WebsocketPrivateService) SubscribeAccountLedger added in v0.0.18

func (s *WebsocketPrivateService) SubscribeAccountLedger(
	param WebsocketPrivateAccountLedgerParam,
	handler func(WebsocketPrivateAccountLedgerResponse) error,
) (func() error, error)

func (*WebsocketPrivateService) SubscribeAccountSummary added in v0.0.18

func (s *WebsocketPrivateService) SubscribeAccountSummary(
	param WebsocketPrivateAccountSummaryParam,
	handler func(WebsocketPrivateAccountSummaryResponse) error,
) (func() error, error)

func (*WebsocketPrivateService) SubscribeOrder added in v0.0.18

func (s *WebsocketPrivateService) SubscribeOrder(
	param WebsocketPrivateOrderParam,
	handler func(WebsocketPrivateOrderResponse) error,
) (func() error, error)

func (*WebsocketPrivateService) SubscribeOrderV2 added in v0.0.62

func (s *WebsocketPrivateService) SubscribeOrderV2(
	handler func(WebsocketPrivateOrderResponseV2) error,
) (func() error, error)

func (*WebsocketPrivateService) SubscribePnL added in v0.0.18

func (s *WebsocketPrivateService) SubscribePnL(
	handler func(WebsocketPrivatePnLResponse) error,
) (func() error, error)

func (*WebsocketPrivateService) SubscribeTradesData added in v0.0.18

func (s *WebsocketPrivateService) SubscribeTradesData(
	param WebsocketPrivateTradesDataParam,
	handler func(WebsocketPrivateTradesDataResponse) error,
) (func() error, error)

func (*WebsocketPrivateService) UnsubscribeAccountLedger added in v0.0.36

func (s *WebsocketPrivateService) UnsubscribeAccountLedger(
	param WebsocketPrivateAccountLedgerParam,
) error

func (*WebsocketPrivateService) UnsubscribeAccountSummary added in v0.0.36

func (s *WebsocketPrivateService) UnsubscribeAccountSummary(
	param WebsocketPrivateAccountSummaryParam,
) error

func (*WebsocketPrivateService) UnsubscribeOrder added in v0.0.36

func (s *WebsocketPrivateService) UnsubscribeOrder(
	param WebsocketPrivateOrderParam,
) error

func (*WebsocketPrivateService) UnsubscribePnL added in v0.0.36

func (s *WebsocketPrivateService) UnsubscribePnL() error

func (*WebsocketPrivateService) UnsubscribeTradesData added in v0.0.36

func (s *WebsocketPrivateService) UnsubscribeTradesData(
	param WebsocketPrivateTradesDataParam,
) error

type WebsocketPrivateServiceI added in v0.0.18

type WebsocketPrivateServiceI interface {
	Start(context.Context, ErrHandler) error
	Run() error
	Ping() error
	Close() error
	SetAccountUpdatesChan(channel chan *WebsocketUnsolicitedAccountUpdatesResponse)
	SetAuthStatusChan(channel chan *WebsocketUnsolicitedAuthStatusResponse)
	SetSystemChan(channel chan *WebsocketUnsolicitedSystemConnectionResponse)
	SetBulletinsChan(channel chan *WebsocketUnsolicitedBulletinsResponse)
	SetNotificationsChan(channel chan *WebsocketUnsolicitedNotificationsResponse)

	SubscribeAccountSummary(
		WebsocketPrivateAccountSummaryParam,
		func(WebsocketPrivateAccountSummaryResponse) error,
	) (func() error, error)
	UnsubscribeAccountSummary(
		WebsocketPrivateAccountSummaryParam,
	) error
	SubscribeAccountLedger(
		WebsocketPrivateAccountLedgerParam,
		func(WebsocketPrivateAccountLedgerResponse) error,
	) (func() error, error)
	UnsubscribeAccountLedger(
		WebsocketPrivateAccountLedgerParam,
	) error

	SubscribeOrder(
		WebsocketPrivateOrderParam,
		func(WebsocketPrivateOrderResponse) error,
	) (func() error, error)
	SubscribeOrderV2(
		func(WebsocketPrivateOrderResponseV2) error,
	) (func() error, error)
	UnsubscribeOrder(
		WebsocketPrivateOrderParam,
	) error
	SubscribePnL(
		func(WebsocketPrivatePnLResponse) error,
	) (func() error, error)
	UnsubscribePnL() error
	SubscribeTradesData(
		WebsocketPrivateTradesDataParam,
		func(WebsocketPrivateTradesDataResponse) error,
	) (func() error, error)
	UnsubscribeTradesData(
		WebsocketPrivateTradesDataParam,
	) error
}

WebsocketPrivateServiceI :

type WebsocketPrivateTradesData added in v0.0.41

type WebsocketPrivateTradesData struct {
	ExecutionId          string  `json:"execution_id,omitempty"`
	Symbol               string  `json:"symbol,omitempty"`
	SupportsTaxOpt       string  `json:"supports_tax_opt,omitempty"`
	Side                 string  `json:"side,omitempty"`
	OrderDescription     string  `json:"order_description,omitempty"`
	TradeTime            string  `json:"trade_time,omitempty"`
	TradeTimeR           int64   `json:"trade_time_r,omitempty"`
	Size                 float64 `json:"size,omitempty"`
	OrderRef             string  `json:"order_ref,omitempty"`
	Price                string  `json:"price,omitempty"`
	Exchange             string  `json:"exchange,omitempty"`
	NetAmount            float64 `json:"net_amount,omitempty"`
	Account              string  `json:"account,omitempty"`
	AccountCode          string  `json:"accountCode,omitempty"`
	CompanyName          string  `json:"company_name,omitempty"`
	ContractDescription1 string  `json:"contract_description_1,omitempty"`
	ContractDescription2 string  `json:"contract_description_2,omitempty"`
	SecType              string  `json:"sec_type,omitempty"`
	ContractId           int     `json:"conid,omitempty"`
	ContractIdExchange   string  `json:"conidEx,omitempty"`
	OpenClose            string  `json:"open_close,omitempty"`
	LiquidationTrade     string  `json:"liquidation_trade,omitempty"`
	IsEventTrading       string  `json:"is_event_trading,omitempty"`
}

type WebsocketPrivateTradesDataParam added in v0.0.18

type WebsocketPrivateTradesDataParam struct {
	RealtimeUpdatesOnly *bool
	Days                *int
}

type WebsocketPrivateTradesDataResponse added in v0.0.18

type WebsocketPrivateTradesDataResponse struct {
	Topic string                       `json:"topic,omitempty"`
	Args  []WebsocketPrivateTradesData `json:"args,omitempty"`
}

type WebsocketPublicBookTraderParam added in v0.0.18

type WebsocketPublicBookTraderParam struct {
}

type WebsocketPublicBookTraderResponse added in v0.0.18

type WebsocketPublicBookTraderResponse struct {
}

type WebsocketPublicHistoricalMarketDataParam added in v0.0.36

type WebsocketPublicHistoricalMarketDataParam struct {
	ContractIds []int  `json:"-"`
	Exchange    string `json:"exchange,omitempty"`
	Period      string `json:"period,omitempty"`
	Bar         string `json:"bar,omitempty"`
	OutsideRth  bool   `json:"outsideRth"`
	Source      string `json:"source,omitempty"`
	Format      string `json:"format,omitempty"`
}

type WebsocketPublicHistoricalMarketDataResponse added in v0.0.36

type WebsocketPublicHistoricalMarketDataResponse struct {
	Topic    string `json:"topic,omitempty"`
	ServerId string `json:"server_id,omitempty"`
	Symbol   string `json:"symbol,omitempty"`
}

type WebsocketPublicMarketDataParam added in v0.0.36

type WebsocketPublicMarketDataParam struct {
	ContractIds []int
	Fields      []string
}

type WebsocketPublicMarketDataResponse added in v0.0.36

type WebsocketPublicMarketDataResponse struct {
	Topic                  string `json:"topic,omitempty"`
	ServerId               string `json:"server_id,omitempty"`
	ContractIdExchange     string `json:"conidEx,omitempty"`
	ContractId             int    `json:"conid,omitempty"`
	UpdateTime             int64  `json:"_updated,omitempty"`
	MarketDataAvailability string `json:"6509,omitempty"`
	BidSize                string `json:"88,omitempty"`
	BidPrice               string `json:"84,omitempty"`
	AskSize                string `json:"85,omitempty"`
	AskPrice               string `json:"86,omitempty"`
	LastPrice              string `json:"31,omitempty"`
	LastSize               string `json:"7059,omitempty"`
	VolumeOfDay            string `json:"87,omitempty"`
	VolumeLongOfDay        string `json:"7762,omitempty"`
}

type WebsocketPublicService added in v0.0.12

type WebsocketPublicService struct {
	// contains filtered or unexported fields
}

func (*WebsocketPublicService) Close added in v0.0.12

func (s *WebsocketPublicService) Close() error

Close :

func (*WebsocketPublicService) Ping added in v0.0.12

func (s *WebsocketPublicService) Ping() error

Ping :

func (*WebsocketPublicService) Run added in v0.0.12

func (s *WebsocketPublicService) Run() error

Run :

func (*WebsocketPublicService) SetAccountUpdatesChan added in v0.0.38

func (s *WebsocketPublicService) SetAccountUpdatesChan(channel chan *WebsocketUnsolicitedAccountUpdatesResponse)

func (*WebsocketPublicService) SetAuthStatusChan added in v0.0.38

func (s *WebsocketPublicService) SetAuthStatusChan(channel chan *WebsocketUnsolicitedAuthStatusResponse)

func (*WebsocketPublicService) SetBulletinsChan added in v0.0.38

func (s *WebsocketPublicService) SetBulletinsChan(channel chan *WebsocketUnsolicitedBulletinsResponse)

func (*WebsocketPublicService) SetNotificationsChan added in v0.0.38

func (s *WebsocketPublicService) SetNotificationsChan(channel chan *WebsocketUnsolicitedNotificationsResponse)

func (*WebsocketPublicService) SetSystemChan added in v0.0.38

func (*WebsocketPublicService) Start added in v0.0.12

func (s *WebsocketPublicService) Start(ctx context.Context, errHandler ErrHandler) error

Start :

func (*WebsocketPublicService) SubscribeBookTrader added in v0.0.18

func (s *WebsocketPublicService) SubscribeBookTrader(
	param WebsocketPublicBookTraderParam,
	handler func(WebsocketPublicBookTraderResponse) error,
) (func() error, error)

func (*WebsocketPublicService) SubscribeHistoricalTicker added in v0.0.36

func (*WebsocketPublicService) SubscribeMarketData added in v0.0.36

func (s *WebsocketPublicService) SubscribeMarketData(
	param WebsocketPublicMarketDataParam,
	handler func(WebsocketPublicMarketDataResponse) error,
) (func() error, error)

func (*WebsocketPublicService) UnsubscribeBookTrader added in v0.0.36

func (s *WebsocketPublicService) UnsubscribeBookTrader(
	param WebsocketPublicBookTraderParam,
) error

func (*WebsocketPublicService) UnsubscribeHistoricalMarketData added in v0.0.36

func (s *WebsocketPublicService) UnsubscribeHistoricalMarketData(
	param WebsocketPublicHistoricalMarketDataParam,
) error

func (*WebsocketPublicService) UnsubscribeMarketData added in v0.0.36

func (s *WebsocketPublicService) UnsubscribeMarketData(
	param WebsocketPublicMarketDataParam,
) error

type WebsocketPublicServiceI added in v0.0.12

type WebsocketPublicServiceI interface {
	Start(context.Context, ErrHandler) error
	Run() error
	Ping() error
	Close() error
	SetAccountUpdatesChan(channel chan *WebsocketUnsolicitedAccountUpdatesResponse)
	SetAuthStatusChan(channel chan *WebsocketUnsolicitedAuthStatusResponse)
	SetSystemChan(channel chan *WebsocketUnsolicitedSystemConnectionResponse)
	SetBulletinsChan(channel chan *WebsocketUnsolicitedBulletinsResponse)
	SetNotificationsChan(channel chan *WebsocketUnsolicitedNotificationsResponse)

	SubscribeMarketData(
		WebsocketPublicMarketDataParam,
		func(WebsocketPublicMarketDataResponse) error,
	) (func() error, error)
	UnsubscribeMarketData(
		WebsocketPublicMarketDataParam,
	) error
	SubscribeHistoricalMarketData(
		WebsocketPublicMarketDataParam,
		func(WebsocketPublicMarketDataResponse) error,
	) (func() error, error)
	UnsubscribeHistoricalMarketData(
		WebsocketPublicMarketDataParam,
	) error
	SubscribeBookTrader(
		WebsocketPublicBookTraderParam,
		func(WebsocketPublicBookTraderResponse) error,
	) (func() error, error)
	UnsubscribeBookTrader(
		WebsocketPublicBookTraderParam,
	) error
}

WebsocketPublicServiceI :

type WebsocketServerInfo added in v0.0.38

type WebsocketServerInfo struct {
	ServerName    string `json:"serverName"`
	ServerVersion string `json:"serverVersion"`
}

type WebsocketUnsolicitedAccountUpdatesArgs added in v0.0.38

type WebsocketUnsolicitedAccountUpdatesArgs struct {
	Accounts                   []string                      `json:"accounts,omitempty"`
	AccountProperties          interface{}                   `json:"acctProps,omitempty"`
	Aliases                    interface{}                   `json:"aliases,omitempty"`
	AllowFeatures              WebsocketAccountAllowFeatures `json:"allowFeatures,omitempty"`
	ChartPeriods               interface{}                   `json:"chartPeriods,omitempty"`
	Groups                     interface{}                   `json:"groups,omitempty"`
	Profiles                   interface{}                   `json:"profiles,omitempty"`
	SelectedAccount            string                        `json:"selectedAccount,omitempty"`
	ServerInfo                 WebsocketServerInfo           `json:"serverInfo"`
	SessionId                  string                        `json:"sessionId,omitempty"`
	IsFractionalTradingAccount bool                          `json:"isFT,omitempty"`
	IsPaperTradingAccount      bool                          `json:"isPaper,omitempty"`
}

type WebsocketUnsolicitedAccountUpdatesResponse added in v0.0.38

type WebsocketUnsolicitedAccountUpdatesResponse struct {
	Topic string                                 `json:"topic"`
	Args  WebsocketUnsolicitedAccountUpdatesArgs `json:"args,omitempty"`
}

type WebsocketUnsolicitedAuthStatusArgs added in v0.0.38

type WebsocketUnsolicitedAuthStatusArgs struct {
	Authenticated bool   `json:"authenticated"`
	Competing     bool   `json:"competing"`
	Connected     bool   `json:"connected"`
	Message       string `json:"message,omitempty"`
	Fail          string `json:"fail,omitempty"`
	ServerName    string `json:"serverName,omitempty"`
	ServerVersion string `json:"serverVersion,omitempty"`
	UserName      string `json:"username,omitempty"`
}

type WebsocketUnsolicitedAuthStatusResponse added in v0.0.38

type WebsocketUnsolicitedAuthStatusResponse struct {
	Topic string                             `json:"topic"`
	Args  WebsocketUnsolicitedAuthStatusArgs `json:"args,omitempty"`
}

type WebsocketUnsolicitedBulletinsArgs added in v0.0.38

type WebsocketUnsolicitedBulletinsArgs struct {
	Id      string `json:"id,omitempty"`
	Message string `json:"message,omitempty"`
}

type WebsocketUnsolicitedBulletinsResponse added in v0.0.38

type WebsocketUnsolicitedBulletinsResponse struct {
	Topic string                            `json:"topic"`
	Args  WebsocketUnsolicitedBulletinsArgs `json:"args,omitempty"`
}

type WebsocketUnsolicitedNotificationsArgs added in v0.0.38

type WebsocketUnsolicitedNotificationsArgs struct {
	Id    string `json:"id"`
	Text  string `json:"text,omitempty"`
	Title string `json:"title,omitempty"`
	Url   string `json:"url,omitempty"`
}

type WebsocketUnsolicitedNotificationsResponse added in v0.0.38

type WebsocketUnsolicitedNotificationsResponse struct {
	Topic string                                `json:"topic"`
	Args  WebsocketUnsolicitedNotificationsArgs `json:"args,omitempty"`
}

type WebsocketUnsolicitedSystemConnectionResponse added in v0.0.38

type WebsocketUnsolicitedSystemConnectionResponse struct {
	Topic                      string `json:"topic"`
	Success                    string `json:"success,omitempty"`
	IsFractionalTradingAccount bool   `json:"isFT,omitempty"`
	IsPaperTradingAccount      bool   `json:"isPaper,omitempty"`
	HB                         int64  `json:"hb,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL