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
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbol | string | Yes | None | Instrument or underlying symbol |
secType | string | Yes | None | Security type; see the SecurityType enum |
Returns
([]model.Contract, error). Key fields from model.Contract:
| Field | Type | Description |
|---|---|---|
| ContractId | int64 | Contract ID |
| Symbol | string | Symbol code |
| SecType | string | Security type |
| Currency | string | Currency |
| Exchange | string | Exchange |
| Expiry | string | Expiry date |
| Strike | float64 | Strike price |
| Right | string | Option right (PUT/CALL) |
| Multiplier | float64 | Contract multiplier |
| Identifier | string | Identifier |
| Name | string | Name |
| Market | string | Market |
| Tradeable | bool | Whether tradeable |
| Conid | int64 | Internal contract ID |
| ShortMargin | float64 | Short margin ratio |
| ShortInitialMargin | float64 | Short initial margin ratio |
| ShortMaintenanceMargin | float64 | Short maintenance margin ratio |
| LongInitialMargin | float64 | Long initial margin |
| LongMaintenanceMargin | float64 | Long maintenance margin |
| TickSizes | []TickSize | Minimum-tick price ranges |
| LotSize | float64 | Lot size |
| PrimaryExchange | string | Primary exchange |
| LocalSymbol | string | Local symbol |
| TradingClass | string | Trading class |
| Status | int | Status |
| Marginable | bool | Whether marginable |
| Shortable | bool | Whether shortable |
| CloseOnly | bool | Whether close-only |
| IsEtf | bool | Whether an ETF |
| SupportOvernightTrading | bool | Whether overnight trading is supported |
| SupportFractionalShare | bool | Whether fractional shares are supported |
TickSize field | Type | Description |
|---|---|---|
| Begin | string | Range start |
| End | string | Range end; may be Infinity |
| TickSize | float64 | Minimum tick |
| Type | string | Range 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
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbol | string | Yes | None | Instrument or underlying symbol |
secType | string | Yes | None | Security type; see the SecurityType enum |
Returns
(*model.Contract, error). Key fields from model.Contract:
| Field | Type | Description |
|---|---|---|
| ContractId | int64 | Contract ID |
| Symbol | string | Symbol code |
| SecType | string | Security type |
| Currency | string | Currency |
| Exchange | string | Exchange |
| Expiry | string | Expiry date |
| Strike | float64 | Strike price |
| Right | string | Option right (PUT/CALL) |
| Multiplier | float64 | Contract multiplier |
| Identifier | string | Identifier |
| Name | string | Name |
| Market | string | Market |
| Tradeable | bool | Whether tradeable |
| Conid | int64 | Internal contract ID |
| ShortMargin | float64 | Short margin ratio |
| ShortInitialMargin | float64 | Short initial margin ratio |
| ShortMaintenanceMargin | float64 | Short maintenance margin ratio |
| LongInitialMargin | float64 | Long initial margin |
| LongMaintenanceMargin | float64 | Long maintenance margin |
| TickSizes | []TickSize | Minimum-tick price ranges |
| LotSize | float64 | Lot size |
| PrimaryExchange | string | Primary exchange |
| LocalSymbol | string | Local symbol |
| TradingClass | string | Trading class |
| Status | int | Status |
| Marginable | bool | Whether marginable |
| Shortable | bool | Whether shortable |
| CloseOnly | bool | Whether close-only |
| IsEtf | bool | Whether an ETF |
| SupportOvernightTrading | bool | Whether overnight trading is supported |
| SupportFractionalShare | bool | Whether fractional shares are supported |
TickSize fields
| Field | Type | Description |
|---|---|---|
Begin | string | Begin value |
End | string | End value |
TickSize | float64 | Tick size value |
Type | string | Range 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
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | []string | Yes | None | Instrument symbols; the SDK does not enforce a batch limit |
secType | string | Yes | None | Security type; see the SecurityType enum |
Returns
([]model.Contract, error). Key fields from model.Contract:
| Field | Type | Description |
|---|---|---|
| ContractId | int64 | Contract ID |
| Symbol | string | Symbol code |
| SecType | string | Security type |
| Currency | string | Currency |
| Exchange | string | Exchange |
| Expiry | string | Expiry date |
| Strike | float64 | Strike price |
| Right | string | Option right (PUT/CALL) |
| Multiplier | float64 | Contract multiplier |
| Identifier | string | Identifier |
| Name | string | Name |
| Market | string | Market |
| Tradeable | bool | Whether tradeable |
| Conid | int64 | Internal contract ID |
| ShortMargin | float64 | Short margin ratio |
| ShortInitialMargin | float64 | Short initial margin ratio |
| ShortMaintenanceMargin | float64 | Short maintenance margin ratio |
| LongInitialMargin | float64 | Long initial margin |
| LongMaintenanceMargin | float64 | Long maintenance margin |
| TickSizes | []TickSize | Minimum-tick price ranges |
| LotSize | float64 | Lot size |
| PrimaryExchange | string | Primary exchange |
| LocalSymbol | string | Local symbol |
| TradingClass | string | Trading class |
| Status | int | Status |
| Marginable | bool | Whether marginable |
| Shortable | bool | Whether shortable |
| CloseOnly | bool | Whether close-only |
| IsEtf | bool | Whether an ETF |
| SupportOvernightTrading | bool | Whether overnight trading is supported |
| SupportFractionalShare | bool | Whether fractional shares are supported |
TickSize fields
| Field | Type | Description |
|---|---|---|
Begin | string | Begin value |
End | string | End value |
TickSize | float64 | Tick size value |
Type | string | Range 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
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbol | string | Yes | None | Instrument or underlying symbol |
secType | string | Yes | None | Security type; see the SecurityType enum |
expiry | string | Yes | None | Expiry; format: YYYYMMDD |
Returns
([]model.Contract, error). Key fields from model.Contract:
| Field | Type | Description |
|---|---|---|
| ContractId | int64 | Contract ID |
| Symbol | string | Symbol code |
| SecType | string | Security type |
| Currency | string | Currency |
| Exchange | string | Exchange |
| Expiry | string | Expiry date |
| Strike | float64 | Strike price |
| Right | string | Option right (PUT/CALL) |
| Multiplier | float64 | Contract multiplier |
| Identifier | string | Identifier |
| Name | string | Name |
| Market | string | Market |
| Tradeable | bool | Whether tradeable |
| Conid | int64 | Internal contract ID |
| ShortMargin | float64 | Short margin ratio |
| ShortInitialMargin | float64 | Short initial margin ratio |
| ShortMaintenanceMargin | float64 | Short maintenance margin ratio |
| LongInitialMargin | float64 | Long initial margin |
| LongMaintenanceMargin | float64 | Long maintenance margin |
| TickSizes | []TickSize | Minimum-tick price ranges |
| LotSize | float64 | Lot size |
| PrimaryExchange | string | Primary exchange |
| LocalSymbol | string | Local symbol |
| TradingClass | string | Trading class |
| Status | int | Status |
| Marginable | bool | Whether marginable |
| Shortable | bool | Whether shortable |
| CloseOnly | bool | Whether close-only |
| IsEtf | bool | Whether an ETF |
| SupportOvernightTrading | bool | Whether overnight trading is supported |
| SupportFractionalShare | bool | Whether fractional shares are supported |
TickSize fields
| Field | Type | Description |
|---|---|---|
Begin | string | Begin value |
End | string | End value |
TickSize | float64 | Tick size value |
Type | string | Range 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 field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
SecType | string | No | Omitted if empty | Allowed values: ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Account | string | No | Uses the client default account when empty | Trading account; the client default is used when empty |
SecretKey | string | No | Uses client configuration when available | Institutional-account secret key; populated from client configuration when available |
Symbols | []string | No | Omitted when empty | Symbols |
Expiry | string | No | Omitted when empty | Expiry value |
Returns
([]model.Contract, error). Key fields from model.Contract:
| Field | Type | Description |
|---|---|---|
| ContractId | int64 | Contract ID |
| Symbol | string | Symbol code |
| SecType | string | Security type |
| Currency | string | Currency |
| Exchange | string | Exchange |
| Expiry | string | Expiry date |
| Strike | float64 | Strike price |
| Right | string | Option right (PUT/CALL) |
| Multiplier | float64 | Contract multiplier |
| Identifier | string | Identifier |
| Name | string | Name |
| Market | string | Market |
| Tradeable | bool | Whether tradeable |
| Conid | int64 | Internal contract ID |
| ShortMargin | float64 | Short margin ratio |
| ShortInitialMargin | float64 | Short initial margin ratio |
| ShortMaintenanceMargin | float64 | Short maintenance margin ratio |
| LongInitialMargin | float64 | Long initial margin |
| LongMaintenanceMargin | float64 | Long maintenance margin |
| TickSizes | []TickSize | Minimum-tick price ranges |
| LotSize | float64 | Lot size |
| PrimaryExchange | string | Primary exchange |
| LocalSymbol | string | Local symbol |
| TradingClass | string | Trading class |
| Status | int | Status |
| Marginable | bool | Whether marginable |
| Shortable | bool | Whether shortable |
| CloseOnly | bool | Whether close-only |
| IsEtf | bool | Whether an ETF |
| SupportOvernightTrading | bool | Whether overnight trading is supported |
| SupportFractionalShare | bool | Whether fractional shares are supported |
TickSize fields
| Field | Type | Description |
|---|---|---|
Begin | string | Begin value |
End | string | End value |
TickSize | float64 | Tick size value |
Type | string | Range 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.
Updated about 7 hours ago
