ibapi

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 19 Imported by: 0

README

Go Report Card Go Reference

Unofficial Golang Interactive Brokers API (Beta)

This package provides an unofficial Golang implementation of the Interactive Brokers API. It is designed to mirror the official Python or C++ tws-api provided by Interactive Brokers. We will do our best to keep it in sync with the official API releases to ensure compatibility and feature parity, but users should be aware that this is a community-driven project and may lag behind the official versions at times.

Note: This package is in the beta phase. While functional, it may still have bugs or incomplete features. Please test extensively in non-production environments.

Getting Started

Prerequisites
  • Go version 1.23 or higher (recommended)
  • An Interactive Brokers account with TWS or IB Gateway installed and running
Installation

Install the package via go get:

go get -u github.com/scmhub/ibapi

Usage

Here’s a basic example to connect and place an order using this package:

package main

import (
	"math/rand"
	"time"

	"github.com/scmhub/ibapi"
)

const (
	IB_HOST = "127.0.0.1"
	IB_PORT = 7497
)

func main() {
	// We set logger for pretty logs to console
	log := ibapi.Logger()
	ibapi.SetConsoleWriter()

	// New IB CLient
	ib := ibapi.NewEClient(nil)
	
    // Connect client
	if err := ib.Connect(IB_HOST, IB_PORT, rand.Int63n(999999)); err != nil {
		log.Error().Err(err)
		return
	}

    // Create and place order
	id := 1
	eurusd := &ibapi.Contract{Symbol: "EUR", SecType: "CASH", Currency: "USD", Exchange: "IDEALPRO"}
	limitOrder := ibapi.LimitOrder("BUY", ibapi.StringToDecimal("20000"), 1.08)
	ib.PlaceOrder(id, eurusd, limitOrder)

	time.Sleep(1 * time.Second)

	err := ib.Disconnect()
	if err != nil {
		log.Error().Err(err).Msg("Disconnect")
	}
}

For more information on how to use this package, please refer to the GoDoc documentation.

Acknowledgments

  • Some portions of the code were adapted from hadrianl. Thanks to them for their valuable work!
  • Decimals are implemented with the fixed package

Notice of Non-Affiliation and Disclaimer

Beta Release: This project is in the beta phase and is still undergoing testing and development. Users are advised to thoroughly test the software in non-production environments before relying on it for live trading. Features may be incomplete, and bugs may exist. Use at your own risk.

This project is not affiliated with Interactive Brokers Group, Inc. All references to Interactive Brokers, including trademarks, logos, and brand names, belong to their respective owners. The use of these names is purely for informational purposes and does not imply endorsement by Interactive Brokers.

The authors of this package make no guarantees regarding the software's reliability, accuracy, or suitability for any particular purpose, including trading or financial decisions. No liability will be accepted for any financial losses, damages, or misinterpretations arising from the use of this software.

License

Distributed under the MIT License. See LICENSE for more information.

Documentation

Overview

EClient is the main struct to use from API user's point of view. It takes care of almost everything:

  • implementing the requests
  • creating the answer decoder
  • creating the connection to TWS/IBGW

The user just needs to override EWrapper methods to receive the answers.

The EDecoder knows how to transform a message's payload into higher level IB message (eg: order info, mkt data, etc). It will call the corresponding method from the EWrapper so that customer's code (eg: class derived from EWrapper) can make further use of the data.

Index

Constants

View Source
const (
	UNSET_INT       int64   = math.MaxInt32
	UNSET_LONG      int64   = math.MaxInt64
	UNSET_FLOAT     float64 = math.MaxFloat64
	INFINITY_STRING string  = "Infinity"
)
View Source
const (
	DefaultTriggerMethod = iota
	DoubleBidAskTriggerMethod
	LastTriggerMethod
	DoubleLastTriggerMethod
	BidAskTriggerMethod
	LastBidAskTriggerMethod
	MidPointTriggerMethod
)

Trigger Methods.

View Source
const DEFAULT_LEVEL = zerolog.InfoLevel
View Source
const (

	// MAX_MSG_LEN is the max length that receiver could take.
	MAX_MSG_LEN int = 0xFFFFFF // 16Mb - 1byte
)
View Source
const NO_ROW_NUMBER_SPECIFIED int64 = -1
View Source
const (
	NO_VALID_ID int64 = -1
)

Variables

View Source
var (
	ALREADY_CONNECTED        = CodeMsgPair{501, "Already connected."}
	CONNECT_FAIL             = CodeMsgPair{502, "Couldn't connect to TWS. Confirm that 'Enable ActiveX and Socket EClients' is enabled and connection port is the same as 'Socket Port' on the TWS 'Edit->Global Configuration...->API->Settings' menu. Live Trading ports: TWS: 7496; IB Gateway: 4001. Simulated Trading ports for new installations of version 954.1 or newer:  TWS: 7497; IB Gateway: 4002"}
	UPDATE_TWS               = CodeMsgPair{503, "The TWS is out of date and must be upgraded."}
	NOT_CONNECTED            = CodeMsgPair{504, "Not connected"}
	UNKNOWN_ID               = CodeMsgPair{505, "Fatal Error: Unknown message id."}
	UNSUPPORTED_VERSION      = CodeMsgPair{506, "Unsupported version"}
	BAD_LENGTH               = CodeMsgPair{507, "Bad message length"}
	BAD_MESSAGE              = CodeMsgPair{508, "Bad message"}
	SOCKET_EXCEPTION         = CodeMsgPair{509, "Exception caught while reading socket - "}
	FAIL_CREATE_SOCK         = CodeMsgPair{520, "Failed to create socket"}
	SSL_FAIL                 = CodeMsgPair{530, "SSL specific error: "}
	INVALID_SYMBOL           = CodeMsgPair{579, "Invalid symbol in string - "}
	FA_PROFILE_NOT_SUPPORTED = CodeMsgPair{585, "FA Profile is not supported anymore, use FA Group instead - "}
)
View Source
var COMPETE_AGAINST_BEST_OFFSET_UP_TO_MID = INFINITY_FLOAT
View Source
var INFINITY_FLOAT float64 = math.Inf(1)
View Source
var ONE = Decimal(fixed.NewF(1))
View Source
var UNSET_DECIMAL = Decimal(fixed.NaN)

Functions

func DecimalMaxString

func DecimalMaxString(val Decimal) string

func DecimalToString

func DecimalToString(d Decimal) string

func EReader

func EReader(ctx context.Context, client *EClient, scanner *bufio.Scanner, decoder *EDecoder, wg *sync.WaitGroup)

EReader starts the scan and decode goroutines

func FAUpdatedGroup

func FAUpdatedGroup() string

FAUpdatedGroup returns a list of groups xml sample

func FillAccumulateDistributeParams

func FillAccumulateDistributeParams(baseOrder *Order, componentSize, timeBetweenOrders int64, randomizeTime20, randomizeSize55 bool,
	giveUp int64, catchUp, waitForFill bool, startTime, endTime string)

FillAccumulateDistributeParams .

func FillAdaptiveParams

func FillAdaptiveParams(baseOrder *Order, priority string)

FillAdaptiveParams .

func FillArrivalPriceParams

func FillArrivalPriceParams(baseOrder *Order, maxPctVol float64, riskAversion, startTime, endTime string, forceCompletion, allowPastTime bool)

FillArrivalPriceParams .

func FillBalanceImpactRiskParams

func FillBalanceImpactRiskParams(baseOrder *Order, maxPctVol float64, riskAversion string, forceCompletion bool)

FillBalanceImpactRiskParams .

func FillCSFBInlineParams

func FillCSFBInlineParams(baseOrder *Order, startTime, endTime, execStyle string, minPercent, maxPercent, displaySize int64, auction string, blockFinder bool,
	blockPrice float64, minBlockSize, maxBlockSize int64, iWouldPrice float64)

FillCSFBInlineParams .

func FillClosePriceParams

func FillClosePriceParams(baseOrder *Order, maxPctVol float64, riskAversion, startTime string, forceCompletion bool)

FillClosePriceParams .

func FillDarkIceParams

func FillDarkIceParams(baseOrder *Order, displaySize int64, startTime, endTime string, allowPastEndTime bool)

FillDarkIceParams .

func FillJefferiesVWAPParams

func FillJefferiesVWAPParams(baseOrder *Order, startTime, endTime string, relativeLimit, maxVolumeRate float64, excludeAuctions string,
	triggerPrice, wowPrice float64, minFillSize int64, wowOrderPct float64, wowMode string, isBuyBack bool, wowReference string)

FillJefferiesVWAPParams .

func FillMinImpactParams

func FillMinImpactParams(baseOrder *Order, maxPctVol float64)

FillMinImpactParams .

func FillPctVolParams

func FillPctVolParams(baseOrder *Order, pctVol float64, startTime, endTime string, noTakeLiq bool)

FillPctVolParams .

func FillPriceVariantPctVolParams

func FillPriceVariantPctVolParams(baseOrder *Order, pctVol, deltaPctVol, minPctVol4Px, maxPctVol4Px float64, startTime string, endTime string, noTakeLiq bool)

FillPriceVariantPctVolParams .

func FillSizeVariantPctVolParams

func FillSizeVariantPctVolParams(baseOrder *Order, startPctVol, endPctVol float64, startTime, endTime string, noTakeLiq bool)

FillSizeVariantPctVolParams .

func FillTimeVariantPctVolParams

func FillTimeVariantPctVolParams(baseOrder *Order, startPctVol, endPctVol float64, startTime, endTime string, noTakeLiq bool)

FillTimeVariantPctVolParams .

func FillTwapParams

func FillTwapParams(baseOrder *Order, strategyType string, startTime, endTime string, allowPastEndTime bool)

FillTwapParams .

func FillVwapParams

func FillVwapParams(baseOrder *Order, maxPctVol float64, startTime, endTime string, allowPastEndTime, noTakeLiq, speedUp bool)

FillVwapParams .

func FloatMaxString

func FloatMaxString(val float64) string

func GetAllTags

func GetAllTags() string

func GetTimeStrFromMillis

func GetTimeStrFromMillis(timestamp int64) string

GetTimeStrFromMillis converts a timestamp in milliseconds to a formatted string. Returns an empty string if the input time is less than or equal to zero.

func IntMaxString

func IntMaxString(val int64) string

func IsPrice

func IsPrice(tickType TickType) bool

func Logger

func Logger() *zerolog.Logger

Logger returns the logger.

func LongMaxString

func LongMaxString(val int64) string

func OneCancelsAll

func OneCancelsAll(ocaGroup string, ocaOrder *Order, ocaType int64)

One-Cancels All (OCA) order type allows an investor to place multiple and possibly unrelated orders assigned to a group. The aim is to complete just one of the orders, which in turn will cause TWS to cancel the remaining orders. The investor may submit several orders aimed at taking advantage of the most desirable price within the group. Completion of one piece of the group order causes cancellation of the remaining group orders while partial completion causes the group to rebalance. An investor might desire to sell 1000 shares of only ONE of three positions held above prevailing market prices. The OCA order group allows the investor to enter prices at specified target levels and if one is completed, the other two will automatically cancel. Alternatively, an investor may wish to take a LONG position in eMini S&P stock index futures in a falling market or else SELL US treasury futures at a more favorable price. Grouping the two orders using an OCA order type offers the investor two chance to enter a similar position, while only running the risk of taking on a single position. Products: BOND, CASH, FUT, FOP, STK, OPT, WAR.

func SetConsoleWriter

func SetConsoleWriter()

SetConsoleWriter will send pretty log to the console.

func SetLogLevel

func SetLogLevel(logLevel int)

SetLogLevel sets the loggging level.

func TickName

func TickName(t TickType) string

Types

type Account

type Account struct {
	XMLName xml.Name `xml:"Account"`
	ID      string   `xml:"acct"`
	Amount  string   `xml:"amount,omitempty"`
}

Account .

type AccountSummaryTags

type AccountSummaryTags = string

AccountSummaryTags .

const (
	AccountType                 AccountSummaryTags = "AccountType"
	NetLiquidation              AccountSummaryTags = "NetLiquidation"
	TotalCashValue              AccountSummaryTags = "TotalCashValue"
	SettledCash                 AccountSummaryTags = "SettledCash"
	AccruedCash                 AccountSummaryTags = "AccruedCash"
	BuyingPower                 AccountSummaryTags = "BuyingPower"
	EquityWithLoanValue         AccountSummaryTags = "EquityWithLoanValue"
	PreviousEquityWithLoanValue AccountSummaryTags = "PreviousEquityWithLoanValue"
	GrossPositionValue          AccountSummaryTags = "GrossPositionValue"
	ReqTEquity                  AccountSummaryTags = "ReqTEquity"
	ReqTMargin                  AccountSummaryTags = "ReqTMargin"
	SMA                         AccountSummaryTags = "SMA"
	InitMarginReq               AccountSummaryTags = "InitMarginReq"
	MaintMarginReq              AccountSummaryTags = "MaintMarginReq"
	AvailableFunds              AccountSummaryTags = "AvailableFunds"
	ExcessLiquidity             AccountSummaryTags = "ExcessLiquidity"
	Cushion                     AccountSummaryTags = "Cushion"
	FullInitMarginReq           AccountSummaryTags = "FullInitMarginReq"
	FullMaintMarginReq          AccountSummaryTags = "FullMaintMarginReq"
	FullAvailableFunds          AccountSummaryTags = "FullAvailableFunds"
	FullExcessLiquidity         AccountSummaryTags = "FullExcessLiquidity"
	LookAheadNextChange         AccountSummaryTags = "LookAheadNextChange"
	LookAheadInitMarginReq      AccountSummaryTags = "LookAheadInitMarginReq"
	LookAheadMaintMarginReq     AccountSummaryTags = "LookAheadMaintMarginReq"
	LookAheadAvailableFunds     AccountSummaryTags = "LookAheadAvailableFunds"
	LookAheadExcessLiquidity    AccountSummaryTags = "LookAheadExcessLiquidity"
	HighestSeverity             AccountSummaryTags = "HighestSeverity"
	DayTradesRemaining          AccountSummaryTags = "DayTradesRemaining"
	Leverage                    AccountSummaryTags = "Leverage"
)

type AuctionStrategy

type AuctionStrategy = int64
const (
	AUCTION_UNSET       AuctionStrategy = 0
	AUCTION_MATCH       AuctionStrategy = 1
	AUCTION_IMPROVEMENT AuctionStrategy = 2
	AUCTION_TRANSPARENT AuctionStrategy = 3
)

type Bar

type Bar struct {
	Date     string
	Open     float64
	High     float64
	Low      float64
	Close    float64
	Volume   Decimal
	Wap      Decimal
	BarCount int64
}

Bar .

func NewBar

func NewBar() Bar

func (Bar) String

func (b Bar) String() string

type CodeMsgPair

type CodeMsgPair struct {
	Code int64
	Msg  string
}

CodeMsgPair is IB internal errors.

func (CodeMsgPair) Equal

func (cmp CodeMsgPair) Equal(other CodeMsgPair) bool

func (CodeMsgPair) Error

func (cmp CodeMsgPair) Error() string

type ComboLeg

type ComboLeg struct {
	ConID     int64
	Ratio     int64
	Action    string // BUY/SELL/SSHORT
	Exchange  string
	OpenClose int64
	// for stock legs when doing short sale
	ShortSaleSlot      int64 // 1 = clearing broker, 2 = third party
	DesignatedLocation string
	ExemptCode         int64
}

ComboLeg .

func NewComboLeg

func NewComboLeg() ComboLeg

NewComboLeg creates a default ComboLeg.

func (ComboLeg) String

func (c ComboLeg) String() string

type CommissionReport

type CommissionReport struct {
	ExecID              string
	Commission          float64
	Currency            string
	RealizedPNL         float64
	Yield               float64
	YieldRedemptionDate int64 // YYYYMMDD format
}

CommissionReport .

func NewCommissionReport

func NewCommissionReport() CommissionReport

func (CommissionReport) String

func (cr CommissionReport) String() string

type ConnState

type ConnState int
const (
	DISCONNECTED ConnState = iota
	CONNECTING
	CONNECTED
	REDIRECT
)

func (ConnState) String

func (cs ConnState) String() string

type Connection

type Connection struct {
	*net.TCPConn
	// contains filtered or unexported fields
}

Connection is a TCPConn wrapper.

func (*Connection) IsConnected

func (c *Connection) IsConnected() bool

func (*Connection) Read

func (c *Connection) Read(bs []byte) (int, error)

func (*Connection) Write

func (c *Connection) Write(bs []byte) (int, error)

type Contract

type Contract struct {
	ConID                        int64
	Symbol                       string
	SecType                      string
	LastTradeDateOrContractMonth string
	LastTradeDate                string
	Strike                       float64 // float64 !!
	Right                        string
	Multiplier                   string
	Exchange                     string
	PrimaryExchange              string // pick an actual (ie non-aggregate) exchange that the contract trades on.  DO NOT SET TO SMART.
	Currency                     string
	LocalSymbol                  string
	TradingClass                 string
	IncludeExpired               bool
	SecIDType                    string // CUSIP;SEDOL;ISIN;RIC
	SecID                        string
	Description                  string
	IssuerID                     string

	// combo legs
	ComboLegsDescrip string // received in open order 14 and up for all combos
	ComboLegs        []ComboLeg

	// delta neutral contract
	DeltaNeutralContract *DeltaNeutralContract
}

Contract describes an instrument's definition.

func BTbroadtapeNewsFeed

func BTbroadtapeNewsFeed() *Contract

BTbroadtapeNewsFeed .

func BZbroadtapeNewsFeed

func BZbroadtapeNewsFeed() *Contract

BZbroadtapeNewsFeed .

func Bond

func Bond() *Contract

Bond .

func BondWithCusip

func BondWithCusip() *Contract

BondWithCusip .

func ByConId

func ByConId() *Contract

ByConId . It is also possible to define contracts based on their ConID (EUR.USD sample). Note: passing a contract containing the conId can cause problems if one of the other provided attributes does not match 100% with what is in IB's database. This is particularly important for contracts such as Bonds which may change their description from one day to another. If the conId is provided, it is best not to give too much information as in the example below.

func ByFIGI

func ByFIGI() *Contract

ByFIGI .

func ByISIN

func ByISIN() *Contract

ByISIN . It is also possible to define contracts based on their ISIN (IBKR STK sample).

func ByIssuerId

func ByIssuerId() *Contract

ByIssuerId .

func CFD

func CFD() *Contract

CFD .

func CSFBContract

func CSFBContract() *Contract

CSFBContract .

func CashCFD

func CashCFD() *Contract

CashCFD .

func Commodity

func Commodity() *Contract

Commodity

func ContAndExpiringFut

func ContAndExpiringFut() *Contract

ContAndExpiringFut .

func ContFut

func ContFut() *Contract

ContFut .

func CryptoContract

func CryptoContract() *Contract

CryptoContract .

func DutchWarrant

func DutchWarrant() *Contract

DutchWarrant . Dutch Warrants (IOPTs) can be defined using the local symbol or conid

func ETF

func ETF() *Contract

ETF .

func EurGbpFx

func EurGbpFx() *Contract

EurGbpFx .

func EuropeanStock

func EuropeanStock() *Contract

EuropeanStock .

func EuropeanStockCFD

func EuropeanStockCFD() *Contract

EuropeanStockCFD .

func FLYbroadtapeNewsFeed

func FLYbroadtapeNewsFeed() *Contract

FLYbroadtapeNewsFeed .

func Fund

func Fund() *Contract

Fund .

func FutureComboContract

func FutureComboContract() *Contract

FutureComboContract . CBOE Volatility Index Future combo contract Leg 1: 195538625 - FUT expiring 2016/02/17 Leg 2: 197436571 - FUT expiring 2016/03/16

func FutureWithLocalSymbol

func FutureWithLocalSymbol() *Contract

FutureWithLocalSymbol . Rather than giving expiration dates we can also provide the local symbol attributes such as symbol, currency, strike, etc.

func FutureWithMultiplier

func FutureWithMultiplier() *Contract

FutureWithMultiplier .

func FuturesOnOptions

func FuturesOnOptions() *Contract

FuturesOnOptions .

func HKStk

func HKStk() *Contract

HKStk

func IBKRATSContract

func IBKRATSContract() *Contract

IBKRATSContract .

func IBKRStk

func IBKRStk() *Contract

IBKRStk .

func IBMBond

func IBMBond() *Contract

IBMBond .

func IBMUSStockAtSmart

func IBMUSStockAtSmart() *Contract

IBMUSStockAtSmart .

func Index

func Index() *Contract

Index .

func InterCmdtyFuturesContract

func InterCmdtyFuturesContract() *Contract

InterCmdtyFuturesContract .

func JefferiesContract

func JefferiesContract() *Contract

JefferiesContract .

func MutualFund

func MutualFund() *Contract

MutualFund .

func NewContract

func NewContract() *Contract

func NewsFeedForQuery

func NewsFeedForQuery() *Contract

NewsFeedForQuery .

func OptionAtBox

func OptionAtBox() *Contract

OptionAtBox

func OptionAtIse

func OptionAtIse() *Contract

OptionAtIse .

func OptionComboContract

func OptionComboContract() *Contract

OptionComboContract .

func OptionForQuery

func OptionForQuery() *Contract

OptionForQuery . Ambiguous contracts are great to use with reqContractDetails. This way you can query the whole option chain for an underlying. Bear in mind that there are pacing mechanisms in place which will delay any further responses from the TWS to prevent abuse.

func OptionWithLocalSymbol

func OptionWithLocalSymbol() *Contract

OptionWithLocalSymbol . Using the contract's own symbol (localSymbol) can greatly simplify a contract description

func OptionWithTradingClass

func OptionWithTradingClass() *Contract

OptionWithTradingClass . Option contracts require far more information since there are many contracts having the exact same attributes such as symbol, currency, strike, etc.

func SimpleFuture

func SimpleFuture() *Contract

SimpleFuture . Future contracts also require an expiration date but are less complicated than options.

func SmartFutureComboContract

func SmartFutureComboContract() *Contract

SmartFutureComboContract .

func StockComboContract

func StockComboContract() *Contract

StockComboContract . STK Combo contract Leg 1: 43645865 - IBKR's STK Leg 2: 9408 - McDonald's STK

func StockWithIPOPrice

func StockWithIPOPrice() *Contract

StockWithIPOPrice .

func USOptionContract

func USOptionContract() *Contract

USOptionContract .

func USStock

func USStock() *Contract

USStock .

func USStockAtSmart

func USStockAtSmart() *Contract

USStockAtSmart .

func USStockCFD

func USStockCFD() *Contract

USStockCFD .

func USStockWithPrimaryExch

func USStockWithPrimaryExch() *Contract

USStockWithPrimaryExch .

func Warrants

func Warrants() *Contract

Warrants .

func WrongContract

func WrongContract() *Contract

WrongContract . Note the space in the symbol!

func (*Contract) Equal

func (c *Contract) Equal(other *Contract) bool

func (Contract) String

func (c Contract) String() string

type ContractCondition

type ContractCondition struct {
	*OperatorCondition
	ConID    int64
	Exchange string
}

func (ContractCondition) String

func (oc ContractCondition) String() string

func (ContractCondition) Type

func (oc ContractCondition) Type() OrderConditionType

type ContractDescription

type ContractDescription struct {
	Contract           Contract
	DerivativeSecTypes []string
}

ContractDescription includes contract and DerivativeSecTypes.

func NewContractDescription

func NewContractDescription() ContractDescription

type ContractDetails

type ContractDetails struct {
	Contract               Contract
	MarketName             string
	MinTick                float64
	OrderTypes             string
	ValidExchanges         string
	PriceMagnifier         int64
	UnderConID             int64
	LongName               string
	ContractMonth          string
	Industry               string
	Category               string
	Subcategory            string
	TimeZoneID             string
	TradingHours           string
	LiquidHours            string
	EVRule                 string
	EVMultiplier           int64
	AggGroup               int64
	UnderSymbol            string
	UnderSecType           string
	MarketRuleIDs          string
	RealExpirationDate     string
	LastTradeTime          string
	StockType              string
	MinSize                Decimal
	SizeIncrement          Decimal
	SuggestedSizeIncrement Decimal

	SecIDList []TagValue

	// BOND values
	Cusip             string
	Ratings           string
	DescAppend        string
	BondType          string
	CouponType        string
	Callable          bool
	Putable           bool
	Coupon            float64
	Convertible       bool
	Maturity          string
	IssueDate         string
	NextOptionDate    string
	NextOptionType    string
	NextOptionPartial bool
	Notes             string

	// FUND values
	FundName                        string
	FundFamily                      string
	FundType                        string
	FundFrontLoad                   string
	FundBackLoad                    string
	FundBackLoadTimeInterval        string
	FundManagementFee               string
	FundClosed                      bool
	FundClosedForNewInvestors       bool
	FundClosedForNewMoney           bool
	FundNotifyAmount                string
	FundMinimumInitialPurchase      string
	FundSubsequentMinimumPurchase   string
	FundBlueSkyStates               string
	FundBlueSkyTerritories          string
	FundDistributionPolicyIndicator FundDistributionPolicyIndicator
	FundAssetType                   FundAssetType
	IneligibilityReasonList         []IneligibilityReason
}

ContractDetails .

func NewContractDetails

func NewContractDetails() *ContractDetails

func (ContractDetails) String

func (c ContractDetails) String() string

type Decimal

type Decimal fixed.Fixed

Decimal implements Fixed from "github.com/robaho/fixed".

func StringToDecimal

func StringToDecimal(s string) Decimal

func StringToDecimalErr

func StringToDecimalErr(s string) (Decimal, error)

func (Decimal) Float

func (d Decimal) Float() float64

func (Decimal) Int

func (d Decimal) Int() int64

func (Decimal) MarshalBinary

func (d Decimal) MarshalBinary() ([]byte, error)

func (Decimal) String

func (d Decimal) String() string

func (*Decimal) UnmarshalBinary

func (d *Decimal) UnmarshalBinary(data []byte) error

type DeltaNeutralContract

type DeltaNeutralContract struct {
	ConID int64
	Delta float64
	Price float64
}

DeltaNeutralContract .

func NewDeltaNeutralContract

func NewDeltaNeutralContract() DeltaNeutralContract

func (DeltaNeutralContract) String

func (c DeltaNeutralContract) String() string

type DepthMktDataDescription

type DepthMktDataDescription struct {
	Exchange        string
	SecType         string
	ListingExch     string
	ServiceDataType string
	AggGroup        int64
}

DepthMktDataDescription .

func NewDepthMktDataDescription

func NewDepthMktDataDescription() DepthMktDataDescription

func (DepthMktDataDescription) String

func (d DepthMktDataDescription) String() string

DepthMktDataDescription .

type EClient

type EClient struct {
	Ctx    context.Context
	Cancel context.CancelFunc
	// contains filtered or unexported fields
}

EClient is the main struct to use from API user's point of view.

func NewEClient

func NewEClient(wrapper EWrapper) *EClient

NewEClient returns a new Eclient.

func (*EClient) CalculateImpliedVolatility

func (c *EClient) CalculateImpliedVolatility(reqID int64, contract *Contract, optionPrice float64, underPrice float64, impVolOptions []TagValue)

CalculateImpliedVolatility calculates the implied volatility of the option. Result will be delivered via wrapper.TickOptionComputation().

func (*EClient) CalculateOptionPrice

func (c *EClient) CalculateOptionPrice(reqID int64, contract *Contract, volatility float64, underPrice float64, optPrcOptions []TagValue)

CalculateOptionPrice calculate the price of the option Call this function to calculate price for a supplied option volatility and underlying price. Result will be delivered via wrapper.TickOptionComputation().

func (*EClient) CancelAccountSummary

func (c *EClient) CancelAccountSummary(reqID int64)

CancelAccountSummary cancels the request for Account Window Summary tab data. reqId is the ID of the data request being canceled.

func (*EClient) CancelAccountUpdatesMulti

func (c *EClient) CancelAccountUpdatesMulti(reqID int64)

CancelAccountUpdatesMulti cancels account update for reqID.

func (*EClient) CancelCalculateImpliedVolatility

func (c *EClient) CancelCalculateImpliedVolatility(reqID int64)

CancelCalculateImpliedVolatility cancels a request to calculate volatility for a supplied option price and underlying price.

func (*EClient) CancelCalculateOptionPrice

func (c *EClient) CancelCalculateOptionPrice(reqID int64)

CancelCalculateOptionPrice cancels the calculation of option price.

func (*EClient) CancelFundamentalData

func (c *EClient) CancelFundamentalData(reqID int64)

CancelFundamentalData cancels fundamental data.

func (*EClient) CancelHeadTimeStamp

func (c *EClient) CancelHeadTimeStamp(reqID int64)

CancelHeadTimeStamp cancels the head timestamp data.

func (*EClient) CancelHistogramData

func (c *EClient) CancelHistogramData(reqID int64)

CancelHistogramData cancels histogram data.

func (*EClient) CancelHistoricalData

func (c *EClient) CancelHistoricalData(reqID int64)

CancelHistoricalData cancels the update of historical data. Used if an internet disconnect has occurred or the results of a query are otherwise delayed and the application is no longer interested in receiving the data. reqId, the ticker ID, must be a unique value.

func (*EClient) CancelMktData

func (c *EClient) CancelMktData(reqID TickerID)

CancelMktData stops the market data flow for the specified TickerId.

func (*EClient) CancelMktDepth

func (c *EClient) CancelMktDepth(reqID int64, isSmartDepth bool)

CancelMktDepth cancels market depth updates.

func (*EClient) CancelNewsBulletins

func (c *EClient) CancelNewsBulletins()

CancelNewsBulletins cancels the news bulletins updates

func (*EClient) CancelOrder

func (c *EClient) CancelOrder(orderID OrderID, orderCancel OrderCancel)

CancelOrder cancel an order by orderId. It can only be used to cancel an order that was placed originally by a client with the same client ID

func (*EClient) CancelPnL

func (c *EClient) CancelPnL(reqID int64)

CancelPnL cancels the PnL update of assigned account.

func (*EClient) CancelPnLSingle

func (c *EClient) CancelPnLSingle(reqID int64)

CancelPnLSingle cancel the single contract PnL update of assigned account.

func (*EClient) CancelPositions

func (c *EClient) CancelPositions()

CancelPositions cancels real-time position updates.

func (*EClient) CancelPositionsMulti

func (c *EClient) CancelPositionsMulti(reqID int64)

CancelPositionsMulti cancels the positions update of assigned account.

func (*EClient) CancelRealTimeBars

func (c *EClient) CancelRealTimeBars(reqID int64)

CancelRealTimeBars cancels realtime bars.

func (*EClient) CancelScannerSubscription

func (c *EClient) CancelScannerSubscription(reqID int64)

CancelScannerSubscription cancel scanner. reqId is the unique ticker ID used for subscription.

func (*EClient) CancelTickByTickData

func (c *EClient) CancelTickByTickData(reqID int64)

CancelTickByTickData cancel the tick-by-tick data

func (*EClient) CancelWshEventData

func (c *EClient) CancelWshEventData(reqID int64)

CancelWshEventData cancels WSHE Event data.

func (*EClient) CancelWshMetaData

func (c *EClient) CancelWshMetaData(reqID int64)

CancelWshMetaData cancels WSHE Meta data.

func (*EClient) Connect

func (c *EClient) Connect(host string, port int, clientID int64) error

Connect must be called before any other. There is no feedback for a successful connection, but a subsequent attempt to connect will return the message "Already connected.".

func (*EClient) Disconnect

func (c *EClient) Disconnect() error

Disconnect terminates the connections with TWS. Calling this function does not cancel orders that have already been sent.

func (*EClient) ExerciseOptions

func (c *EClient) ExerciseOptions(reqID TickerID, contract *Contract, exerciseAction int, exerciseQuantity int, account string, override int, manualOrderTime string, customerAccount string, professionalCustomer bool)

ExerciseOptions exercises the option defined by the contract. reqId is the ticker id and must be a unique value. contract contains a description of the contract to be exercised. exerciseAction specifies whether you want the option to lapse or be exercised.

Values: 1 = exercise, 2 = lapse.

exerciseQuantity is the quantity you want to exercise. account is the destination account. override specifies whether your setting will override the system's natural action. For example, if your action is "exercise" and the option is not in-the-money, by natural action the option would not exercise. If you have override set to "yes" the natural action would be overridden and the out-of-the money option would be exercised. Values: 0 = no, 1 = yes. manualOrderTime isthe manual order time. customerAccount is the customer account. professionalCustomer:bool - professional customer.

func (*EClient) IsConnected

func (c *EClient) IsConnected() bool

IsConnected checks connection to TWS or GateWay.

func (*EClient) PlaceOrder

func (c *EClient) PlaceOrder(orderID OrderID, contract *Contract, order *Order)

PlaceOrder places an order. The order status will be returned by the orderStatus event. The order id must specify a unique value. When the order status returns, it will be identified by this tag. This tag is also used when canceling the order. contract contains a description of the contract which is being traded. order contains the details of the traded order.

func (*EClient) QueryDisplayGroups

func (c *EClient) QueryDisplayGroups(reqID int64)

QueryDisplayGroups request the display groups in TWS.

func (*EClient) ReplaceFA

func (c *EClient) ReplaceFA(reqID int64, faDataType FaDataType, cxml string)

ReplaceFA replaces the FA configuration information from the API. Note that this can also be done manually in TWS itself. faData specifies the type of Financial Advisor configuration data being requested. 1 = GROUPS 3 = ACCOUNT ALIASES cxml is the XML string containing the new FA configuration information.

func (*EClient) ReqAccountSummary

func (c *EClient) ReqAccountSummary(reqID int64, groupName string, tags string)

ReqAccountSummary request and keep up to date the data that appears. on the TWS Account Window Summary tab. The data is returned by accountSummary(). This request is designed for an FA managed account but can be used for any multi-account structure. reqId is the ID of the data request. it Ensures that responses are matched to requests If several requests are in process. groupName sets to All to return account summary data for all accounts, or set to a specific Advisor Account Group name that has already been created in TWS Global Configuration. tags:str - A comma-separated list of account tags. Available tags are:

accountountType
NetLiquidation,
TotalCashValue - Total cash including futures pnl
SettledCash - For cash accounts, this is the same as
TotalCashValue
AccruedCash - Net accrued interest
BuyingPower - The maximum dollar value of securities that you can buy without depositing additional equity
EquityWithLoanValue - Cash + stocks + bonds + mutual funds
PreviousDayEquityWithLoanValue,
GrossPositionValue - The sum of the absolute value of all stock and equity option positions
RegTEquity,
RegTMargin,
SMA - Special Memorandum Account
InitMarginReq,
MaintMarginReq,
AvailableFunds,
ExcessLiquidity,
Cushion - Excess liquidity as a percentage of net liquidation value
FullInitMarginReq,
FullMaintMarginReq,
FullAvailableFunds,
FullExcessLiquidity,
LookAheadNextChange - Time when look-ahead values take effect
LookAheadInitMarginReq,
LookAheadMaintMarginReq,
LookAheadAvailableFunds,
LookAheadExcessLiquidity,
HighestSeverity - A measure of how close the account is to liquidation.
DayTradesRemaining - The Number of Open/Close trades a user could put on before Pattern Day Trading is detected.
	A value of "-1"	means that the user can put on unlimited day trades.
Leverage - GrossPositionValue / NetLiquidation
$LEDGER - Single flag to relay all cash balance tags*, only in base	currency.
$LEDGER:CURRENCY - Single flag to relay all cash balance tags*, only in	the specified currency.
$LEDGER:ALL - Single flag to relay all cash balance tags* in all currencies.

func (*EClient) ReqAccountUpdates

func (c *EClient) ReqAccountUpdates(subscribe bool, accountName string)

ReqAccountUpdates will start getting account values, portfolio, and last update time information. it is returned via EWrapper.updateAccountValue(), EWrapperi.updatePortfolio() and Wrapper.updateAccountTime().

func (*EClient) ReqAccountUpdatesMulti

func (c *EClient) ReqAccountUpdatesMulti(reqID int64, account string, modelCode string, ledgerAndNLV bool)

ReqAccountUpdatesMulti requests account updates for account and/or model.

func (*EClient) ReqAllOpenOrders

func (c *EClient) ReqAllOpenOrders()

ReqAllOpenOrders request the open orders placed from all clients and also from TWS. Each open order will be fed back through the openOrder() and orderStatus() functions on the EWrapper. No association is made between the returned orders and the requesting client.

func (*EClient) ReqAutoOpenOrders

func (c *EClient) ReqAutoOpenOrders(autoBind bool)

ReqAutoOpenOrders requests that newly created TWS orders be implicitly associated with the client. When a new TWS order is created, the order will be associated with the client, and fed back through the openOrder() and orderStatus() functions on the EWrapper. This request can only be made from a client with clientId of 0. if autoBind is set to TRUE, newly created TWS orders will be implicitly associated with the client. If set to FALSE, no association will be made.

func (*EClient) ReqCompletedOrders

func (c *EClient) ReqCompletedOrders(apiOnly bool)

ReqCompletedOrders request the completed orders. If apiOnly parameter is true, then only completed orders placed from API are requested. Result will be delivered via wrapper.CompletedOrder().

func (*EClient) ReqContractDetails

func (c *EClient) ReqContractDetails(reqID int64, contract *Contract)

ReqContractDetails downloads all details for a particular underlying. The contract details will be received via the contractDetails() function on the EWrapper.

func (*EClient) ReqCurrentTime

func (c *EClient) ReqCurrentTime()

ReqCurrentTime asks the current system time on the server side.

func (*EClient) ReqExecutions

func (c *EClient) ReqExecutions(reqID int64, execFilter ExecutionFilter)

ReqExecutions downloads the execution reports that meet the filter criteria to the client via the execDetails() function. To view executions beyond the past 24 hours, open the Trade Log in TWS and, while the Trade Log is displayed, request the executions again from the API. reqId is the ID of the data request. Ensures that responses are matched to requests if several requests are in process. execFilter contains attributes that describe the filter criteria used to determine which execution reports are returned. NOTE: Time format must be 'yyyymmdd-hh:mm:ss' Eg: '20030702-14:55'

func (*EClient) ReqFamilyCodes

func (c *EClient) ReqFamilyCodes()

ReqFamilyCodes requests family codes.

func (*EClient) ReqFundamentalData

func (c *EClient) ReqFundamentalData(reqID int64, contract *Contract, reportType string, fundamentalDataOptions []TagValue)

ReqFundamentalData requests fundamental data for stocks. The appropriate market data subscription must be set up in Account Management before you can receive this data. Result will be delivered via wrapper.FundamentalData(). this func can handle conid specified in the Contract object, but not tradingClass or multiplier. This is because this func is used only for stocks and stocks do not have a multiplier and trading class. reqId is the ID of the data request. Ensures that responses are matched to requests if several requests are in process. contract contains a description of the contract for which fundamental data is being requested. reportType is one of the following XML reports:

ReportSnapshot (company overview)
ReportsFinSummary (financial summary)
ReportRatios (financial ratios)
ReportsFinStatements (financial statements)
RESC (analyst estimates)
CalendarReport (company calendar)

func (*EClient) ReqGlobalCancel

func (c *EClient) ReqGlobalCancel(orderCancel OrderCancel)

ReqGlobalCancel cancels all open orders globally. It cancels both API and TWS open orders.

func (*EClient) ReqHeadTimeStamp

func (c *EClient) ReqHeadTimeStamp(reqID int64, contract *Contract, whatToShow string, useRTH bool, formatDate int)

ReqHeadTimeStamp request the head timestamp of assigned contract. call this func to get the headmost data you can get

func (*EClient) ReqHistogramData

func (c *EClient) ReqHistogramData(reqID int64, contract *Contract, useRTH bool, timePeriod string)

ReqHistogramData requests histogram data.

func (*EClient) ReqHistoricalData

func (c *EClient) ReqHistoricalData(reqID int64, contract *Contract, endDateTime string, duration string, barSize string, whatToShow string, useRTH bool, formatDate int, keepUpToDate bool, chartOptions []TagValue)

func (*EClient) ReqHistoricalNews

func (c *EClient) ReqHistoricalNews(reqID int64, contractID int64, providerCode string, startDateTime string, endDateTime string, totalResults int64, historicalNewsOptions []TagValue)

ReqHistoricalNews request historical news.

func (*EClient) ReqHistoricalTicks

func (c *EClient) ReqHistoricalTicks(reqID int64, contract *Contract, startDateTime string, endDateTime string, numberOfTicks int, whatToShow string, useRTH bool, ignoreSize bool, miscOptions []TagValue)

ReqHistoricalTicks requests historical ticks.

func (*EClient) ReqIDs

func (c *EClient) ReqIDs(numIds int64)

ReqIDs request from TWS the next valid ID that can be used when placing an order. After calling this function, the nextValidId() event will be triggered, and the id returned is that next valid ID. That ID will reflect any autobinding that has occurred (which generates new IDs and increments the next valid ID therein). numIds is depreceted

func (*EClient) ReqManagedAccts

func (c *EClient) ReqManagedAccts()

ReqManagedAccts requests the list of managed accounts. The result will be delivered via wrapper.ManagedAccounts(). This request can only be made when connected to a FA managed account.

func (*EClient) ReqMarketDataType

func (c *EClient) ReqMarketDataType(marketDataType int64)

ReqMarketDataType changes the market data type.

The API can receive frozen market data from Trader Workstation. Frozen market data is the last data recorded in our system. During normal trading hours, the API receives real-time market data. If you use this function, you are telling TWS to automatically switch to frozen market data after the close. Then, before the opening of the next trading day, market data will automatically switch back to real-time market data. marketDataType:

1 -> realtime streaming market data
2 -> frozen market data
3 -> delayed market data
4 -> delayed frozen market data

func (*EClient) ReqMarketRule

func (c *EClient) ReqMarketRule(marketRuleID int64)

ReqMarketRule requests the market rule.

func (*EClient) ReqMatchingSymbols

func (c *EClient) ReqMatchingSymbols(reqID int64, pattern string)

ReqMatchingSymbols requests matching symbols.

func (*EClient) ReqMktData

func (c *EClient) ReqMktData(reqID TickerID, contract *Contract, genericTickList string, snapshot bool, regulatorySnapshot bool, mktDataOptions []TagValue)

ReqMktData Call this function to request market data. The market data will be returned by the tickPrice and tickSize events. reqID, the ticker id must be a unique value. When the market data returns it will be identified by this tag. This is also used when canceling the market data. contract contains a description of the Contract for which market data is being requested. genericTickList is a commma delimited list of generic tick types. Tick types can be found in the Generic Tick Types page. Prefixing w/ 'mdoff' indicates that top mkt data shouldn't tick. You can specify the news source by postfixing w/ ':<source>. Example: "mdoff,292:FLY+BRF" snapshot checks to return a single snapshot of Market data and have the market data subscription cancel. Do not enter any genericTicklist values if you use snapshots. regulatorySnapshot: With the US Value Snapshot Bundle for stocks, regulatory snapshots are available for 0.01 USD each. mktDataOptions is for internal use only.Use default value XYZ.

func (*EClient) ReqMktDepth

func (c *EClient) ReqMktDepth(reqID int64, contract *Contract, numRows int, isSmartDepth bool, mktDepthOptions []TagValue)

ReqMktDepth requests the market depth for a specific contract. The market depth will be returned by the updateMktDepth() and updateMktDepthL2() events. Requests the contract's market depth (order book). Note this request must be direct-routed to an exchange and not smart-routed. The number of simultaneous market depth requests allowed in an account is calculated based on a formula that looks at an accounts equity, commissions, and quote booster packs. reqId is the ticker id. It must be a unique value. When the market depth data returns, it will be identified by this tag. This is also used when canceling the market depth contract contains a description of the contract for which market depth data is being requested. numRows specifies the numRowsumber of market depth rows to display. isSmartDepth specifies SMART depth request. mktDepthOptions is for internal use only. Use default value XYZ.

func (*EClient) ReqMktDepthExchanges

func (c *EClient) ReqMktDepthExchanges()

ReqMktDepthExchanges requests market depth exchanges.

func (*EClient) ReqNewsArticle

func (c *EClient) ReqNewsArticle(reqID int64, providerCode string, articleID string, newsArticleOptions []TagValue)

ReqNewsArticle request news article.

func (*EClient) ReqNewsBulletins

func (c *EClient) ReqNewsBulletins(allMsgs bool)

ReqNewsBulletins requests and subcribe the news bulletins. Each bulletin will be returned by the updateNewsBulletin() event.

If allMsgs sets to TRUE, returns all the existing bulletins for the currencyent day and any new ones. If allMsgs sets to FALSE, will only return new bulletins.

func (*EClient) ReqNewsProviders

func (c *EClient) ReqNewsProviders()

ReqNewsProviders request news providers.

func (*EClient) ReqOpenOrders

func (c *EClient) ReqOpenOrders()

ReqOpenOrders requests the open orders that were placed from this client. Each open order will be fed back through the openOrder() and orderStatus() functions on the EWrapper. The client with a clientId of 0 will also receive the TWS-owned open orders. These orders will be associated with the client and a new orderId will be generated. This association will persist over multiple API and TWS sessions.

func (*EClient) ReqPnL

func (c *EClient) ReqPnL(reqID int64, account string, modelCode string)

ReqPnL requests and subscribe the PnL of assigned account.

func (*EClient) ReqPnLSingle

func (c *EClient) ReqPnLSingle(reqID int64, account string, modelCode string, contractID int64)

ReqPnLSingle request and subscribe the single contract PnL of assigned account.

func (*EClient) ReqPositions

func (c *EClient) ReqPositions()

ReqPositions requests real-time position data for all accounts.

func (*EClient) ReqPositionsMulti

func (c *EClient) ReqPositionsMulti(reqID int64, account string, modelCode string)

ReqPositionsMulti requests the positions for account and/or model. Results are delivered via EWrapper.positionMulti() and EWrapper.positionMultiEnd().

func (*EClient) ReqRealTimeBars

func (c *EClient) ReqRealTimeBars(reqID int64, contract *Contract, barSize int, whatToShow string, useRTH bool, realTimeBarsOptions []TagValue)

ReqRealTimeBars requests realtime bars. Result will be delivered via wrapper.RealtimeBar(). reqId, the ticker ID, must be a unique value. When the data is received, it will be identified by this Id. This is also used when canceling the request. contract contains a description of the contract for which real time bars are being requested. barSize, Currently only supports 5 second bars, if any other value is used, an exception will be thrown. whatToShow determines the nature of the data extracted. Valid includes:

TRADES
BID
ASK
MIDPOINT

useRTH sets regular Trading Hours only. Valid values include:

0 = all data available during the time span requested is returned,
	including time intervals when the market in question was
	outside of regular trading hours.
1 = only data within the regular trading hours for the product
	requested is returned, even if the time time span falls
	partially or completely outside.

realTimeBarOptions is for internal use only. Use default value XYZ.

func (*EClient) ReqScannerParameters

func (c *EClient) ReqScannerParameters()

ReqScannerParameters requests an XML string that describes all possible scanner queries.

func (*EClient) ReqScannerSubscription

func (c *EClient) ReqScannerSubscription(reqID int64, subscription *ScannerSubscription, scannerSubscriptionOptions []TagValue, scannerSubscriptionFilterOptions []TagValue)

ReqScannerSubscription subcribes a scanner that matched the subcription. reqId, the ticker ID, must be a unique value. scannerSubscription contains possible parameters used to filter results. scannerSubscriptionOptions is for internal use only.Use default value XYZ.

func (*EClient) ReqSecDefOptParams

func (c *EClient) ReqSecDefOptParams(reqID int64, underlyingSymbol string, futFopExchange string, underlyingSecurityType string, underlyingContractID int64)

ReqSecDefOptParams requests security definition option parameters. reqId the ID chosen for the request underlyingSymbol. futFopExchange is the exchange on which the returned options are trading. Can be set to the empty string "" for all exchanges. underlyingSecType is the type of the underlying security, i.e. STK. underlyingConId is the contract ID of the underlying security. Response comes via wrapper.SecurityDefinitionOptionParameter().

func (*EClient) ReqSmartComponents

func (c *EClient) ReqSmartComponents(reqID int64, bboExchange string)

ReqSmartComponents request the smartComponents.

func (*EClient) ReqSoftDollarTiers

func (c *EClient) ReqSoftDollarTiers(reqID int64)

ReqSoftDollarTiers request pre-defined Soft Dollar Tiers. This is only supported for registered professional advisors and hedge and mutual funds who have configured Soft Dollar Tiers in Account Management.

func (*EClient) ReqTickByTickData

func (c *EClient) ReqTickByTickData(reqID int64, contract *Contract, tickType string, numberOfTicks int64, ignoreSize bool)

ReqTickByTickData request the tick-by-tick data. tickType is "Last", "AllLast", "BidAsk" or "MidPoint". numberOfTicks is the number of ticks or 0 for unlimited. ignoreSize will ignore bid/ask ticks that only update the size if true. Result will be delivered via wrapper.TickByTickAllLast() wrapper.TickByTickBidAsk() wrapper.TickByTickMidPoint().

func (*EClient) ReqUserInfo

func (c *EClient) ReqUserInfo(reqID int64)

ReqUserInfo requests user info.

func (*EClient) ReqWshEventData

func (c *EClient) ReqWshEventData(reqID int64, wshEventData WshEventData)

ReqWshEventData requests WSHE Event data.

func (*EClient) ReqWshMetaData

func (c *EClient) ReqWshMetaData(reqID int64)

ReqWshMetaData requests WSHE Meta data.

func (*EClient) RequestFA

func (c *EClient) RequestFA(faDataType FaDataType)

RequestFA requests fa. The data returns in an XML string via wrapper.ReceiveFA(). faData is 1->"GROUPS", 3->"ALIASES".

func (*EClient) ServerVersion

func (c *EClient) ServerVersion() Version

ServerVersion returns the version of the TWS instance to which the API application is connected.

func (*EClient) SetConnectionOptions

func (c *EClient) SetConnectionOptions(opts string)

SetConnectionOptions setup the Connection Options.

func (*EClient) SetServerLogLevel

func (c *EClient) SetServerLogLevel(logLevel int64)

SetServerLogLevel sets the log level of the server. logLevel can be: 1 = SYSTEM 2 = ERROR (default) 3 = WARNING 4 = INFORMATION 5 = DETAIL

func (*EClient) SubscribeToGroupEvents

func (c *EClient) SubscribeToGroupEvents(reqID int64, groupID int)

SubscribeToGroupEvents subcribes the group events. reqId is the unique number associated with the notification. groupId is the ID of the group, currently it is a number from 1 to 7.

func (*EClient) TWSConnectionTime

func (c *EClient) TWSConnectionTime() string

ConnectionTime is the time the API application made a connection to TWS.

func (*EClient) UnsubscribeFromGroupEvents

func (c *EClient) UnsubscribeFromGroupEvents(reqID int64)

UnsubscribeFromGroupEvents unsubcribes the display group events.

func (*EClient) UpdateDisplayGroup

func (c *EClient) UpdateDisplayGroup(reqID int64, contractInfo string)

UpdateDisplayGroup updates the display group in TWS. reqId is the requestId specified in subscribeToGroupEvents(). contractInfo is the encoded value that uniquely represents the contract in IB. Possible values include:

none = empty selection
contractID@exchange - any non-combination contract.
	Examples: 8314@SMART for IBM SMART; 8314@ARCA for IBM @ARCA.
combo = if any combo is selected.

func (*EClient) VerifyAndAuthMessage

func (c *EClient) VerifyAndAuthMessage(apiData string, xyzResponse string)

VerifyAndAuthMessage is just for IB's internal use. Allows to provide means of verification between the TWS and third party programs.

func (*EClient) VerifyAndAuthRequest

func (c *EClient) VerifyAndAuthRequest(apiName string, apiVersion string, opaqueIsvKey string)

VerifyAndAuthRequest is just for IB's internal use. Allows to provide means of verification between the TWS and third party programs.

func (*EClient) VerifyMessage

func (c *EClient) VerifyMessage(apiData string)

VerifyMessage is just for IB's internal use. Allows to provide means of verification between the TWS and third party programs.

func (*EClient) VerifyRequest

func (c *EClient) VerifyRequest(apiName string, apiVersion string)

VerifyRequest is just for IB's internal use. Allows to provide means of verification between the TWS and third party programs.

type EDecoder

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

EDecoder transforms a message's payload into higher level IB message.

type EWrapper

type EWrapper interface {
	// TickPrice handles all price related ticks. Every tickPrice callback is followed by a tickSize.
	// A tickPrice value of -1 or 0 followed by a tickSize of 0 indicates there is no data for this field currently available, whereas a tickPrice with a positive tickSize indicates an active quote of 0 (typically for a combo contract).
	TickPrice(reqID TickerID, tickType TickType, price float64, attrib TickAttrib)
	// TickSize handles all size related ticks.
	TickSize(reqID TickerID, tickType TickType, size Decimal)
	// TickOptionComputation is called when the market in an option or its underlier moves.
	// TWS's option model volatilities, prices, and deltas, along with the present value of dividends expected on that options underlier are received.
	TickOptionComputation(reqID TickerID, tickType TickType, tickAttrib int64, impliedVol float64, delta float64, optPrice float64, pvDividend float64, gamma float64, vega float64, theta float64, undPrice float64)
	// TickGeneric .
	TickGeneric(reqID TickerID, tickType TickType, value float64)
	// TickString .
	TickString(reqID TickerID, tickType TickType, value string)
	// TickEFP handles market for Exchange for Physical.
	// tickerId is the request's identifier.
	// tickType is the type of tick being received.
	// basisPoints is the annualized basis points, which is representative of the financing rate that can be directly compared to broker rates.
	// formattedBasisPoints is the annualized basis points as a formatted string that depicts them in percentage form.
	// impliedFuture is the implied Futures price.
	// holdDays is the number of hold days until the lastTradeDate of the EFP.
	// futureLastTradeDate is the expiration date of the single stock future.
	// dividendImpact is the dividend impact upon the annualized basis points interest rate.
	// dividendsToLastTradeDate is the dividends expected until the expiration of the single stock future.
	TickEFP(reqID TickerID, tickType TickType, basisPoints float64, formattedBasisPoints string, totalDividends float64, holdDays int64, futureLastTradeDate string, dividendImpact float64, dividendsToLastTradeDate float64)
	// OrderStatus is called whenever the status of an order changes.
	// It is also fired after reconnecting to TWS if the client has any open orders.
	// OrderID is the order ID that was specified previously in the	call to placeOrder().
	// status is the order status. Possible values include:
	//		PendingSubmit - indicates that you have transmitted the order, but have not  yet received confirmation that it has been accepted by the order destination. NOTE: This order status is not sent by TWS and should be explicitly set by the API developer when an order is submitted.
	//		PendingCancel - indicates that you have sent a request to cancel the order but have not yet received cancel confirmation from the order destination. At this point, your order is not confirmed canceled. You may still receive an execution while your cancellation request is pending. NOTE: This order status is not sent by TWS and should be explicitly set by the API developer when an order is canceled.
	//		PreSubmitted - indicates that a simulated order type has been accepted by the IB system and that this order has yet to be elected. The order is held in the IB system until the election criteria are met. At that time the order is transmitted to the order destination as specified.
	//		Submitted - indicates that your order has been accepted at the order destination and is working.
	//		Cancelled - indicates that the balance of your order has been confirmed canceled by the IB system. This could occur unexpectedly when IB or the destination has rejected your order.
	//		Filled - indicates that the order has been completely filled.
	//		Inactive - indicates that the order has been accepted by the system (simulated orders) or an exchange (native orders) but that currently the order is inactive due to system, exchange or other issues.
	// filled specifies the number of shares that have been executed. For more information about partial fills, see Order Status for Partial Fills.
	// remaining specifies the number of shares still outstanding.
	// avgFillPrice is the average price of the shares that have been executed. This parameter is valid only if the filled parameter value is greater than zero. Otherwise, the price parameter will be zero.
	// permId is the TWS id used to identify orders. Remains the same over TWS sessions.
	// parentId is the order ID of the parent order, used for bracket and auto trailing stop orders.
	// lastFilledPrice is the last price of the shares that have been executed. This parameter is valid only if the filled parameter value is greater than zero. Otherwise, the price parameter will be zero.
	// clientId is the ID of the client (or TWS) that placed the order. Note that TWS orders have a fixed clientId and OrderID of 0 that distinguishes them from API orders.
	// whyHeld is the field used to identify an order held when TWS is trying to locate shares for a short sell. The value used to indicate this is 'locate'.
	OrderStatus(orderID OrderID, status string, filled Decimal, remaining Decimal, avgFillPrice float64, permID int64, parentID int64, lastFillPrice float64, clientID int64, whyHeld string, mktCapPrice float64)
	// OpenOrder is called to feed in open orders.
	// orderID: OrderId - The order ID assigned by TWS. Use to cancel or update TWS order.
	// contract: Contract - The Contract class attributes describe the contract.
	// order: Order - The Order class gives the details of the open order.
	// orderState: OrderState - The orderState class includes attributes Used for both pre and post trade margin and commission data.
	OpenOrder(orderID OrderID, contract *Contract, order *Order, orderState *OrderState)
	// OpenOrderEnd is called at the end of a given request for open orders.
	OpenOrderEnd()
	// WinError .
	WinError(text string, lastError int64)
	// ConnectionClosed is called when TWS closes the sockets connection with the ActiveX control, or when TWS is shut down.
	ConnectionClosed()
	// UpdateAccountValue is called only when reqAccountUpdates() has been called.
	UpdateAccountValue(tag string, val string, currency string, accountName string)
	// UpdatePortfolio is called only when reqAccountUpdates() has been called.
	UpdatePortfolio(contract *Contract, position Decimal, marketPrice float64, marketValue float64, averageCost float64, unrealizedPNL float64, realizedPNL float64, accountName string)
	// UpdateAccountTime .
	UpdateAccountTime(timeStamp string)
	// AccountDownloadEnd is called after a batch updateAccountValue() and updatePortfolio() is sent.
	AccountDownloadEnd(accountName string)
	// NextValidID Receives next valid order id. NOT THREAD-SAFE.
	NextValidID(reqID int64)
	// ContractDetails Receives the full contract's definitions. This method will return all contracts matching the requested via reqContractDetails().
	// For example, one can obtain the whole option chain with it.
	ContractDetails(reqID int64, contractDetails *ContractDetails)
	// BondContractDetails is called when reqContractDetails function has been called for bonds.
	BondContractDetails(reqID int64, contractDetails *ContractDetails)
	// ContractDetailsEnd is called once all contract details for a given request are received.
	// This helps to define the end of an option chain.
	ContractDetailsEnd(reqID int64)
	// ExecDetails is called when the reqExecutions() functions is invoked, or when an order is filled.
	ExecDetails(reqID int64, contract *Contract, execution *Execution)
	// ExecDetailsEnd is called once all executions have been sent to a client in response to reqExecutions().
	ExecDetailsEnd(reqID int64)
	// Error is called when there is an error with the communication or when TWS wants to send a message to the client.
	Error(reqID TickerID, errTime int64, errCode int64, errString string, advancedOrderRejectJson string)
	// UpdateMktDepth returns the order book.
	// 	TickerID -  the request's identifier.
	// 	position -  the order book's row being updated.
	// 	operation - how to refresh the row:
	// 		0 = insert (insert this new order into the row identified by 'position').
	// 		1 = update (update the existing order in the row identified by 'position').
	// 		2 = delete (delete the existing order at the row identified by 'position').
	// 	side -  0 for ask, 1 for bid.
	// 	price - the order's price.
	// 	size -  the order's size.
	UpdateMktDepth(TickerID TickerID, position int64, operation int64, side int64, price float64, size Decimal)
	// UpdateMktDepthL2 returns the order book.
	// 	TickerID -  the request's identifier.
	//  position -  the order book's row being updated.
	//  marketMaker - the exchange holding the order.
	//  operation - how to refresh the row:
	//  	0 = insert (insert this new order into the row identified by 'position').
	//      1 = update (update the existing order in the row identified by 'position').
	//      2 = delete (delete the existing order at the row identified by 'position').
	//  side -  0 for ask, 1 for bid.
	//  price - the order's price.
	//  size -  the order's size.
	//  isSmartDepth - is SMART Depth request.
	UpdateMktDepthL2(TickerID TickerID, position int64, marketMaker string, operation int64, side int64, price float64, size Decimal, isSmartDepth bool)
	// UpdateNewsBulletin provides IB's bulletins.
	// 	msgID - the bulletin's identifier.
	// 	msgType - one of: 1 - Regular news bulletin 2 - Exchange no longer available for trading 3 - Exchange is available for trading.
	// 	newsMessage - the message.
	// 	originExch -    the exchange where the message comes from.
	UpdateNewsBulletin(msgID int64, msgType int64, newsMessage string, originExch string)
	// ManagedAccounts Receives a comma-separated string with the managed account ids.
	ManagedAccounts(accountsList []string)
	// ReceiveFA receives the Financial Advisor's configuration available in the TWS
	//  faDataType - one of:
	// 		GROUPS: offer traders a way to create a group of accounts and apply a single allocation method to all accounts in the group.
	// 		ALIASES: let you easily identify the accounts by meaningful names rather than account numbers.
	// faXmlData -  the xml-formatted configuration
	ReceiveFA(faDataType FaDataType, cxml string)
	// HistoricalData returns the requested historical data bars
	// reqID - the request's identifier
	// bar - The Bar
	HistoricalData(reqID int64, bar *Bar)
	// HistoricalDataEnd is called when historical bars reception is ending.
	HistoricalDataEnd(reqID int64, startDateStr string, endDateStr string)
	// ScannerParameters Provides the xml-formatted parameters available to create a market scanner.
	ScannerParameters(xml string)
	// ScannerData Provides the data resulting from the market scanner request.
	// reqID - the request's identifier.
	// rank -  the ranking within the response of this bar.
	// contractDetails - the data's ContractDetails
	// distance -      according to query.
	// benchmark -     according to query.
	// projection -    according to query.
	// legStr - describes the combo legs when the scanner is returning EFP
	ScannerData(reqID int64, rank int64, contractDetails *ContractDetails, distance string, benchmark string, projection string, legsStr string)
	// ScannerDataEnd indicates that the scanner data reception has terminated.
	ScannerDataEnd(reqID int64)
	// RealtimeBar updates the real time 5 seconds bars
	// reqID - the request's identifier
	// time  - start of bar in unix (or 'epoch') time
	// open_  - the bar's open value
	// high  - the bar's high value
	// low   - the bar's low value
	// close - the bar's closing value
	// volume - the bar's traded volume if available
	// wap   - the bar's Weighted Average Price
	// count - the number of trades during the bar's timespan (only available for TRADES).
	RealtimeBar(reqID TickerID, time int64, open float64, high float64, low float64, close float64, volume Decimal, wap Decimal, count int64)
	// CurrentTime will receive IB server's system current time after the invokation of reqCurrentTime.
	CurrentTime(t int64)
	// FundamentalData
	FundamentalData(reqID TickerID, data string)
	// DeltaNeutralValidation
	DeltaNeutralValidation(reqID int64, deltaNeutralContract DeltaNeutralContract)
	// TickSnapshotEnd indicates the snapshot reception is finished.
	TickSnapshotEnd(reqID int64)
	// MarketDataType is called when market data switches between real-time and frozen.
	// The marketDataType( ) callback accepts a reqId parameter and is sent per every subscription because different contracts can generally trade on a different schedule
	MarketDataType(reqID TickerID, marketDataType int64)
	// CommissionReport is called immediately after a trade execution or by calling reqExecutions().
	CommissionReport(commissionReport CommissionReport)
	// Position returns real-time positions for all accounts in response to the reqPositions() method.
	Position(account string, contract *Contract, position Decimal, avgCost float64)
	// PositionEnd is called once all position data for a given request are received and functions as an end marker for the position() data.
	PositionEnd()
	// AccountSummary returns the data from the TWS Account Window Summary tab in response to reqAccountSummary().
	AccountSummary(reqID int64, account string, tag string, value string, currency string)
	// AccountSummaryEnd is called once all account summary data for a given request are received.
	AccountSummaryEnd(reqID int64)
	// VerifyMessageAPI .
	VerifyMessageAPI(apiData string)
	// VerifyCompleted .
	VerifyCompleted(isSuccessful bool, errorText string)
	// DisplayGroupList is a one-time response to queryDisplayGroups().
	// reqID - The reqID specified in queryDisplayGroups().
	// groups - A list of integers representing visible group ID separated by the | character, and sorted by most used group first. This list will
	//      not change during TWS session (in other words, user cannot add a new group; sorting can change though).
	DisplayGroupList(reqID int64, groups string)
	// DisplayGroupUpdated .
	DisplayGroupUpdated(reqID int64, contractInfo string)
	// VerifyAndAuthMessageAPI .
	VerifyAndAuthMessageAPI(apiData string, xyzChallange string)
	// VerifyAndAuthCompleted .
	VerifyAndAuthCompleted(isSuccessful bool, errorText string)
	// ConnectAck is called on completion of successful connection.
	ConnectAck()
	// PositionMulti .
	PositionMulti(reqID int64, account string, modelCode string, contract *Contract, pos Decimal, avgCost float64)
	// PositionMultiEnd .
	PositionMultiEnd(reqID int64)
	// AccountUpdateMulti .
	AccountUpdateMulti(reqID int64, account string, modleCode string, key string, value string, currency string)
	// AccountUpdateMultiEnd .
	AccountUpdateMultiEnd(reqID int64)
	// SecurityDefinitionOptionParameter returns the option chain for an underlying on an exchange specified in reqSecDefOptParams.
	// There will be multiple callbacks to securityDefinitionOptionParameter if multiple exchanges are specified in reqSecDefOptParams.
	// reqId - ID of the request initiating the callback.
	// underlyingConId - The conID of the underlying security.
	// tradingClass -  the option trading class.
	// multiplier -    the option multiplier.
	// expirations - a list of the expiries for the options of this underlying on this exchange.
	// strikes - a list of the possible strikes for options of this underlying on this exchange.
	SecurityDefinitionOptionParameter(reqID int64, exchange string, underlyingConID int64, tradingClass string, multiplier string, expirations []string, strikes []float64)
	// SecurityDefinitionOptionParameterEnd is called when all callbacks to securityDefinitionOptionParameter are completed.
	SecurityDefinitionOptionParameterEnd(reqID int64)
	// SoftDollarTiers is called when receives Soft Dollar Tier configuration information.
	// reqID - The request ID used in the call to reqSoftDollarTiers()
	// tiers - Stores a list of SoftDollarTier that contains all Soft Dollar Tiers information
	SoftDollarTiers(reqID int64, tiers []SoftDollarTier)
	// FamilyCodes .
	FamilyCodes(familyCodes []FamilyCode)
	// SymbolSamples .
	SymbolSamples(reqID int64, contractDescriptions []ContractDescription)
	// MktDepthExchanges .
	MktDepthExchanges(depthMktDataDescriptions []DepthMktDataDescription)
	// TickNews .
	TickNews(TickerID TickerID, timeStamp int64, providerCode string, articleID string, headline string, extraData string)
	// SmartComponents .
	SmartComponents(reqID int64, smartComponents []SmartComponent)
	// TickReqParams .
	TickReqParams(TickerID TickerID, minTick float64, bboExchange string, snapshotPermissions int64)
	// NewsProviders .
	NewsProviders(newsProviders []NewsProvider)
	// NewsArticle .
	NewsArticle(requestID int64, articleType int64, articleText string)
	// HistoricalNews returns historical news headlines.
	HistoricalNews(requestID int64, time string, providerCode string, articleID string, headline string)
	// HistoricalNewsEnd signals end of historical news.
	HistoricalNewsEnd(requestID int64, hasMore bool)
	// HeadTimestamp returns earliest available data of a type of data for a particular contract.
	HeadTimestamp(reqID int64, headTimestamp string)
	// HistogramData returns histogram data for a contract.
	HistogramData(reqID int64, data []HistogramData)
	// HistoricalDataUpdate .
	HistoricalDataUpdate(reqID int64, bar *Bar)
	// RerouteMktDataReq .
	RerouteMktDataReq(reqID int64, conID int64, exchange string)
	// RerouteMktDepthReq .
	RerouteMktDepthReq(reqID int64, conID int64, exchange string)
	// MarketRule .
	MarketRule(marketRuleID int64, priceIncrements []PriceIncrement)
	// Pnl returns the daily PnL for the account.
	Pnl(reqID int64, dailyPnL float64, unrealizedPnL float64, realizedPnL float64)
	// PnlSingle returns the daily PnL for a single position in the account.
	PnlSingle(reqID int64, pos Decimal, dailyPnL float64, unrealizedPnL float64, realizedPnL float64, value float64)
	// HistoricalTicks returns historical tick data when whatToShow=MIDPOINT.
	HistoricalTicks(reqID int64, ticks []HistoricalTick, done bool)
	// HistoricalTicksBidAsk returns historical tick data when whatToShow=BID_ASK.
	HistoricalTicksBidAsk(reqID int64, ticks []HistoricalTickBidAsk, done bool)
	// HistoricalTicksLast returns historical tick data when whatToShow=TRADES
	HistoricalTicksLast(reqID int64, ticks []HistoricalTickLast, done bool)
	// TickByTickAllLast returns tick-by-tick data for tickType = "Last" or "AllLast"
	TickByTickAllLast(reqID int64, tickType int64, time int64, price float64, size Decimal, tickAttribLast TickAttribLast, exchange string, specialConditions string)
	// TickByTickBidAsk .
	TickByTickBidAsk(reqID int64, time int64, bidPrice float64, askPrice float64, bidSize Decimal, askSize Decimal, tickAttribBidAsk TickAttribBidAsk)
	// TickByTickMidPoint .
	TickByTickMidPoint(reqID int64, time int64, midPoint float64)
	// OrderBound returns orderBound notification .
	OrderBound(permID int64, clientID int64, orderID int64)
	// CompletedOrder is called to feed in completed orders.
	CompletedOrder(contract *Contract, order *Order, orderState *OrderState)
	// CompletedOrdersEnd is called at the end of a given request for completed orders.
	CompletedOrdersEnd()
	// ReplaceFAEnd is called at the end of a replace FA.
	ReplaceFAEnd(reqID int64, text string)
	// WshMetaData .
	WshMetaData(reqID int64, dataJson string)
	// WshEventData .
	WshEventData(reqID int64, dataJson string)
	// HistoricalSchedule returns historical schedule for historical data request with whatToShow=SCHEDULE
	HistoricalSchedule(reqID int64, startDarteTime, endDateTime, timeZone string, sessions []HistoricalSession)
	// UserInfo returns user info.
	UserInfo(reqID int64, whiteBrandingId string)
}

EWrapper contains the function to handle incoming messages from TWS or Gateway

type Execution

type Execution struct {
	ExecID               string
	Time                 string
	AcctNumber           string
	Exchange             string
	Side                 string
	Shares               Decimal
	Price                float64
	PermID               int64
	ClientID             int64
	OrderID              int64
	Liquidation          int64
	CumQty               Decimal
	AvgPrice             float64
	OrderRef             string
	EVRule               string
	EVMultiplier         float64
	ModelCode            string
	LastLiquidity        int64
	PendingPriceRevision bool
}

Execution is the information of an order`s execution.

func NewExecution

func NewExecution() *Execution

func (Execution) String

func (e Execution) String() string

type ExecutionCondition

type ExecutionCondition struct {
	SecType  string
	Exchange string
	Symbol   string
	// contains filtered or unexported fields
}

func NewExecutionCondition

func NewExecutionCondition(symbol string, secType string, exchange string, isConjunction bool) *ExecutionCondition

NewExecutionCondition .

func (ExecutionCondition) String

func (ec ExecutionCondition) String() string

func (ExecutionCondition) Type

func (oc ExecutionCondition) Type() OrderConditionType

type ExecutionFilter

type ExecutionFilter struct {
	ClientID int64
	AcctCode string
	Time     string
	Symbol   string
	SecType  string
	Exchange string
	Side     string
}

ExecutionFilter .

type FaDataType

type FaDataType int64
const (
	GROUPS  FaDataType = 1
	ALIASES FaDataType = 3
)

func (FaDataType) String

func (fa FaDataType) String() string

type FamilyCode

type FamilyCode struct {
	AccountID     string
	FamilyCodeStr string
}

FamilyCode .

func NewFamilyCode

func NewFamilyCode() FamilyCode

func (FamilyCode) String

func (f FamilyCode) String() string

type FundAssetType

type FundAssetType string
const (
	FundAssetTypeNone        FundAssetType = ""
	FundAssetTypeOthers      FundAssetType = "000"
	FundAssetTypeMoneyMarket FundAssetType = "001"
	FundAssetTypeFixedIncome FundAssetType = "002"
	FundAssetTypeMultiAsset  FundAssetType = "003"
	FundAssetTypeEquity      FundAssetType = "004"
	FundAssetTypeSector      FundAssetType = "005"
	FundAssetTypeGuaranteed  FundAssetType = "006"
	FundAssetTypeAlternative FundAssetType = "007"
)

type FundDistributionPolicyIndicator

type FundDistributionPolicyIndicator string
const (
	FundDistributionPolicyIndicatorNone             FundDistributionPolicyIndicator = ""
	FundDistributionPolicyIndicatorAccumulationFund FundDistributionPolicyIndicator = "N"
	FundDistributionPolicyIndicatorIncomeFund       FundDistributionPolicyIndicator = "Y"
)

type Group

type Group struct {
	XMLName        xml.Name `xml:"Group"`
	Name           string   `xml:"name"`
	DefaultMethod  string   `xml:"defaultMethod"`
	ListOfAccounts ListOfAccounts
}

Group . DefaultMethod is either one of the IB-computed allocation methods (AvailableEquity, Equal, NetLiq) or a user-specified allocation methods (MonetaryAmount, Percent, Ratio, ContractsOrShares). AvailableEquity method requires you to specify an order size. This method distributes shares based on the amount of available equity in each account. The system calculates ratios based on the Available Equity in each account and allocates shares based on these ratios. Equal method requires you to specify an order size. This method distributes shares equally between all accounts in the group. NetLiq method requires you to specify an order size. This method distributes shares based on the net liquidation value of each account. The system calculates ratios based on the Net Liquidation value in each account and allocates shares based on these ratios. MonetaryAmount method calculates the number of units to be allocated based on the monetary value assigned to each account. Ratio method calculates the allocation of shares based on the ratios you enter. ContractsOrShares method allocates the absolute number of shares you enter to each account listed. If you use this method, the order size is calculated by adding together the number of shares allocated to each account in the profile.

type HistogramData

type HistogramData struct {
	Price float64
	Size  Decimal
}

HistogramData .

func NewHistogramData

func NewHistogramData() HistogramData

func (HistogramData) String

func (hd HistogramData) String() string

type HistoricalSession

type HistoricalSession struct {
	StartDateTime string
	EndDateTime   string
	RefDate       string
}

HistoricalSession .

func NewHistoricalSession

func NewHistoricalSession() HistoricalSession

func (HistoricalSession) String

func (h HistoricalSession) String() string

type HistoricalTick

type HistoricalTick struct {
	Time  int64
	Price float64
	Size  Decimal
}

HistoricalTick is the historical tick's description. Used when requesting historical tick data with whatToShow = MIDPOINT.

func NewHistoricalTick

func NewHistoricalTick() HistoricalTick

func (HistoricalTick) String

func (h HistoricalTick) String() string

type HistoricalTickBidAsk

type HistoricalTickBidAsk struct {
	Time             int64
	TickAttirbBidAsk TickAttribBidAsk
	PriceBid         float64
	PriceAsk         float64
	SizeBid          Decimal
	SizeAsk          Decimal
}

HistoricalTickBidAsk is the historical tick's description. Used when requesting historical tick data with whatToShow = BID_ASK.

func NewHistoricalTickBidAsk

func NewHistoricalTickBidAsk() HistoricalTickBidAsk

func (HistoricalTickBidAsk) String

func (h HistoricalTickBidAsk) String() string

type HistoricalTickLast

type HistoricalTickLast struct {
	Time              int64
	TickAttribLast    TickAttribLast
	Price             float64
	Size              Decimal
	Exchange          string
	SpecialConditions string
}

HistoricalTickLast is the historical last tick's description. Used when requesting historical tick data with whatToShow = TRADES.

func NewHistoricalTickLast

func NewHistoricalTickLast() HistoricalTickLast

func (HistoricalTickLast) String

func (h HistoricalTickLast) String() string

func (HistoricalTickLast) Timestamp

func (h HistoricalTickLast) Timestamp() time.Time

type IN

type IN = int64

IN is the incoming msg id's

const (
	TICK_PRICE                               IN = 1
	TICK_SIZE                                IN = 2
	ORDER_STATUS                             IN = 3
	ERR_MSG                                  IN = 4
	OPEN_ORDER                               IN = 5
	ACCT_VALUE                               IN = 6
	PORTFOLIO_VALUE                          IN = 7
	ACCT_UPDATE_TIME                         IN = 8
	NEXT_VALID_ID                            IN = 9
	CONTRACT_DATA                            IN = 10
	EXECUTION_DATA                           IN = 11
	MARKET_DEPTH                             IN = 12
	MARKET_DEPTH_L2                          IN = 13
	NEWS_BULLETINS                           IN = 14
	MANAGED_ACCTS                            IN = 15
	RECEIVE_FA                               IN = 16
	HISTORICAL_DATA                          IN = 17
	BOND_CONTRACT_DATA                       IN = 18
	SCANNER_PARAMETERS                       IN = 19
	SCANNER_DATA                             IN = 20
	TICK_OPTION_COMPUTATION                  IN = 21
	TICK_GENERIC                             IN = 45
	TICK_STRING                              IN = 46
	TICK_EFP                                 IN = 47
	CURRENT_TIME                             IN = 49
	REAL_TIME_BARS                           IN = 50
	FUNDAMENTAL_DATA                         IN = 51
	CONTRACT_DATA_END                        IN = 52
	OPEN_ORDER_END                           IN = 53
	ACCT_DOWNLOAD_END                        IN = 54
	EXECUTION_DATA_END                       IN = 55
	DELTA_NEUTRAL_VALIDATION                 IN = 56
	TICK_SNAPSHOT_END                        IN = 57
	MARKET_DATA_TYPE                         IN = 58
	COMMISSION_REPORT                        IN = 59
	POSITION_DATA                            IN = 61
	POSITION_END                             IN = 62
	ACCOUNT_SUMMARY                          IN = 63
	ACCOUNT_SUMMARY_END                      IN = 64
	VERIFY_MESSAGE_API                       IN = 65
	VERIFY_COMPLETED                         IN = 66
	DISPLAY_GROUP_LIST                       IN = 67
	DISPLAY_GROUP_UPDATED                    IN = 68
	VERIFY_AND_AUTH_MESSAGE_API              IN = 69
	VERIFY_AND_AUTH_COMPLETED                IN = 70
	POSITION_MULTI                           IN = 71
	POSITION_MULTI_END                       IN = 72
	ACCOUNT_UPDATE_MULTI                     IN = 73
	ACCOUNT_UPDATE_MULTI_END                 IN = 74
	SECURITY_DEFINITION_OPTION_PARAMETER     IN = 75
	SECURITY_DEFINITION_OPTION_PARAMETER_END IN = 76
	SOFT_DOLLAR_TIERS                        IN = 77
	FAMILY_CODES                             IN = 78
	SYMBOL_SAMPLES                           IN = 79
	MKT_DEPTH_EXCHANGES                      IN = 80
	TICK_REQ_PARAMS                          IN = 81
	SMART_COMPONENTS                         IN = 82
	NEWS_ARTICLE                             IN = 83
	TICK_NEWS                                IN = 84
	NEWS_PROVIDERS                           IN = 85
	HISTORICAL_NEWS                          IN = 86
	HISTORICAL_NEWS_END                      IN = 87
	HEAD_TIMESTAMP                           IN = 88
	HISTOGRAM_DATA                           IN = 89
	HISTORICAL_DATA_UPDATE                   IN = 90
	REROUTE_MKT_DATA_REQ                     IN = 91
	REROUTE_MKT_DEPTH_REQ                    IN = 92
	MARKET_RULE                              IN = 93
	PNL                                      IN = 94
	PNL_SINGLE                               IN = 95
	HISTORICAL_TICKS                         IN = 96
	HISTORICAL_TICKS_BID_ASK                 IN = 97
	HISTORICAL_TICKS_LAST                    IN = 98
	TICK_BY_TICK                             IN = 99
	ORDER_BOUND                              IN = 100
	COMPLETED_ORDER                          IN = 101
	COMPLETED_ORDERS_END                     IN = 102
	REPLACE_FA_END                           IN = 103
	WSH_META_DATA                            IN = 104
	WSH_EVENT_DATA                           IN = 105
	HISTORICAL_SCHEDULE                      IN = 106
	USER_INFO                                IN = 107
)

type IneligibilityReason

type IneligibilityReason struct {
	ID          string
	Description string
}

IneligibilityReason is a simple struct for ineligibility reason

type LegOpenClose

type LegOpenClose int64

LegOpenClose .

const (
	SAME_POS    LegOpenClose = 0
	OPEN_POS    LegOpenClose = 1
	CLOSE_POS   LegOpenClose = 2
	UNKNOWN_POS LegOpenClose = 3
)

type ListOfAccounts

type ListOfAccounts struct {
	XMLName  xml.Name `xml:"ListOfAccts"`
	VarName  string   `xml:"varName,attr"`
	Accounts []Account
}

ListOfAccounts .

type ListOfGroups

type ListOfGroups struct {
	XMLName xml.Name `xml:"ListOfGroups"`
	Groups  []Group
}

ListOf Groups .

type MarginCondition

type MarginCondition struct {
	*OperatorCondition
	Percent int64
}

func NewMarginCondition

func NewMarginCondition(percent int64, isMore bool, isConjunction bool) *MarginCondition

NewMarginCondition .

func (MarginCondition) String

func (oc MarginCondition) String() string

func (MarginCondition) Type

func (oc MarginCondition) Type() OrderConditionType

type MarketDataType

type MarketDataType int64
const (
	REALTIME       MarketDataType = 1
	FROZEN         MarketDataType = 2
	DELAYED        MarketDataType = 3
	DELAYED_FROZEN MarketDataType = 4
)

func (MarketDataType) String

func (mdt MarketDataType) String() string

type MsgBuffer

type MsgBuffer struct {
	bytes.Buffer
	// contains filtered or unexported fields
}

MsgBuffer is the buffer that contains a whole msg.

func NewMsgBuffer

func NewMsgBuffer(bs []byte) *MsgBuffer

NewMsgBuffer create a new MsgBuffer.

func (*MsgBuffer) Reset

func (m *MsgBuffer) Reset()

Reset reset buffer, []byte, err.

type NewsProvider

type NewsProvider struct {
	Code string
	Name string
}

NewsProvider .

func NewNewsProvider

func NewNewsProvider() NewsProvider

func (NewsProvider) String

func (np NewsProvider) String() string

type OUT

type OUT = int64

OUT is the outgoing msg id's.

const (
	REQ_MKT_DATA                  OUT = 1
	CANCEL_MKT_DATA               OUT = 2
	PLACE_ORDER                   OUT = 3
	CANCEL_ORDER                  OUT = 4
	REQ_OPEN_ORDERS               OUT = 5
	REQ_ACCT_DATA                 OUT = 6
	REQ_EXECUTIONS                OUT = 7
	REQ_IDS                       OUT = 8
	REQ_CONTRACT_DATA             OUT = 9
	REQ_MKT_DEPTH                 OUT = 10
	CANCEL_MKT_DEPTH              OUT = 11
	REQ_NEWS_BULLETINS            OUT = 12
	CANCEL_NEWS_BULLETINS         OUT = 13
	SET_SERVER_LOGLEVEL           OUT = 14
	REQ_AUTO_OPEN_ORDERS          OUT = 15
	REQ_ALL_OPEN_ORDERS           OUT = 16
	REQ_MANAGED_ACCTS             OUT = 17
	REQ_FA                        OUT = 18
	REPLACE_FA                    OUT = 19
	REQ_HISTORICAL_DATA           OUT = 20
	EXERCISE_OPTIONS              OUT = 21
	REQ_SCANNER_SUBSCRIPTION      OUT = 22
	CANCEL_SCANNER_SUBSCRIPTION   OUT = 23
	REQ_SCANNER_PARAMETERS        OUT = 24
	CANCEL_HISTORICAL_DATA        OUT = 25
	REQ_CURRENT_TIME              OUT = 49
	REQ_REAL_TIME_BARS            OUT = 50
	CANCEL_REAL_TIME_BARS         OUT = 51
	REQ_FUNDAMENTAL_DATA          OUT = 52
	CANCEL_FUNDAMENTAL_DATA       OUT = 53
	REQ_CALC_IMPLIED_VOLAT        OUT = 54
	REQ_CALC_OPTION_PRICE         OUT = 55
	CANCEL_CALC_IMPLIED_VOLAT     OUT = 56
	CANCEL_CALC_OPTION_PRICE      OUT = 57
	REQ_GLOBAL_CANCEL             OUT = 58
	REQ_MARKET_DATA_TYPE          OUT = 59
	REQ_POSITIONS                 OUT = 61
	REQ_ACCOUNT_SUMMARY           OUT = 62
	CANCEL_ACCOUNT_SUMMARY        OUT = 63
	CANCEL_POSITIONS              OUT = 64
	VERIFY_REQUEST                OUT = 65
	VERIFY_MESSAGE                OUT = 66
	QUERY_DISPLAY_GROUPS          OUT = 67
	SUBSCRIBE_TO_GROUP_EVENTS     OUT = 68
	UPDATE_DISPLAY_GROUP          OUT = 69
	UNSUBSCRIBE_FROM_GROUP_EVENTS OUT = 70
	START_API                     OUT = 71
	VERIFY_AND_AUTH_REQUEST       OUT = 72
	VERIFY_AND_AUTH_MESSAGE       OUT = 73
	REQ_POSITIONS_MULTI           OUT = 74
	CANCEL_POSITIONS_MULTI        OUT = 75
	REQ_ACCOUNT_UPDATES_MULTI     OUT = 76
	CANCEL_ACCOUNT_UPDATES_MULTI  OUT = 77
	REQ_SEC_DEF_OPT_PARAMS        OUT = 78
	REQ_SOFT_DOLLAR_TIERS         OUT = 79
	REQ_FAMILY_CODES              OUT = 80
	REQ_MATCHING_SYMBOLS          OUT = 81
	REQ_MKT_DEPTH_EXCHANGES       OUT = 82
	REQ_SMART_COMPONENTS          OUT = 83
	REQ_NEWS_ARTICLE              OUT = 84
	REQ_NEWS_PROVIDERS            OUT = 85
	REQ_HISTORICAL_NEWS           OUT = 86
	REQ_HEAD_TIMESTAMP            OUT = 87
	REQ_HISTOGRAM_DATA            OUT = 88
	CANCEL_HISTOGRAM_DATA         OUT = 89
	CANCEL_HEAD_TIMESTAMP         OUT = 90
	REQ_MARKET_RULE               OUT = 91
	REQ_PNL                       OUT = 92
	CANCEL_PNL                    OUT = 93
	REQ_PNL_SINGLE                OUT = 94
	CANCEL_PNL_SINGLE             OUT = 95
	REQ_HISTORICAL_TICKS          OUT = 96
	REQ_TICK_BY_TICK_DATA         OUT = 97
	CANCEL_TICK_BY_TICK_DATA      OUT = 98
	REQ_COMPLETED_ORDERS          OUT = 99
	REQ_WSH_META_DATA             OUT = 100
	CANCEL_WSH_META_DATA          OUT = 101
	REQ_WSH_EVENT_DATA            OUT = 102
	CANCEL_WSH_EVENT_DATA         OUT = 103
	REQ_USER_INFO                 OUT = 104
)

type OperatorCondition

type OperatorCondition struct {
	IsMore bool
	// contains filtered or unexported fields
}

func (OperatorCondition) String

func (oc OperatorCondition) String() string

func (OperatorCondition) Type

func (oc OperatorCondition) Type() OrderConditionType

type Order

type Order struct {
	// order identifier
	OrderID  int64
	ClientID int64
	PermID   int64

	// main order fields
	Action        string
	TotalQuantity Decimal `default:"UNSET_DECIMAL"`
	OrderType     string
	LmtPrice      float64 `default:"UNSET_FLOAT"`
	AuxPrice      float64 `default:"UNSET_FLOAT"`

	// extended order fields
	TIF                           string // "Time in Force" - DAY, GTC, etc.
	ActiveStartTime               string // for GTC orders
	ActiveStopTime                string // for GTC orders
	OCAGroup                      string // one cancels all group name
	OCAType                       int64  // 1 = CANCEL_WITH_BLOCK, 2 = REDUCE_WITH_BLOCK, 3 = REDUCE_NON_BLOCK
	OrderRef                      string // order reference
	Transmit                      bool   `default:"true"` // if false, order will be created but not transmitted
	ParentID                      int64  // Parent order Id, to associate Auto STP or TRAIL orders with the original order.
	BlockOrder                    bool
	SweepToFill                   bool
	DisplaySize                   int64
	TriggerMethod                 int64 // 0=Default, 1=Double_Bid_Ask, 2=Last, 3=Double_Last, 4=Bid_Ask, 7=Last_or_Bid_Ask, 8=Mid-point
	OutsideRTH                    bool
	Hidden                        bool
	GoodAfterTime                 string // Format: 20060505 08:00:00 {time zone}
	GoodTillDate                  string // Format: 20060505 08:00:00 {time zone}
	Rule80A                       string // Individual = 'I', Agency = 'A', AgentOtherMember = 'W', IndividualPTIA = 'J', AgencyPTIA = 'U', AgentOtherMemberPTIA = 'M', IndividualPT = 'K', AgencyPT = 'Y', AgentOtherMemberPT = 'N'
	AllOrNone                     bool
	MinQty                        int64   `default:"UNSET_INT"`
	PercentOffset                 float64 `default:"UNSET_FLOAT"` // REL orders only
	OverridePercentageConstraints bool
	TrailStopPrice                float64 `default:"UNSET_FLOAT"` // TRAILLIMIT orders only
	TrailingPercent               float64 `default:"UNSET_FLOAT"`

	// financial advisors only
	FAGroup      string
	FAMethod     string
	FAPercentage string

	// institutional (ie non-cleared) only
	OpenClose          string // O=Open, C=Close
	Origin             int64  // 0=Customer, 1=Firm
	ShortSaleSlot      int64  // 1 if you hold the shares, 2 if they will be delivered from elsewhere.  Only for Action=SSHORT
	DesignatedLocation string // set when slot=2 only.
	ExemptCode         int64  `default:"-1"`

	// SMART routing only
	DiscretionaryAmt   float64
	OptOutSmartRouting bool

	// BOX exchange orders only
	AuctionStrategy AuctionStrategy // AUCTION_UNSET, AUCTION_MATCH, AUCTION_IMPROVEMENT, AUCTION_TRANSPARENT
	StartingPrice   float64         `default:"UNSET_FLOAT"`
	StockRefPrice   float64         `default:"UNSET_FLOAT"`
	Delta           float64         `default:"UNSET_FLOAT"`

	// pegged to stock and VOL orders only
	StockRangeLower float64 `default:"UNSET_FLOAT"`
	StockRangeUpper float64 `default:"UNSET_FLOAT"`

	RandomizeSize  bool
	RandomizePrice bool

	// VOLATILITY ORDERS ONLY
	Volatility                     float64 `default:"UNSET_FLOAT"`
	VolatilityType                 int64   `default:"UNSET_INT"`
	DeltaNeutralOrderType          string
	DeltaNeutralAuxPrice           float64 `default:"UNSET_FLOAT"`
	DeltaNeutralConID              int64
	DeltaNeutralSettlingFirm       string
	DeltaNeutralClearingAccount    string
	DeltaNeutralClearingIntent     string
	DeltaNeutralOpenClose          string
	DeltaNeutralShortSale          bool
	DeltaNeutralShortSaleSlot      int64
	DeltaNeutralDesignatedLocation string
	ContinuousUpdate               bool
	ReferencePriceType             int64 `default:"UNSET_INT"` // 1=Average, 2 = BidOrAsk

	// COMBO ORDERS ONLY
	BasisPoints     float64 `default:"UNSET_FLOAT"` // EFP orders only
	BasisPointsType int64   `default:"UNSET_INT"`   // EFP orders only

	// SCALE ORDERS ONLY
	ScaleInitLevelSize       int64   `default:"UNSET_INT"`
	ScaleSubsLevelSize       int64   `default:"UNSET_INT"`
	ScalePriceIncrement      float64 `default:"UNSET_FLOAT"`
	ScalePriceAdjustValue    float64 `default:"UNSET_FLOAT"`
	ScalePriceAdjustInterval int64   `default:"UNSET_INT"`
	ScaleProfitOffset        float64 `default:"UNSET_FLOAT"`
	ScaleAutoReset           bool
	ScaleInitPosition        int64 `default:"UNSET_INT"`
	ScaleInitFillQty         int64 `default:"UNSET_INT"`
	ScaleRandomPercent       bool
	ScaleTable               string

	// HEDGE ORDERS
	HedgeType  string // 'D' - delta, 'B' - beta, 'F' - FX, 'P' - pair
	HedgeParam string // 'beta=X' value for beta hedge, 'ratio=Y' for pair hedge

	// Clearing info
	Account         string // IB account
	SettlingFirm    string
	ClearingAccount string // True beneficiary of the order
	ClearingIntent  string // "" (Default), "IB", "Away", "PTA" (PostTrade)

	// ALGO ORDERS ONLY
	AlgoStrategy string

	AlgoParams              []TagValue
	SmartComboRoutingParams []TagValue

	AlgoID string

	// What-if
	WhatIf bool

	// Not Held
	NotHeld   bool
	Solictied bool

	// models
	ModelCode string

	// order combo legs
	OrderComboLegs   []OrderComboLeg
	OrderMiscOptions []TagValue

	//VER PEG2BENCH fields:
	ReferenceContractID          int64
	PeggedChangeAmount           float64
	IsPeggedChangeAmountDecrease bool
	ReferenceChangeAmount        float64
	ReferenceExchangeID          string
	AdjustedOrderType            string
	TriggerPrice                 float64 `default:"UNSET_FLOAT"`
	AdjustedStopPrice            float64 `default:"UNSET_FLOAT"`
	AdjustedStopLimitPrice       float64 `default:"UNSET_FLOAT"`
	AdjustedTrailingAmount       float64 `default:"UNSET_FLOAT"`
	AdjustableTrailingUnit       int64
	LmtPriceOffset               float64 `default:"UNSET_FLOAT"`

	Conditions            []OrderCondition
	ConditionsCancelOrder bool
	ConditionsIgnoreRth   bool

	// ext operator
	ExtOperator string

	SoftDollarTier SoftDollarTier

	// native cash quantity
	CashQty float64 `default:"UNSET_FLOAT"`

	Mifid2DecisionMaker   string
	Mifid2DecisionAlgo    string
	Mifid2ExecutionTrader string
	Mifid2ExecutionAlgo   string

	// don't use auto price for hedge
	DontUseAutoPriceForHedge bool

	IsOmsContainer bool

	DiscretionaryUpToLimitPrice bool

	AutoCancelDate       string
	FilledQuantity       Decimal `default:"UNSET_DECIMAL"`
	RefFuturesConID      int64
	AutoCancelParent     bool
	Shareholder          string
	ImbalanceOnly        bool
	RouteMarketableToBbo bool
	ParentPermID         int64

	UsePriceMgmtAlgo         bool
	Duration                 int64 `default:"UNSET_INT"`
	PostToAts                int64 `default:"UNSET_INT"`
	AdvancedErrorOverride    string
	ManualOrderTime          string
	MinTradeQty              int64   `default:"UNSET_INT"`
	MinCompeteSize           int64   `default:"UNSET_INT"`
	CompeteAgainstBestOffset float64 `default:"UNSET_FLOAT"`
	MidOffsetAtWhole         float64 `default:"UNSET_FLOAT"`
	MidOffsetAtHalf          float64 `default:"UNSET_FLOAT"`
	CustomerAccount          string
	ProfessionalCustomer     bool
	BondAccruedInterest      string
	IncludeOvernight         bool
	ManualOrderIndicator     int64 `default:"UNSET_INT"`
}

Order .

func AtAuction

func AtAuction(action string, quantity Decimal, price float64) *Order

AtAuction . An auction order is entered into the electronic trading system during the pre-market opening period for execution at the Calculated Opening Price (COP). If your order is not filled on the open, the order is re-submitted as a limit order with the limit price set to the COP or the best bid/ask after the market opens. Products: FUT, STK.

func AttachAdjustableToStop

func AttachAdjustableToStop(parent *Order, attachedOrderStopPrice float64, triggerPrice float64, adjustStopPrice float64) *Order

AttachAdjustableToStop .

func AttachAdjustableToStopLimit

func AttachAdjustableToStopLimit(parent *Order, attachedOrderStopPrice float64, triggerPrice float64, adjustedStopPrice float64, adjustedStopLimitPrice float64) *Order

AttachAdjustableToStopLimit .

func AttachAdjustableToTrail

func AttachAdjustableToTrail(parent *Order, attachedOrderStopPrice float64, triggerPrice float64, adjustedStopPrice float64, adjustedTrailAmount float64, trailUnit int64) *Order

AttachAdjustableToTrail .

func AuctionLimit

func AuctionLimit(action string, quantity Decimal, price float64, auctionStrategy int64) *Order

AuctionLimit . For option orders routed to the Boston Options Exchange (BOX) you may elect to participate in the BOX's price improvement auction in pennies. All BOX-directed price improvement orders are immediately sent from Interactive Brokers to the BOX order book, and when the terms allow, IB will evaluate it for inclusion in a price improvement auction based on price and volume priority. In the auction, your order will have priority over broker-dealer price improvement orders at the same price. An Auction Limit order at a specified price. Use of a limit order ensures that you will not receive an execution at a price less favorable than the limit price. Enter limit orders in penny increments with your auction improvement amount computed as the difference between your limit order price and the nearest listed increment. Products: OPT. Supported Exchanges: BOX.

func AuctionPeggedToStock

func AuctionPeggedToStock(action string, quantity Decimal, startingPrice float64, delta float64) *Order

AuctionPeggedToStock . For option orders routed to the Boston Options Exchange (BOX) you may elect to participate in the BOX's price improvement auction in pennies. All BOX-directed price improvement orders are immediately sent from Interactive Brokers to the BOX order book, and when the terms allow, IB will evaluate it for inclusion in a price improvement auction based on price and volume priority. In the auction, your order will have priority over broker-dealer price improvement orders at the same price. An Auction Pegged to Stock order adjusts the order price by the product of a signed delta (which is entered as an absolute and assumed to be positive for calls, negative for puts) and the change of the option's underlying stock price. A buy or sell call order price is determined by adding the delta times a change in an underlying stock price change to a specified starting price for the call. To determine the change in price, a stock reference price (NBBO midpoat:the:int time of the order is assumed if no reference price is entered) is subtracted from the current NBBO midpoint. A stock range may also be entered that cancels an order when reached. The delta times the change in stock price will be rounded to the nearest penny in favor of the order and will be used as your auction improvement amount. Products: OPT. Supported Exchanges: BOX.

func AuctionRelative

func AuctionRelative(action string, quantity Decimal, offset float64) *Order

AuctionRelative. For option orders routed to the Boston Options Exchange (BOX) you may elect to participate in the BOX's price improvement auction in pennies. All BOX-directed price improvement orders are immediately sent from Interactive Brokers to the BOX order book, and when the terms allow, IB will evaluate it for inclusion in a price improvement auction based on price and volume priority. In the auction, your order will have priority over broker-dealer price improvement orders at the same price. An Auction Relative order that adjusts the order price by the product of a signed delta (which is entered as an absolute and assumed to be positive for calls, negative for puts) and the change of the option's underlying stock price. A buy or sell call order price is determined by adding the delta times a change in an underlying stock price change to a specified starting price for the call. To determine the change in price, a stock reference price (NBBO midpoint at the time of the order is assumed if no reference price is entered) is subtracted from the current NBBO midpoint. A stock range may also be entered that cancels an order when reached. The delta times the change in stock price will be rounded to the nearest penny in favor of the order and will be used as your auction improvement amount. Products: OPT Supported Exchanges: BOX.

func Block

func Block(action string, quantity Decimal, price float64) *Order

Block . The Block attribute is used for large volume option orders on ISE that consist of at least 50 contracts. To execute large-volume orders over time without moving the market, use the Accumulate/Distribute algorithm. Products: OPT.

func BoxTop

func BoxTop(action string, quantity Decimal) *Order

BoxTop . A Box Top order executes as a market order at the current best price. If the order is only partially filled, the remainder is submitted as a limit order with the limit price equal to the price at which the filled portion of the order executed. Products: OPT. Supported Exchanges: BOX.

func BracketOrder

func BracketOrder(parentOrderId int64, action string, quantity Decimal, limitPrice float64, takeProfitLimitPrice float64, stopLossPrice float64) (parent, takeProfit, stopLoss *Order)

BracketOrder . Bracket orders are designed to help limit your loss and lock in a profit by "bracketing" an order with two opposite-side orders. A BUY order is bracketed by a high-side sell limit order and a low-side sell stop order. A SELL order is bracketed by a high-side buy stop order and a low side buy limit order. Products: CFD, BAG, FOP, CASH, FUT, OPT, STK, WAR.

func ComboLimitOrder

func ComboLimitOrder(action string, quantity Decimal, limitPrice float64, nonGuaranteed bool) *Order

ComboLimitOrder . Create combination orders that include options, stock and futures legs (stock legs can be included if the order is routed through SmartRouting). Although a combination/spread order is constructed of separate legs, it is executed as a single transaction if it is routed directly to an exchange. For combination orders that are SmartRouted, each leg may be executed separately to ensure best execution. Products: OPT, STK, FUT.

func ComboMarketOrder

func ComboMarketOrder(action string, quantity Decimal, nonGuaranteed bool) *Order

ComboMarketOrder . Create combination orders that include options, stock and futures legs (stock legs can be included if the order is routed through SmartRouting). Although a combination/spread order is constructed of separate legs, it is executed as a single transaction if it is routed directly to an exchange. For combination orders that are SmartRouted, each leg may be executed separately to ensure best execution. Products: OPT, STK, FUT.

func Discretionary

func Discretionary(action string, quantity Decimal, price float64, discretionaryAmount float64) *Order

Discretionary . A Discretionary order is a limit order submitted with a hidden, specified 'discretionary' amount off the limit price which may be used to increase the price range over which the limit order is eligible to execute. The market sees only the limit price. Products: STK.

func LimitIBKRATS

func LimitIBKRATS(action string, quantity Decimal, limitPrice float64) *Order

LimitIBKRATS .

func LimitIfTouched

func LimitIfTouched(action string, quantity Decimal, limitPrice float64, triggerPrice float64) *Order

LimitIfTouched . A Limit if Touched is an order to buy (or sell) a contract at a specified price or better, below (or above) the market. This order is held in the system until the trigger price is touched. An LIT order is similar to a stop limit order, except that an LIT sell order is placed above the current market price, and a stop limit sell order is placed below. Products: BOND, CFD, CASH, FUT, FOP, OPT, STK, WAR.

func LimitOnClose

func LimitOnClose(action string, quantity Decimal, limitPrice float64) *Order

LimitOnClose . A Limit-on-close (LOC) order will be submitted at the close and will execute if the closing price is at or better than the submitted limit price. Products: CFD, FUT, STK, WAR.

func LimitOnOpen

func LimitOnOpen(action string, quantity Decimal, limitPrice float64) *Order

LimitOnOpen . A Limit-on-Open (LOO) order combines a limit order with the OPG time in force to create an order that is submitted at the market's open, and that will only execute at the specified limit price or better. Orders are filled in accordance with specific exchange rules. Products: CFD, STK, OPT, WAR.

func LimitOrder

func LimitOrder(action string, quantity Decimal, limitPrice float64) *Order

LimitOrder . A Limit order is an order to buy or sell at a specified price or better. The Limit order ensures that if the order fills, it will not fill at a price less favorable than your limit price, but it does not guarantee a fill. Products: BOND, CFD, CASH, FUT, FOP, OPT, STK, WAR.

func LimitOrderForComboWithLegPrices

func LimitOrderForComboWithLegPrices(action string, quantity Decimal, legPrices []float64, nonGuaranteed bool) *Order

LimitOrderForComboWithLegPrices . Create combination orders that include options, stock and futures legs (stock legs can be included if the order is routed through SmartRouting). Although a combination/spread order is constructed of separate legs, it is executed as a single transaction if it is routed directly to an exchange. For combination orders that are SmartRouted, each leg may be executed separately to ensure best execution. Products: OPT, STK, FUT.

func LimitOrderWithCashQty

func LimitOrderWithCashQty(action string, limitPrice float64, cashQty float64) *Order

LimitOrderWithCashQty . Forex orders can be placed in denomination of second currency in pair using cashQty field. Requires TWS or IBG 963+. https://www.interactivebrokers.com/en/index.php?f=23876#963-02

func LimitOrderWithCmeTaggingFields

func LimitOrderWithCmeTaggingFields(action string, quantity Decimal, limitPrice float64, extOperator string, manualOrderIndicator int64) *Order

LimitOrderWithCmeTaggingFields .

func LimitOrderWithCustomerAccount

func LimitOrderWithCustomerAccount(action string, quantity Decimal, limitPrice float64, customerAccount string) *Order

LimitOrderWithCustomerAccount .

func LimitOrderWithIncludeOvernight

func LimitOrderWithIncludeOvernight(action string, quantity Decimal, limitPrice float64) *Order

func LimitOrderWithManualOrderTime

func LimitOrderWithManualOrderTime(action string, quantity Decimal, limitPrice float64, manualOrderTime string) *Order

LimitOrderWithManualOrderTime .

func MarketFHedge

func MarketFHedge(parentOrderId int64, action string) *Order

MarketFHedge .

func MarketIfTouched

func MarketIfTouched(action string, quantity Decimal, price float64) *Order

MarketIfTouched . A Market if Touched (MIT) order is an order to buy (or sell) a contract below (or above) the market. Its purpose is to take advantage of sudden or unexpected changes in share or other prices and provides investors with a trigger price to set an order in motion. Investors may be waiting for excessive strength (or weakness) to cease, which might be represented by a specific price point. MIT orders can be used to determine whether or not to enter the market once a specific price level has been achieved. This order is held in the system until the trigger price is touched, and is then submitted as a market order. An MIT order is similar to a stop order, except that an MIT sell order is placed above the current market price, and a stop sell order is placed below Products: BOND, CFD, CASH, FUT, FOP, OPT, STK, WAR.

func MarketOnClose

func MarketOnClose(action string, quantity Decimal) *Order

MarketOnClose creates A Market-on-Close (MOC) order is a market order that is submitted to execute as close to the closing price as possible. Products: CFD, FUT, STK, WAR.

func MarketOnOpen

func MarketOnOpen(action string, quantity Decimal) *Order

MarketOnOpen . A Market-on-Open (MOO) order combines a market order with the OPG time in force to create an order that is automatically submitted at the market's open and fills at the market price. Products: CFD, STK, OPT, WAR.

func MarketOrder

func MarketOrder(action string, quantity Decimal) *Order

MarketOrder . A Market order is an order to buy or sell at the market bid or offer price. A market order may increase the likelihood of a fill and the speed of execution, but unlike the Limit order a Market order provides no price protection and may fill at a price far lower/higher than the current displayed bid/ask. Products: BOND, CFD, EFP, CASH, FUND, FUT, FOP, OPT, STK, WAR.

func MarketToLimit

func MarketToLimit(action string, quantity Decimal) *Order

MarketToLimit . Products:CFD, FUT, FOP, OPT, STK, WAR A Market-to-Limit (MTL) order is submitted as a market order to execute at the current best market price. If the order is only partially filled, the remainder of the order is canceled and re-submitted as a limit order with the limit price equal to the price at which the filled portion of the order executed.

func MarketWithProtection

func MarketWithProtection(action string, quantity Decimal) *Order

MarketWithProtection . This order type is useful for futures traders using Globex. A Market with Protection order is a market order that will be cancelled and resubmitted as a limit order if the entire order does not immediately execute at the market price. The limit price is set by Globex to be close to the current market price, slightly higher for a sell order and lower for a buy order. Products: FUT, FOP.

func MidpointMatch

func MidpointMatch(action string, quantity Decimal) *Order

MidpointMatch . A ISE Midpoint Match (MPM) order. Those orders always execute at the midpoint of the NBBO. You can submit market and limit orders direct-routed to ISE for MPM execution. Market orders execute at the midpoint whenever an eligible contra-order is available. Limit orders execute only when the midpoint price is better than the limit price. Standard MPM orders are completely anonymous. Products: STK.

func Midprice

func Midprice(action string, quantity Decimal, priceCap float64) *Order

Midprice . A Midprice order is designed to split the difference between the bid and ask prices, and fill at the current midpoint of the NBBO or better. Set an optional price cap to define the highest price (for a buy order) or the lowest price (for a sell order) you are willing to accept. Requires TWS 975+. Smart-routing to US stocks only.

func NewOrder

func NewOrder() *Order

NewOrder creates a default Order.

func PassiveRelative

func PassiveRelative(action string, quantity Decimal, offset float64) *Order

PassiveRelative . Passive Relative orders provide a means for traders to seek a less aggressive price than the National Best Bid and Offer (NBBO) while keeping the order pegged to the best bid (for a buy) or ask (for a sell). The order price is automatically adjusted as the markets move to keep the order less aggressive. For a buy order, your order price is pegged to the NBB by a less aggressive offset, and if the NBB moves up, your bid will also move up. If the NBB moves down, there will be no adjustment because your bid will become aggressive and execute. For a sell order, your price is pegged to the NBO by a less aggressive offset, and if the NBO moves down, your offer will also move down. If the NBO moves up, there will be no adjustment because your offer will become aggressive and execute. In addition to the offset, you can define an absolute cap, which works like a limit price, and will prevent your order from being executed above or below a specified level. The Passive Relative order is similar to the Relative/Pegged-to-Primary order, except that the Passive relative subtracts the offset from the bid and the Relative adds the offset to the bid. Products: STK, WAR.

func PegBestOrder

func PegBestOrder(action string, quantity Decimal, limitPrice float64, minTradeQty int64, minCompeteSize int64, competeAgainstBestOffset float64) *Order

PegBestOrder .

func PegBestUpToMidOrder

func PegBestUpToMidOrder(action string, quantity Decimal, limitPrice float64, minTradeQty int64, minCompeteSize int64, midOffsetAtWhole float64, midOffsetAtHalf float64) *Order

PegBestUpToMidOrder .

func PegMidOrder

func PegMidOrder(action string, quantity Decimal, limitPrice float64, minTradeQty int64, midOffsetAtWhole float64, midOffsetAtHalf float64) *Order

PegMidOrder .

func PeggedToBenchmark

func PeggedToBenchmark(action string, quantity Decimal, startingPrice float64, peggedChangeAmountDecrease bool, peggedChangeAmount float64, referenceChangeAmount float64,
	referenceConId int64, referenceExchange string, stockReferencePrice float64, referenceContractLowerRange float64, referenceContractUpperRange float64) *Order

PeggedToBenchmark .

func PeggedToMarket

func PeggedToMarket(action string, quantity Decimal, marketOffset float64) *Order

PeggedToMarket .eurusd := &ibapi.Contract{Symbol: "EUR", SecType: "CASH", Currency: "USD", Exchange: "IDEALPRO"} A pegged-to-market order is designed to maintain a purchase price relative to the national best offer (NBO) or a sale price relative to the national best bid (NBB). Depending on the width of the quote, this order may be passive or aggressive. The trader creates the order by entering a limit price which defines the worst limit price that they are willing to accept. Next, the trader enters an offset amount which computes the active limit price as follows:

Sell order price = Bid price + offset amount
Buy order price = Ask price - offset amount

Products: STK.

func PeggedToMidpoint

func PeggedToMidpoint(action string, quantity Decimal, offset float64, limitPrice float64) *Order

PeggedToMidpoint . A pegged-to-midpoorder:provides:int a means for traders to seek a price at the midpoof:the:int National Best Bid and Offer (NBBO). The price automatically adjusts to peg the midpoas:the:int markets move, to remain aggressive. For a buy order, your bid is pegged to the NBBO midpoand:the:int order price adjusts automatically to continue to peg the midpoif:the:int market moves. The price only adjusts to be more aggressive. If the market moves in the opposite direction, the order will execute. Products: STK.

func PeggedToStock

func PeggedToStock(action string, quantity Decimal, delta float64, stockReferencePrice float64, startingPrice float64) *Order

PeggedToStock . A Pegged to Stock order continually adjusts the option order price by the product of a signed user-define delta and the change of the option's underlying stock price. The delta is entered as an absolute and assumed to be positive for calls and negative for puts. A buy or sell call order price is determined by adding the delta times a change in an underlying stock price to a specified starting price for the call. To determine the change in price, the stock reference price is subtracted from the current NBBO midpoint. The Stock Reference Price can be defined by the user, or defaults to the NBBO midpoat:the:int time of the order if no reference price is entered. You may also enter a high/low stock price range which cancels the order when reached. The delta times the change in stock price will be rounded to the nearest penny in favor of the order. Products: OPT.

func RelativeLimitCombo

func RelativeLimitCombo(action string, quantity Decimal, limitPrice float64, nonGuaranteed bool) *Order

RelativeLimitCombo . Create combination orders that include options, stock and futures legs (stock legs can be included if the order is routed through SmartRouting). Although a combination/spread order is constructed of separate legs, it is executed as a single transaction if it is routed directly to an exchange. For combination orders that are SmartRouted, each leg may be executed separately to ensure best execution. Products: OPT, STK, FUT.

func RelativeMarketCombo

func RelativeMarketCombo(action string, quantity Decimal, nonGuaranteed bool) *Order

RelativeMarketCombo . Create combination orders that include options, stock and futures legs (stock legs can be included if the order is routed through SmartRouting). Although a combination/spread order is constructed of separate legs, it is executed as a single transaction if it is routed directly to an exchange. For combination orders that are SmartRouted, each leg may be executed separately to ensure best execution. Products: OPT, STK, FUT.

func RelativePeggedToPrimary

func RelativePeggedToPrimary(action string, quantity Decimal, priceCap float64,
	offsetAmount float64) *Order

RelativePeggedToPrimary . Relative (a.k.a. Pegged-to-Primary) orders provide a means for traders to seek a more aggressive price than the National Best Bid and Offer (NBBO). By acting as liquidity providers, and placing more aggressive bids and offers than the current best bids and offers, traders increase their odds of filling their order. Quotes are automatically adjusted as the markets move, to remain aggressive. For a buy order, your bid is pegged to the NBB by a more aggressive offset, and if the NBB moves up, your bid will also move up. If the NBB moves down, there will be no adjustment because your bid will become even more aggressive and execute. For sales, your offer is pegged to the NBO by a more aggressive offset, and if the NBO moves down, your offer will also move down. If the NBO moves up, there will be no adjustment because your offer will become more aggressive and execute. In addition to the offset, you can define an absolute cap, which works like a limit price, and will prevent your order from being executed above or below a specified level. Stocks, Options and Futures - not available on paper trading. Products: CFD, STK, OPT, FUT.

func Stop

func Stop(action string, quantity Decimal, stopPrice float64) *Order

Stop . A Stop order is an instruction to submit a buy or sell market order if and when the user-specified stop trigger price is attained or penetrated. A Stop order is not guaranteed a specific execution price and may execute significantly away from its stop price. A Sell Stop order is always placed below the current market price and is typically used to limit a loss or protect a profit on a long stock position. A Buy Stop order is always placed above the current market price. It is typically used to limit a loss or help protect a profit on a short sale. Products: CFD, BAG, CASH, FUT, FOP, OPT, STK, WAR.

func StopLimit

func StopLimit(action string, quantity Decimal, limitPrice float64, stopPrice float64) *Order

StopLimit . A Stop-Limit order is an instruction to submit a buy or sell limit order when the user-specified stop trigger price is attained or penetrated. The order has two basic components: the stop price and the limit price. When a trade has occurred at or through the stop price, the order becomes executable and enters the market as a limit order, which is an order to buy or sell at a specified price or better. Products: CFD, CASH, FUT, FOP, OPT, STK, WAR.

func StopWithProtection

func StopWithProtection(action string, quantity Decimal, stopPrice float64) *Order

StopWithProtection . A Stop with Protection order combines the functionality of a stop limit order with a market with protection order. The order is set to trigger at a specified stop price. When the stop price is penetrated, the order is triggered as a market with protection order, which means that it will fill within a specified protected price range equal to the trigger price +/- the exchange-defined protection point range. Any portion of the order that does not fill within this protected range is submitted as a limit order at the exchange-defined trigger price +/- the protection points. Products: FUT.

func SweepToFill

func SweepToFill(action string, quantity Decimal, price float64) *Order

SweepToFill . Sweep-to-fill orders are useful when a trader values speed of execution over price. A sweep-to-fill order identifies the best price and the exact quantity offered/available at that price, and transmits the corresponding portion of your order for immediate execution. Simultaneously it identifies the next best price and quantity offered/available, and submits the matching quantity of your order for immediate execution. Products: CFD, STK, WAR.

func TrailingStop

func TrailingStop(action string, quantity Decimal, trailingPercent float64, trailStopPrice float64) *Order

TrailingStop . A sell trailing stop order sets the stop price at a fixed amount below the market price with an attached "trailing" amount. As the market price rises, the stop price rises by the trail amount, but if the stock price falls, the stop loss price doesn't change, and a market order is submitted when the stop price is hit. This technique is designed to allow an investor to specify a limit on the maximum possible loss, without setting a limit on the maximum possible gain. "Buy" trailing stop orders are the mirror image of sell trailing stop orders, and are most appropriate for use in falling markets. Products: CFD, CASH, FOP, FUT, OPT, STK, WAR.

func TrailingStopLimit

func TrailingStopLimit(action string, quantity Decimal, lmtPriceOffset float64, trailingAmount float64, trailStopPrice float64) *Order

TrailingStopLimit . A trailing stop limit order is designed to allow an investor to specify a limit on the maximum possible loss, without setting a limit on the maximum possible gain. A SELL trailing stop limit moves with the market price, and continually recalculates the stop trigger price at a fixed amount below the market price, based on the user-defined "trailing" amount. The limit order price is also continually recalculated based on the limit offset. As the market price rises, both the stop price and the limit price rise by the trail amount and limit offset respectively, but if the stock price falls, the stop price remains unchanged, and when the stop price is hit a limit order is submitted at the last calculated limit price. A "Buy" trailing stop limit order is the mirror image of a sell trailing stop limit, and is generally used in falling markets. Products: BOND, CFD, CASH, FUT, FOP, OPT, STK, WAR.

func Volatility

func Volatility(action string, quantity Decimal, volatilityPercent float64, volatilityType int64) *Order

Volatility . Specific to US options, investors are able to create and enter Volatility-type orders for options and combinations rather than price orders. Option traders may wish to trade and position for movements in the price of the option determined by its implied volatility. Because implied volatility is a key determinant of the premium on an option, traders position in specific contract months in an effort to take advantage of perceived changes in implied volatility arising before, during or after earnings or when company specific or broad market volatility is predicted to change. In order to create a Volatility order, clients must first create a Volatility Trader page from the Trading Tools menu and as they enter option contracts, premiums will display in percentage terms rather than premium. The buy/sell process is the same as for regular orders priced in premium terms except that the client can limit the volatility level they are willing to pay or receive. Products: FOP, OPT.

func WhatIfLimitOrder

func WhatIfLimitOrder(action string, quantity Decimal, limitPrice float64) *Order

WhatIfLimitOrder .

func (*Order) HasSameID

func (o *Order) HasSameID(other *Order) bool

func (Order) String

func (o Order) String() string

type OrderAllocation

type OrderAllocation struct {
	Account         string
	Position        Decimal // UNSET_DECIMAL
	PositionDesired Decimal // UNSET_DECIMAL
	PositionAfter   Decimal // UNSET_DECIMAL
	DesiredAllocQty Decimal // UNSET_DECIMAL
	AllowedAllocQty Decimal // UNSET_DECIMAL
	IsMonetary      bool
}

OrderAllocation .

func NewOrderAllocation

func NewOrderAllocation() *OrderAllocation

func (OrderAllocation) String

func (oa OrderAllocation) String() string

type OrderCancel

type OrderCancel struct {
	ManualOrderCancelTime string
	ExtOperator           string
	ManualOrderIndicator  int64
}

OrderCancel .

func CancelOrderEmpty

func CancelOrderEmpty() OrderCancel

CancelOrderEmpty .

func CancelOrderWithManualTime

func CancelOrderWithManualTime(manualOrderCancelTime string) OrderCancel

CancelOrderWithManualTime .

func NewOrderCancel

func NewOrderCancel() OrderCancel

func OrderCancelWithCmeTaggingFields

func OrderCancelWithCmeTaggingFields(extOperator string, manualOrderIndicator int64) OrderCancel

OrderCancelWithCmeTaggingFields .

func (OrderCancel) String

func (o OrderCancel) String() string

type OrderComboLeg

type OrderComboLeg struct {
	Price float64 `default:"UNSET_FLOAT"`
}

OrderComboLeg .

func NewOrderComboLeg

func NewOrderComboLeg() OrderComboLeg

NewOrder creates a default OrderComboLeg.

func (OrderComboLeg) String

func (o OrderComboLeg) String() string

type OrderCondition

type OrderCondition interface {
	Type() OrderConditionType
	// contains filtered or unexported methods
}

func CreateOrderCondition

func CreateOrderCondition(condType OrderConditionType) OrderCondition

type OrderConditionType

type OrderConditionType = int64
const (
	PriceOrderCondition         OrderConditionType = 1
	TimeOrderCondition          OrderConditionType = 3
	MarginOrderCondition        OrderConditionType = 4
	ExecutionOrderCondition     OrderConditionType = 5
	VolumeOrderCondition        OrderConditionType = 6
	PercentChangeOrderCondition OrderConditionType = 7
)

type OrderDecoder

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

OrderDecoder .

type OrderID

type OrderID = int64

type OrderState

type OrderState struct {
	Status string

	InitMarginBefore     string
	MaintMarginBefore    string
	EquityWithLoanBefore string
	InitMarginChange     string
	MaintMarginChange    string
	EquityWithLoanChange string
	InitMarginAfter      string
	MaintMarginAfter     string
	EquityWithLoanAfter  string

	Commission                     float64 // UNSET_FLOAT
	MinCommission                  float64 // UNSET_FLOAT
	MaxCommission                  float64 // UNSET_FLOAT
	CommissionCurrency             string
	MarginCurrency                 string
	InitMarginBeforeOutsideRTH     float64 // UNSET_FLOAT
	MaintMarginBeforeOutsideRTH    float64 // UNSET_FLOAT
	EquityWithLoanBeforeOutsideRTH float64 // UNSET_FLOAT
	InitMarginChangeOutsideRTH     float64 // UNSET_FLOAT
	MaintMarginChangeOutsideRTH    float64 // UNSET_FLOAT
	EquityWithLoanChangeOutsideRTH float64 // UNSET_FLOAT
	InitMarginAfterOutsideRTH      float64 // UNSET_FLOAT
	MaintMarginAfterOutsideRTH     float64 // UNSET_FLOAT
	EquityWithLoanAfterOutsideRTH  float64 // UNSET_FLOAT
	SuggestedSize                  Decimal // UNSET_DECIMAL
	RejectReason                   string
	OrderAllocations               []*OrderAllocation
	WarningText                    string

	CompletedTime   string
	CompletedStatus string
}

OrderState .

func NewOrderState

func NewOrderState() *OrderState

func (OrderState) String

func (os OrderState) String() string

type PercentChangeCondition

type PercentChangeCondition struct {
	*ContractCondition
	ChangePercent float64
}

func NewPercentageChangeCondition

func NewPercentageChangeCondition(pctChange float64, conId int64, exchange string, isMore bool, isConjunction bool) *PercentChangeCondition

NewPercentageChangeCondition .

func (PercentChangeCondition) String

func (oc PercentChangeCondition) String() string

func (PercentChangeCondition) Type

func (oc PercentChangeCondition) Type() OrderConditionType

type PriceCondition

type PriceCondition struct {
	*ContractCondition
	Price         float64
	TriggerMethod int64
}

func NewPriceCondition

func NewPriceCondition(triggerMethod int64, conId int64, exchange string, price float64,
	isMore bool, isConjunction bool) *PriceCondition

NewPriceCondition .

func (PriceCondition) String

func (oc PriceCondition) String() string

func (PriceCondition) Type

func (oc PriceCondition) Type() OrderConditionType

type PriceIncrement

type PriceIncrement struct {
	LowEdge   float64
	Increment float64
}

PriceIncrement .

func NewPriceIncrement

func NewPriceIncrement() PriceIncrement

func (PriceIncrement) String

func (p PriceIncrement) String() string

type RealTimeBar

type RealTimeBar struct {
	Time    int64
	EndTime int64
	Open    float64
	High    float64
	Low     float64
	Close   float64
	Volume  Decimal
	Wap     Decimal
	Count   int64
}

RealTimeBar .

func NewRealTimeBar

func NewRealTimeBar() RealTimeBar

func (RealTimeBar) String

func (rb RealTimeBar) String() string

type ScanData

type ScanData struct {
	Rank            int64
	ContractDetails *ContractDetails
	Distance        string
	Benchmark       string
	Projection      string
	LegsStr         string
}

ScanData .

func (ScanData) String

func (s ScanData) String() string

type ScannerSubscription

type ScannerSubscription struct {
	NumberOfRows             int64 `default:"NO_ROW_NUMBER_SPECIFIED"`
	Instrument               string
	LocationCode             string
	ScanCode                 string
	AbovePrice               float64 `default:"UNSET_FLOAT"`
	BelowPrice               float64 `default:"UNSET_FLOAT"`
	AboveVolume              int64   `default:"UNSET_INT"`
	MarketCapAbove           float64 `default:"UNSET_FLOAT"`
	MarketCapBelow           float64 `default:"UNSET_FLOAT"`
	MoodyRatingAbove         string
	MoodyRatingBelow         string
	SpRatingAbove            string
	SpRatingBelow            string
	MaturityDateAbove        string
	MaturityDateBelow        string
	CouponRateAbove          float64 `default:"UNSET_FLOAT"`
	CouponRateBelow          float64 `default:"UNSET_FLOAT"`
	ExcludeConvertible       bool
	AverageOptionVolumeAbove int64 `default:"UNSET_INT"`
	ScannerSettingPairs      string
	StockTypeFilter          string
}

ScannerSubscription .

func ComplexOrdersAndTrades

func ComplexOrdersAndTrades() *ScannerSubscription

ComplexOrdersAndTrades . Complex orders and trades scan, latest trades

func HighOptVolumePCRatioUSIndexes

func HighOptVolumePCRatioUSIndexes() *ScannerSubscription

HighOptVolumePCRatioUSIndexes . High option volume P/C ratio US indexes

func HotUSStkByVolume

func HotUSStkByVolume() *ScannerSubscription

HotUSStkByVolume . Hot US stocks by volume

func MostActiveFutEurex

func MostActiveFutEurex() *ScannerSubscription

MostActiveFutEurex . Most active futures at EUREX

func NewScannerSubscription

func NewScannerSubscription() *ScannerSubscription

NewScannerSubscription creates a default ScannerSubscription.

func TopPercentGainersIbis

func TopPercentGainersIbis() *ScannerSubscription

TopPercentGainersIbis . Top % gainers at IBIS

func (ScannerSubscription) String

func (s ScannerSubscription) String() string

type SmartComponent

type SmartComponent struct {
	BitNumber      int64
	Exchange       string
	ExchangeLetter string
}

SmartComponent .

func NewSmartComponent

func NewSmartComponent() SmartComponent

func (SmartComponent) String

func (s SmartComponent) String() string

type SoftDollarTier

type SoftDollarTier struct {
	Name        string
	Value       string
	DisplayName string
}

SoftDollarTier stores the Soft Dollar Tier information.

func NewSoftDollarTier

func NewSoftDollarTier() SoftDollarTier

func (SoftDollarTier) String

func (s SoftDollarTier) String() string

type TagValue

type TagValue struct {
	Tag   string
	Value string
}

TagValue maps a tag to a value. Both of them are strings. They are used in a slice to convey extra info with the requests.

func NewTagValue

func NewTagValue() TagValue

func (TagValue) String

func (tv TagValue) String() string

type TickAttrib

type TickAttrib struct {
	CanAutoExecute bool
	PastLimit      bool
	PreOpen        bool
}

TickAttrib .

func NewTickAttrib

func NewTickAttrib() TickAttrib

func (TickAttrib) String

func (t TickAttrib) String() string

type TickAttribBidAsk

type TickAttribBidAsk struct {
	BidPastLow  bool
	AskPastHigh bool
}

TickAttribBidAsk .

func NewTickAttribBidAsk

func NewTickAttribBidAsk() TickAttribBidAsk

func (TickAttribBidAsk) String

func (t TickAttribBidAsk) String() string

type TickAttribLast

type TickAttribLast struct {
	PastLimit  bool
	Unreported bool
}

TickAttribLast .

func NewTickAttribLast

func NewTickAttribLast() TickAttribLast

func (TickAttribLast) String

func (t TickAttribLast) String() string

type TickType

type TickType = int64

TickType is the type of ticks.

const (
	BID_SIZE TickType = iota
	BID
	ASK
	ASK_SIZE
	LAST
	LAST_SIZE
	HIGH
	LOW
	VOLUME
	CLOSE
	BID_OPTION_COMPUTATION
	ASK_OPTION_COMPUTATION
	LAST_OPTION_COMPUTATION
	MODEL_OPTION
	OPEN
	LOW_13_WEEK
	HIGH_13_WEEK
	LOW_26_WEEK
	HIGH_26_WEEK
	LOW_52_WEEK
	HIGH_52_WEEK
	AVG_VOLUME
	OPEN_INTEREST
	OPTION_HISTORICAL_VOL
	OPTION_IMPLIED_VOL
	OPTION_BID_EXCH
	OPTION_ASK_EXCH
	OPTION_CALL_OPEN_INTEREST
	OPTION_PUT_OPEN_INTEREST
	OPTION_CALL_VOLUME
	OPTION_PUT_VOLUME
	INDEX_FUTURE_PREMIUM
	BID_EXCH
	ASK_EXCH
	AUCTION_VOLUME
	AUCTION_PRICE
	AUCTION_IMBALANCE
	MARK_PRICE
	BID_EFP_COMPUTATION
	ASK_EFP_COMPUTATION
	LAST_EFP_COMPUTATION
	OPEN_EFP_COMPUTATION
	HIGH_EFP_COMPUTATION
	LOW_EFP_COMPUTATION
	CLOSE_EFP_COMPUTATION
	LAST_TIMESTAMP
	SHORTABLE
	FUNDAMENTAL_RATIOS
	RT_VOLUME
	HALTED
	BID_YIELD
	ASK_YIELD
	LAST_YIELD
	CUST_OPTION_COMPUTATION
	TRADE_COUNT
	TRADE_RATE
	VOLUME_RATE
	LAST_RTH_TRADE
	RT_HISTORICAL_VOL
	IB_DIVIDENDS
	BOND_FACTOR_MULTIPLIER
	REGULATORY_IMBALANCE
	NEWS_TICK
	SHORT_TERM_VOLUME_3_MIN
	SHORT_TERM_VOLUME_5_MIN
	SHORT_TERM_VOLUME_10_MIN
	DELAYED_BID
	DELAYED_ASK
	DELAYED_LAST
	DELAYED_BID_SIZE
	DELAYED_ASK_SIZE
	DELAYED_LAST_SIZE
	DELAYED_HIGH
	DELAYED_LOW
	DELAYED_VOLUME
	DELAYED_CLOSE
	DELAYED_OPEN
	RT_TRD_VOLUME
	CREDITMAN_MARK_PRICE
	CREDITMAN_SLOW_MARK_PRICE
	DELAYED_BID_OPTION
	DELAYED_ASK_OPTION
	DELAYED_LAST_OPTION
	DELAYED_MODEL_OPTION
	LAST_EXCH
	LAST_REG_TIME
	FUTURES_OPEN_INTEREST
	AVG_OPT_VOLUME
	DELAYED_LAST_TIMESTAMP
	SHORTABLE_SHARES
	DELAYED_HALTED
	REUTERS_2_MUTUAL_FUNDS
	ETF_NAV_CLOSE
	ETF_NAV_PRIOR_CLOSE
	ETF_NAV_BID
	ETF_NAV_ASK
	ETF_NAV_LAST
	ETF_FROZEN_NAV_LAST
	ETF_NAV_HIGH
	ETF_NAV_LOW
	SOCIAL_MARKET_ANALYTICS
	ESTIMATED_IPO_MIDPOINT
	FINAL_IPO_LAST
	DELAYED_YIELD_BID
	DELAYED_YIELD_ASK
	NOT_SET
)

type TickerID

type TickerID = int64

type TimeCondition

type TimeCondition struct {
	*OperatorCondition
	Time string
}

func NewTimeCondition

func NewTimeCondition(time string, isMore bool, isConjunction bool) *TimeCondition

NewTimeCondition .

func (TimeCondition) String

func (oc TimeCondition) String() string

func (TimeCondition) Type

func (oc TimeCondition) Type() OrderConditionType

type Version

type Version = int

Version is the server version

const (
	// MIN_SERVER_VER_REAL_TIME_BARS              Version = 34
	// MIN_SERVER_VER_SCALE_ORDERS                Version = 35
	// MIN_SERVER_VER_SNAPSHOT_MKT_DATA           Version = 35
	// MIN_SERVER_VER_SSHORT_COMBO_LEGS           Version = 35
	// MIN_SERVER_VER_WHAT_IF_ORDERS              Version = 36
	// MIN_SERVER_VER_CONTRACT_CONID              Version = 37
	MIN_SERVER_VER_PTA_ORDERS                         Version = 39
	MIN_SERVER_VER_FUNDAMENTAL_DATA                   Version = 40
	MIN_SERVER_VER_DELTA_NEUTRAL                      Version = 40
	MIN_SERVER_VER_CONTRACT_DATA_CHAIN                Version = 40
	MIN_SERVER_VER_SCALE_ORDERS2                      Version = 40
	MIN_SERVER_VER_ALGO_ORDERS                        Version = 41
	MIN_SERVER_VER_EXECUTION_DATA_CHAIN               Version = 42
	MIN_SERVER_VER_NOT_HELD                           Version = 44
	MIN_SERVER_VER_SEC_ID_TYPE                        Version = 45
	MIN_SERVER_VER_PLACE_ORDER_CONID                  Version = 46
	MIN_SERVER_VER_REQ_MKT_DATA_CONID                 Version = 47
	MIN_SERVER_VER_REQ_CALC_IMPLIED_VOLAT             Version = 49
	MIN_SERVER_VER_REQ_CALC_OPTION_PRICE              Version = 50
	MIN_SERVER_VER_CANCEL_CALC_IMPLIED_VOLAT          Version = 50
	MIN_SERVER_VER_CANCEL_CALC_OPTION_PRICE           Version = 50
	MIN_SERVER_VER_SSHORTX_OLD                        Version = 51
	MIN_SERVER_VER_SSHORTX                            Version = 52
	MIN_SERVER_VER_REQ_GLOBAL_CANCEL                  Version = 53
	MIN_SERVER_VER_HEDGE_ORDERS                       Version = 54
	MIN_SERVER_VER_REQ_MARKET_DATA_TYPE               Version = 55
	MIN_SERVER_VER_OPT_OUT_SMART_ROUTING              Version = 56
	MIN_SERVER_VER_SMART_COMBO_ROUTING_PARAMS         Version = 57
	MIN_SERVER_VER_DELTA_NEUTRAL_CONID                Version = 58
	MIN_SERVER_VER_SCALE_ORDERS3                      Version = 60
	MIN_SERVER_VER_ORDER_COMBO_LEGS_PRICE             Version = 61
	MIN_SERVER_VER_TRAILING_PERCENT                   Version = 62
	MIN_SERVER_VER_DELTA_NEUTRAL_OPEN_CLOSE           Version = 66
	MIN_SERVER_VER_POSITIONS                          Version = 67
	MIN_SERVER_VER_ACCOUNT_SUMMARY                    Version = 67
	MIN_SERVER_VER_TRADING_CLASS                      Version = 68
	MIN_SERVER_VER_SCALE_TABLE                        Version = 69
	MIN_SERVER_VER_LINKING                            Version = 70
	MIN_SERVER_VER_ALGO_ID                            Version = 71
	MIN_SERVER_VER_OPTIONAL_CAPABILITIES              Version = 72
	MIN_SERVER_VER_ORDER_SOLICITED                    Version = 73
	MIN_SERVER_VER_LINKING_AUTH                       Version = 74
	MIN_SERVER_VER_PRIMARYEXCH                        Version = 75
	MIN_SERVER_VER_RANDOMIZE_SIZE_AND_PRICE           Version = 76
	MIN_SERVER_VER_FRACTIONAL_POSITIONS               Version = 101
	MIN_SERVER_VER_PEGGED_TO_BENCHMARK                Version = 102
	MIN_SERVER_VER_MODELS_SUPPORT                     Version = 103
	MIN_SERVER_VER_SEC_DEF_OPT_PARAMS_REQ             Version = 104
	MIN_SERVER_VER_EXT_OPERATOR                       Version = 105
	MIN_SERVER_VER_SOFT_DOLLAR_TIER                   Version = 106
	MIN_SERVER_VER_REQ_FAMILY_CODES                   Version = 107
	MIN_SERVER_VER_REQ_MATCHING_SYMBOLS               Version = 108
	MIN_SERVER_VER_PAST_LIMIT                         Version = 109
	MIN_SERVER_VER_MD_SIZE_MULTIPLIER                 Version = 110
	MIN_SERVER_VER_CASH_QTY                           Version = 111
	MIN_SERVER_VER_REQ_MKT_DEPTH_EXCHANGES            Version = 112
	MIN_SERVER_VER_TICK_NEWS                          Version = 113
	MIN_SERVER_VER_REQ_SMART_COMPONENTS               Version = 114
	MIN_SERVER_VER_REQ_NEWS_PROVIDERS                 Version = 115
	MIN_SERVER_VER_REQ_NEWS_ARTICLE                   Version = 116
	MIN_SERVER_VER_REQ_HISTORICAL_NEWS                Version = 117
	MIN_SERVER_VER_REQ_HEAD_TIMESTAMP                 Version = 118
	MIN_SERVER_VER_REQ_HISTOGRAM                      Version = 119
	MIN_SERVER_VER_SERVICE_DATA_TYPE                  Version = 120
	MIN_SERVER_VER_AGG_GROUP                          Version = 121
	MIN_SERVER_VER_UNDERLYING_INFO                    Version = 122
	MIN_SERVER_VER_CANCEL_HEADTIMESTAMP               Version = 123
	MIN_SERVER_VER_SYNT_REALTIME_BARS                 Version = 124
	MIN_SERVER_VER_CFD_REROUTE                        Version = 125
	MIN_SERVER_VER_MARKET_RULES                       Version = 126
	MIN_SERVER_VER_PNL                                Version = 127
	MIN_SERVER_VER_NEWS_QUERY_ORIGINS                 Version = 128
	MIN_SERVER_VER_UNREALIZED_PNL                     Version = 129
	MIN_SERVER_VER_HISTORICAL_TICKS                   Version = 130
	MIN_SERVER_VER_MARKET_CAP_PRICE                   Version = 131
	MIN_SERVER_VER_PRE_OPEN_BID_ASK                   Version = 132
	MIN_SERVER_VER_REAL_EXPIRATION_DATE               Version = 134
	MIN_SERVER_VER_REALIZED_PNL                       Version = 135
	MIN_SERVER_VER_LAST_LIQUIDITY                     Version = 136
	MIN_SERVER_VER_TICK_BY_TICK                       Version = 137
	MIN_SERVER_VER_DECISION_MAKER                     Version = 138
	MIN_SERVER_VER_MIFID_EXECUTION                    Version = 139
	MIN_SERVER_VER_TICK_BY_TICK_IGNORE_SIZE           Version = 140
	MIN_SERVER_VER_AUTO_PRICE_FOR_HEDGE               Version = 141
	MIN_SERVER_VER_WHAT_IF_EXT_FIELDS                 Version = 142
	MIN_SERVER_VER_SCANNER_GENERIC_OPTS               Version = 143
	MIN_SERVER_VER_API_BIND_ORDER                     Version = 144
	MIN_SERVER_VER_ORDER_CONTAINER                    Version = 145
	MIN_SERVER_VER_SMART_DEPTH                        Version = 146
	MIN_SERVER_VER_REMOVE_NULL_ALL_CASTING            Version = 147
	MIN_SERVER_VER_D_PEG_ORDERS                       Version = 148
	MIN_SERVER_VER_MKT_DEPTH_PRIM_EXCHANGE            Version = 149
	MIN_SERVER_VER_COMPLETED_ORDERS                   Version = 150
	MIN_SERVER_VER_PRICE_MGMT_ALGO                    Version = 151
	MIN_SERVER_VER_STOCK_TYPE                         Version = 152
	MIN_SERVER_VER_ENCODE_MSG_ASCII7                  Version = 153
	MIN_SERVER_VER_SEND_ALL_FAMILY_CODES              Version = 154
	MIN_SERVER_VER_NO_DEFAULT_OPEN_CLOSE              Version = 155
	MIN_SERVER_VER_PRICE_BASED_VOLATILITY             Version = 156
	MIN_SERVER_VER_REPLACE_FA_END                     Version = 157
	MIN_SERVER_VER_DURATION                           Version = 158
	MIN_SERVER_VER_MARKET_DATA_IN_SHARES              Version = 159
	MIN_SERVER_VER_POST_TO_ATS                        Version = 160
	MIN_SERVER_VER_WSHE_CALENDAR                      Version = 161
	MIN_SERVER_VER_AUTO_CANCEL_PARENT                 Version = 162
	MIN_SERVER_VER_FRACTIONAL_SIZE_SUPPORT            Version = 163
	MIN_SERVER_VER_SIZE_RULES                         Version = 164
	MIN_SERVER_VER_HISTORICAL_SCHEDULE                Version = 165
	MIN_SERVER_VER_ADVANCED_ORDER_REJECT              Version = 166
	MIN_SERVER_VER_USER_INFO                          Version = 167
	MIN_SERVER_VER_CRYPTO_AGGREGATED_TRADES           Version = 168
	MIN_SERVER_VER_PEGBEST_PEGMID_OFFSETS             Version = 170
	MIN_SERVER_VER_WSH_EVENT_DATA_FILTERS             Version = 171
	MIN_SERVER_VER_IPO_PRICES                         Version = 172
	MIN_SERVER_VER_WSH_EVENT_DATA_FILTERS_DATE        Version = 173
	MIN_SERVER_VER_INSTRUMENT_TIMEZONE                Version = 174
	MIN_SERVER_VER_HMDS_MARKET_DATA_IN_SHARES         Version = 175
	MIN_SERVER_VER_MANUAL_ORDER_TIME                  Version = 169
	MIN_SERVER_VER_BOND_ISSUERID                      Version = 176
	MIN_SERVER_VER_FA_PROFILE_DESUPPORT               Version = 177
	MIN_SERVER_VER_PENDING_PRICE_REVISION             Version = 178
	MIN_SERVER_VER_FUND_DATA_FIELDS                   Version = 179
	MIN_SERVER_VER_MANUAL_ORDER_TIME_EXERCISE_OPTIONS Version = 180
	MIN_SERVER_VER_OPEN_ORDER_AD_STRATEGY             Version = 181
	MIN_SERVER_VER_LAST_TRADE_DATE                    Version = 182
	MIN_SERVER_VER_CUSTOMER_ACCOUNT                   Version = 183
	MIN_SERVER_VER_PROFESSIONAL_CUSTOMER              Version = 184
	MIN_SERVER_VER_BOND_ACCRUED_INTEREST              Version = 185
	MIN_SERVER_VER_INELIGIBILITY_REASONS              Version = 186
	MIN_SERVER_VER_RFQ_FIELDS                         Version = 187
	MIN_SERVER_VER_BOND_TRADING_HOURS                 Version = 188
	MIN_SERVER_VER_INCLUDE_OVERNIGHT                  Version = 189
	MIN_SERVER_VER_UNDO_RFQ_FIELDS                    Version = 190
	MIN_SERVER_VER_PERM_ID_AS_LONG                    Version = 191
	MIN_SERVER_VER_CME_TAGGING_FIELDS                 Version = 192
	MIN_SERVER_VER_CME_TAGGING_FIELDS_IN_OPEN_ORDER   Version = 193
	MIN_SERVER_VER_ERROR_TIME                         Version = 194
	MIN_SERVER_VER_FULL_ORDER_PREVIEW_FIELDS          Version = 195

	MIN_CLIENT_VER = 100
	MAX_CLIENT_VER = MIN_SERVER_VER_FULL_ORDER_PREVIEW_FIELDS
)

type VolumeCondition

type VolumeCondition struct {
	*ContractCondition
	Volume int64
}

func NewVolumeCondition

func NewVolumeCondition(conId int64, exchange string, isMore bool, volume int64,
	isConjunction bool) *VolumeCondition

VolumeConditionOrder .

func (VolumeCondition) String

func (oc VolumeCondition) String() string

func (VolumeCondition) Type

func (oc VolumeCondition) Type() OrderConditionType

type Wrapper

type Wrapper struct {
}

Wrapper is the default implementation of the EWrapper interface.

func (Wrapper) AccountDownloadEnd

func (w Wrapper) AccountDownloadEnd(accountName string)

func (Wrapper) AccountSummary

func (w Wrapper) AccountSummary(reqID int64, account string, tag string, value string, currency string)

func (Wrapper) AccountSummaryEnd

func (w Wrapper) AccountSummaryEnd(reqID int64)

func (Wrapper) AccountUpdateMulti

func (w Wrapper) AccountUpdateMulti(reqID int64, account string, modelCode string, key string, value string, currency string)

func (Wrapper) AccountUpdateMultiEnd

func (w Wrapper) AccountUpdateMultiEnd(reqID int64)

func (Wrapper) BondContractDetails

func (w Wrapper) BondContractDetails(reqID int64, contractDetails *ContractDetails)

func (Wrapper) CommissionReport

func (w Wrapper) CommissionReport(commissionReport CommissionReport)

func (Wrapper) CompletedOrder

func (w Wrapper) CompletedOrder(contract *Contract, order *Order, orderState *OrderState)

func (Wrapper) CompletedOrdersEnd

func (w Wrapper) CompletedOrdersEnd()

func (Wrapper) ConnectAck

func (w Wrapper) ConnectAck()

func (Wrapper) ConnectionClosed

func (w Wrapper) ConnectionClosed()

func (Wrapper) ContractDetails

func (w Wrapper) ContractDetails(reqID int64, contractDetails *ContractDetails)

func (Wrapper) ContractDetailsEnd

func (w Wrapper) ContractDetailsEnd(reqID int64)

func (Wrapper) CurrentTime

func (w Wrapper) CurrentTime(t int64)

func (Wrapper) DeltaNeutralValidation

func (w Wrapper) DeltaNeutralValidation(reqID int64, deltaNeutralContract DeltaNeutralContract)

func (Wrapper) DisplayGroupList

func (w Wrapper) DisplayGroupList(reqID int64, groups string)

func (Wrapper) DisplayGroupUpdated

func (w Wrapper) DisplayGroupUpdated(reqID int64, contractInfo string)

func (Wrapper) Error

func (w Wrapper) Error(reqID TickerID, errorTime int64, errCode int64, errString string, advancedOrderRejectJson string)

func (Wrapper) ExecDetails

func (w Wrapper) ExecDetails(reqID int64, contract *Contract, execution *Execution)

func (Wrapper) ExecDetailsEnd

func (w Wrapper) ExecDetailsEnd(reqID int64)

func (Wrapper) FamilyCodes

func (w Wrapper) FamilyCodes(familyCodes []FamilyCode)

func (Wrapper) FundamentalData

func (w Wrapper) FundamentalData(reqID int64, data string)

func (Wrapper) HeadTimestamp

func (w Wrapper) HeadTimestamp(reqID int64, headTimestamp string)

func (Wrapper) HistogramData

func (w Wrapper) HistogramData(reqID int64, data []HistogramData)

func (Wrapper) HistoricalData

func (w Wrapper) HistoricalData(reqID int64, bar *Bar)

func (Wrapper) HistoricalDataEnd

func (w Wrapper) HistoricalDataEnd(reqID int64, startDateStr string, endDateStr string)

func (Wrapper) HistoricalDataUpdate

func (w Wrapper) HistoricalDataUpdate(reqID int64, bar *Bar)

func (Wrapper) HistoricalNews

func (w Wrapper) HistoricalNews(requestID int64, time string, providerCode string, articleID string, headline string)

func (Wrapper) HistoricalNewsEnd

func (w Wrapper) HistoricalNewsEnd(requestID int64, hasMore bool)

func (Wrapper) HistoricalSchedule

func (w Wrapper) HistoricalSchedule(reqID int64, startDarteTime, endDateTime, timeZone string, sessions []HistoricalSession)

func (Wrapper) HistoricalTicks

func (w Wrapper) HistoricalTicks(reqID int64, ticks []HistoricalTick, done bool)

func (Wrapper) HistoricalTicksBidAsk

func (w Wrapper) HistoricalTicksBidAsk(reqID int64, ticks []HistoricalTickBidAsk, done bool)

func (Wrapper) HistoricalTicksLast

func (w Wrapper) HistoricalTicksLast(reqID int64, ticks []HistoricalTickLast, done bool)

func (Wrapper) ManagedAccounts

func (w Wrapper) ManagedAccounts(accountsList []string)

func (Wrapper) MarketDataType

func (w Wrapper) MarketDataType(reqID int64, marketDataType int64)

func (Wrapper) MarketRule

func (w Wrapper) MarketRule(marketRuleID int64, priceIncrements []PriceIncrement)

func (Wrapper) MktDepthExchanges

func (w Wrapper) MktDepthExchanges(depthMktDataDescriptions []DepthMktDataDescription)

func (Wrapper) NewsArticle

func (w Wrapper) NewsArticle(requestID int64, articleType int64, articleText string)

func (Wrapper) NewsProviders

func (w Wrapper) NewsProviders(newsProviders []NewsProvider)

func (Wrapper) NextValidID

func (w Wrapper) NextValidID(reqID int64)

func (Wrapper) OpenOrder

func (w Wrapper) OpenOrder(orderID OrderID, contract *Contract, order *Order, orderState *OrderState)

func (Wrapper) OpenOrderEnd

func (w Wrapper) OpenOrderEnd()

func (Wrapper) OrderBound

func (w Wrapper) OrderBound(permID int64, clientID int64, orderID int64)

func (Wrapper) OrderStatus

func (w Wrapper) OrderStatus(orderID OrderID, status string, filled Decimal, remaining Decimal, avgFillPrice float64, permID int64, parentID int64, lastFillPrice float64, clientID int64, whyHeld string, mktCapPrice float64)

func (Wrapper) Pnl

func (w Wrapper) Pnl(reqID int64, dailyPnL float64, unrealizedPnL float64, realizedPnL float64)

func (Wrapper) PnlSingle

func (w Wrapper) PnlSingle(reqID int64, pos Decimal, dailyPnL float64, unrealizedPnL float64, realizedPnL float64, value float64)

func (Wrapper) Position

func (w Wrapper) Position(account string, contract *Contract, position Decimal, avgCost float64)

func (Wrapper) PositionEnd

func (w Wrapper) PositionEnd()

func (Wrapper) PositionMulti

func (w Wrapper) PositionMulti(reqID int64, account string, modelCode string, contract *Contract, pos Decimal, avgCost float64)

func (Wrapper) PositionMultiEnd

func (w Wrapper) PositionMultiEnd(reqID int64)

func (Wrapper) RealtimeBar

func (w Wrapper) RealtimeBar(reqID int64, time int64, open float64, high float64, low float64, close float64, volume Decimal, wap Decimal, count int64)

func (Wrapper) ReceiveFA

func (w Wrapper) ReceiveFA(faDataType FaDataType, cxml string)

func (Wrapper) ReplaceFAEnd

func (w Wrapper) ReplaceFAEnd(reqID int64, text string)

func (Wrapper) RerouteMktDataReq

func (w Wrapper) RerouteMktDataReq(reqID int64, conID int64, exchange string)

func (Wrapper) RerouteMktDepthReq

func (w Wrapper) RerouteMktDepthReq(reqID int64, conID int64, exchange string)

func (Wrapper) ScannerData

func (w Wrapper) ScannerData(reqID int64, rank int64, contractDetails *ContractDetails, distance string, benchmark string, projection string, legsStr string)

func (Wrapper) ScannerDataEnd

func (w Wrapper) ScannerDataEnd(reqID int64)

func (Wrapper) ScannerParameters

func (w Wrapper) ScannerParameters(xml string)

func (Wrapper) SecurityDefinitionOptionParameter

func (w Wrapper) SecurityDefinitionOptionParameter(reqID int64, exchange string, underlyingConID int64, tradingClass string, multiplier string, expirations []string, strikes []float64)

func (Wrapper) SecurityDefinitionOptionParameterEnd

func (w Wrapper) SecurityDefinitionOptionParameterEnd(reqID int64)

func (Wrapper) SmartComponents

func (w Wrapper) SmartComponents(reqID int64, smartComponents []SmartComponent)

func (Wrapper) SoftDollarTiers

func (w Wrapper) SoftDollarTiers(reqID int64, tiers []SoftDollarTier)

func (Wrapper) SymbolSamples

func (w Wrapper) SymbolSamples(reqID int64, contractDescriptions []ContractDescription)

func (Wrapper) TickByTickAllLast

func (w Wrapper) TickByTickAllLast(reqID int64, tickType int64, time int64, price float64, size Decimal, tickAttribLast TickAttribLast, exchange string, specialConditions string)

func (Wrapper) TickByTickBidAsk

func (w Wrapper) TickByTickBidAsk(reqID int64, time int64, bidPrice float64, askPrice float64, bidSize Decimal, askSize Decimal, tickAttribBidAsk TickAttribBidAsk)

func (Wrapper) TickByTickMidPoint

func (w Wrapper) TickByTickMidPoint(reqID int64, time int64, midPoint float64)

func (Wrapper) TickEFP

func (w Wrapper) TickEFP(reqID TickerID, tickType TickType, basisPoints float64, formattedBasisPoints string, totalDividends float64, holdDays int64, futureLastTradeDate string, dividendImpact float64, dividendsToLastTradeDate float64)

func (Wrapper) TickGeneric

func (w Wrapper) TickGeneric(reqID TickerID, tickType TickType, value float64)

func (Wrapper) TickNews

func (w Wrapper) TickNews(TickerID TickerID, timeStamp int64, providerCode string, articleID string, headline string, extraData string)

func (Wrapper) TickOptionComputation

func (w Wrapper) TickOptionComputation(reqID TickerID, tickType TickType, tickAttrib int64, impliedVol float64, delta float64, optPrice float64, pvDividend float64, gamma float64, vega float64, theta float64, undPrice float64)

func (Wrapper) TickPrice

func (w Wrapper) TickPrice(reqID TickerID, tickType TickType, price float64, attrib TickAttrib)

func (Wrapper) TickReqParams

func (w Wrapper) TickReqParams(TickerID TickerID, minTick float64, bboExchange string, snapshotPermissions int64)

func (Wrapper) TickSize

func (w Wrapper) TickSize(reqID TickerID, tickType TickType, size Decimal)

func (Wrapper) TickSnapshotEnd

func (w Wrapper) TickSnapshotEnd(reqID int64)

func (Wrapper) TickString

func (w Wrapper) TickString(reqID TickerID, tickType TickType, value string)

func (Wrapper) UpdateAccountTime

func (w Wrapper) UpdateAccountTime(timeStamp string)

func (Wrapper) UpdateAccountValue

func (w Wrapper) UpdateAccountValue(tag string, value string, currency string, accountName string)

func (Wrapper) UpdateMktDepth

func (w Wrapper) UpdateMktDepth(TickerID TickerID, position int64, operation int64, side int64, price float64, size Decimal)

func (Wrapper) UpdateMktDepthL2

func (w Wrapper) UpdateMktDepthL2(TickerID TickerID, position int64, marketMaker string, operation int64, side int64, price float64, size Decimal, isSmartDepth bool)

func (Wrapper) UpdateNewsBulletin

func (w Wrapper) UpdateNewsBulletin(msgID int64, msgType int64, newsMessage string, originExch string)

func (Wrapper) UpdatePortfolio

func (w Wrapper) UpdatePortfolio(contract *Contract, position Decimal, marketPrice float64, marketValue float64, averageCost float64, unrealizedPNL float64, realizedPNL float64, accountName string)

func (Wrapper) UserInfo

func (w Wrapper) UserInfo(reqID int64, whiteBrandingId string)

func (Wrapper) VerifyAndAuthCompleted

func (w Wrapper) VerifyAndAuthCompleted(isSuccessful bool, errorText string)

func (Wrapper) VerifyAndAuthMessageAPI

func (w Wrapper) VerifyAndAuthMessageAPI(apiData string, xyzChallange string)

func (Wrapper) VerifyCompleted

func (w Wrapper) VerifyCompleted(isSuccessful bool, errorText string)

func (Wrapper) VerifyMessageAPI

func (w Wrapper) VerifyMessageAPI(apiData string)

func (Wrapper) WinError

func (w Wrapper) WinError(text string, lastError int64)

func (Wrapper) WshEventData

func (w Wrapper) WshEventData(reqID int64, dataJson string)

func (Wrapper) WshMetaData

func (w Wrapper) WshMetaData(reqID int64, dataJson string)

type WshEventData

type WshEventData struct {
	ConID           int64
	Filter          string
	FillWatchList   bool
	FillPortfolio   bool
	FillCompetitors bool
	StartDate       string
	EndDate         string
	TotalLimit      int64
}

WshEventData .

func NewWshEventData

func NewWshEventData() WshEventData

func (WshEventData) String

func (w WshEventData) String() string

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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