Contracts

Contract

Purpose

Retrieves matching contracts and unwraps the response item list. The client unwraps the server items envelope.

Signature

func (c *TradeClient) Contract(symbol, secType string) ([]model.Contract, error)

Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.

Parameters

ParameterTypeRequiredSDK defaultConstraints
symbolstringYesNoneInstrument or underlying symbol
secTypestringYesNoneSecurity type; see the SecurityType enum

Returns

([]model.Contract, error). Key fields from model.Contract:

FieldTypeDescription
ContractIdint64Contract ID
SymbolstringSymbol code
SecTypestringSecurity type
CurrencystringCurrency
ExchangestringExchange
ExpirystringExpiry date
Strikefloat64Strike price
RightstringOption right (PUT/CALL)
Multiplierfloat64Contract multiplier
IdentifierstringIdentifier
NamestringName
MarketstringMarket
TradeableboolWhether tradeable
Conidint64Internal contract ID
ShortMarginfloat64Short margin ratio
ShortInitialMarginfloat64Short initial margin ratio
ShortMaintenanceMarginfloat64Short maintenance margin ratio
LongInitialMarginfloat64Long initial margin
LongMaintenanceMarginfloat64Long maintenance margin
TickSizes[]TickSizeMinimum-tick price ranges
LotSizefloat64Lot size
PrimaryExchangestringPrimary exchange
LocalSymbolstringLocal symbol
TradingClassstringTrading class
StatusintStatus
MarginableboolWhether marginable
ShortableboolWhether shortable
CloseOnlyboolWhether close-only
IsEtfboolWhether an ETF
SupportOvernightTradingboolWhether overnight trading is supported
SupportFractionalShareboolWhether fractional shares are supported
TickSize fieldTypeDescription
BeginstringRange start
EndstringRange end; may be Infinity
TickSizefloat64Minimum tick
TypestringRange type (CLOSED/OPEN)

Invocation example

result, err := tc.Contract("AAPL", "STK")
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)
{
  "symbol": "AAPL",
  "name": "Apple Inc",
  "secType": "STK",
  "exchange": "NASDAQ",
  "market": "US",
  "currency": "USD",
  "lotSize": 1,
  "minTick": 0.01,
  "contractId": 756733,
  "status": "NORMAL"
}

Rate limit

The base rate limit is 60 requests/min. Contract and Contract3 both use contract and share this quota.


Contract3

Purpose

Retrieves one contract through API version 3.0. The client uses an explicit API version.

Signature

func (c *TradeClient) Contract3(symbol, secType string) (*model.Contract, error)

Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.

Parameters

ParameterTypeRequiredSDK defaultConstraints
symbolstringYesNoneInstrument or underlying symbol
secTypestringYesNoneSecurity type; see the SecurityType enum

Returns

(*model.Contract, error). Key fields from model.Contract:

FieldTypeDescription
ContractIdint64Contract ID
SymbolstringSymbol code
SecTypestringSecurity type
CurrencystringCurrency
ExchangestringExchange
ExpirystringExpiry date
Strikefloat64Strike price
RightstringOption right (PUT/CALL)
Multiplierfloat64Contract multiplier
IdentifierstringIdentifier
NamestringName
MarketstringMarket
TradeableboolWhether tradeable
Conidint64Internal contract ID
ShortMarginfloat64Short margin ratio
ShortInitialMarginfloat64Short initial margin ratio
ShortMaintenanceMarginfloat64Short maintenance margin ratio
LongInitialMarginfloat64Long initial margin
LongMaintenanceMarginfloat64Long maintenance margin
TickSizes[]TickSizeMinimum-tick price ranges
LotSizefloat64Lot size
PrimaryExchangestringPrimary exchange
LocalSymbolstringLocal symbol
TradingClassstringTrading class
StatusintStatus
MarginableboolWhether marginable
ShortableboolWhether shortable
CloseOnlyboolWhether close-only
IsEtfboolWhether an ETF
SupportOvernightTradingboolWhether overnight trading is supported
SupportFractionalShareboolWhether fractional shares are supported

TickSize fields

FieldTypeDescription
BeginstringBegin value
EndstringEnd value
TickSizefloat64Tick size value
TypestringRange type (CLOSED/OPEN)

Invocation example

result, err := tc.Contract3("AAPL", "STK")
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)
{
  "symbol": "AAPL",
  "name": "Apple Inc",
  "secType": "STK",
  "exchange": "NASDAQ",
  "market": "US",
  "currency": "USD",
  "lotSize": 1,
  "minTick": 0.01,
  "contractId": 756733,
  "status": "NORMAL",
  "shortableCount": 1500000,
  "marginable": true
}

Rate limit

The base rate limit is 60 requests/min. Contract and Contract3 both use contract and share this quota.


Contracts

Purpose

Retrieves contracts for multiple symbols. The client unwraps the server items envelope.

Signature

func (c *TradeClient) Contracts(symbols []string, secType string) ([]model.Contract, error)

Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.

Parameters

ParameterTypeRequiredSDK defaultConstraints
symbols[]stringYesNoneInstrument symbols; the SDK does not enforce a batch limit
secTypestringYesNoneSecurity type; see the SecurityType enum

Returns

([]model.Contract, error). Key fields from model.Contract:

FieldTypeDescription
ContractIdint64Contract ID
SymbolstringSymbol code
SecTypestringSecurity type
CurrencystringCurrency
ExchangestringExchange
ExpirystringExpiry date
Strikefloat64Strike price
RightstringOption right (PUT/CALL)
Multiplierfloat64Contract multiplier
IdentifierstringIdentifier
NamestringName
MarketstringMarket
TradeableboolWhether tradeable
Conidint64Internal contract ID
ShortMarginfloat64Short margin ratio
ShortInitialMarginfloat64Short initial margin ratio
ShortMaintenanceMarginfloat64Short maintenance margin ratio
LongInitialMarginfloat64Long initial margin
LongMaintenanceMarginfloat64Long maintenance margin
TickSizes[]TickSizeMinimum-tick price ranges
LotSizefloat64Lot size
PrimaryExchangestringPrimary exchange
LocalSymbolstringLocal symbol
TradingClassstringTrading class
StatusintStatus
MarginableboolWhether marginable
ShortableboolWhether shortable
CloseOnlyboolWhether close-only
IsEtfboolWhether an ETF
SupportOvernightTradingboolWhether overnight trading is supported
SupportFractionalShareboolWhether fractional shares are supported

TickSize fields

FieldTypeDescription
BeginstringBegin value
EndstringEnd value
TickSizefloat64Tick size value
TypestringRange type (CLOSED/OPEN)

Invocation example

result, err := tc.Contracts([]string{"AAPL"}, "STK")
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)
[
  {
    "symbol": "AAPL",
    "name": "Apple Inc",
    "secType": "STK",
    "exchange": "NASDAQ",
    "market": "US",
    "currency": "USD",
    "lotSize": 1,
    "minTick": 0.01,
    "contractId": 756733,
    "status": "NORMAL"
  },
  {
    "symbol": "MSFT",
    "name": "Microsoft Corp",
    "secType": "STK",
    "exchange": "NASDAQ",
    "market": "US",
    "currency": "USD",
    "lotSize": 1,
    "minTick": 0.01,
    "contractId": 756734,
    "status": "NORMAL"
  }
]

Rate limit

The base rate limit is 60 requests/min. QuoteContract and DerivativeContracts both use quote_contract and share this quota.


Quote Contract

Purpose

Lists option, warrant, or callable bull/bear contracts for one underlying and expiry. The client unwraps the server items envelope.

Signature

func (c *TradeClient) QuoteContract(symbol, secType, expiry string) ([]model.Contract, error)

Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.

Parameters

ParameterTypeRequiredSDK defaultConstraints
symbolstringYesNoneInstrument or underlying symbol
secTypestringYesNoneSecurity type; see the SecurityType enum
expirystringYesNoneExpiry; format: YYYYMMDD

Returns

([]model.Contract, error). Key fields from model.Contract:

FieldTypeDescription
ContractIdint64Contract ID
SymbolstringSymbol code
SecTypestringSecurity type
CurrencystringCurrency
ExchangestringExchange
ExpirystringExpiry date
Strikefloat64Strike price
RightstringOption right (PUT/CALL)
Multiplierfloat64Contract multiplier
IdentifierstringIdentifier
NamestringName
MarketstringMarket
TradeableboolWhether tradeable
Conidint64Internal contract ID
ShortMarginfloat64Short margin ratio
ShortInitialMarginfloat64Short initial margin ratio
ShortMaintenanceMarginfloat64Short maintenance margin ratio
LongInitialMarginfloat64Long initial margin
LongMaintenanceMarginfloat64Long maintenance margin
TickSizes[]TickSizeMinimum-tick price ranges
LotSizefloat64Lot size
PrimaryExchangestringPrimary exchange
LocalSymbolstringLocal symbol
TradingClassstringTrading class
StatusintStatus
MarginableboolWhether marginable
ShortableboolWhether shortable
CloseOnlyboolWhether close-only
IsEtfboolWhether an ETF
SupportOvernightTradingboolWhether overnight trading is supported
SupportFractionalShareboolWhether fractional shares are supported

TickSize fields

FieldTypeDescription
BeginstringBegin value
EndstringEnd value
TickSizefloat64Tick size value
TypestringRange type (CLOSED/OPEN)

Invocation example

result, err := tc.QuoteContract("AAPL", "OPT", "20260619")
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)
{
  "symbol": "AAPL",
  "name": "Apple Inc",
  "secType": "STK",
  "exchange": "NASDAQ",
  "market": "US",
  "currency": "USD",
  "lotSize": 1,
  "minTick": 0.01
}

Rate limit

The base rate limit is 60 requests/min. QuoteContract and DerivativeContracts both use quote_contract and share this quota.


Derivative Contracts

Purpose

Lists derivative contracts using an account-aware request model. The client unwraps the server items envelope, and fills an empty account field from the client default.

Signature

func (c *TradeClient) DerivativeContracts(req model.DerivativeContractsRequest) ([]model.Contract, error)

Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.

Parameters

model.DerivativeContractsRequest

SDK fieldTypeRequiredSerializationSDK default and constraints
SecTypestringNoOmitted if emptyAllowed values: ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND
LangstringNoOmitted if emptyAllowed values: zh_CN, zh_TW, en_US
AccountstringNoUses the client default account when emptyTrading account; the client default is used when empty
SecretKeystringNoUses client configuration when availableInstitutional-account secret key; populated from client configuration when available
Symbols[]stringNoOmitted when emptySymbols
ExpirystringNoOmitted when emptyExpiry value

Returns

([]model.Contract, error). Key fields from model.Contract:

FieldTypeDescription
ContractIdint64Contract ID
SymbolstringSymbol code
SecTypestringSecurity type
CurrencystringCurrency
ExchangestringExchange
ExpirystringExpiry date
Strikefloat64Strike price
RightstringOption right (PUT/CALL)
Multiplierfloat64Contract multiplier
IdentifierstringIdentifier
NamestringName
MarketstringMarket
TradeableboolWhether tradeable
Conidint64Internal contract ID
ShortMarginfloat64Short margin ratio
ShortInitialMarginfloat64Short initial margin ratio
ShortMaintenanceMarginfloat64Short maintenance margin ratio
LongInitialMarginfloat64Long initial margin
LongMaintenanceMarginfloat64Long maintenance margin
TickSizes[]TickSizeMinimum-tick price ranges
LotSizefloat64Lot size
PrimaryExchangestringPrimary exchange
LocalSymbolstringLocal symbol
TradingClassstringTrading class
StatusintStatus
MarginableboolWhether marginable
ShortableboolWhether shortable
CloseOnlyboolWhether close-only
IsEtfboolWhether an ETF
SupportOvernightTradingboolWhether overnight trading is supported
SupportFractionalShareboolWhether fractional shares are supported

TickSize fields

FieldTypeDescription
BeginstringBegin value
EndstringEnd value
TickSizefloat64Tick size value
TypestringRange type (CLOSED/OPEN)

Invocation example

result, err := tc.DerivativeContracts(model.DerivativeContractsRequest{
	Account: "U123456",
	Symbols: []string{"AAPL"},
	SecType: "STK",
	Expiry: "20260619",
	Lang: "en_US",
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)
[
  {
    "symbol": "AAPL  250815C00300000",
    "name": "AAPL 15AUG25 300 C",
    "secType": "OPT",
    "exchange": "CBOE",
    "market": "US",
    "currency": "USD",
    "expiry": "2025-08-15",
    "strike": 300.0,
    "right": "CALL",
    "multiplier": 100.0,
    "underlying": "AAPL"
  }
]

Rate limit

The base rate limit is 60 requests/min.



Did this page help you?