Contracts
Contract
ContractPurpose
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 |
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"
}Contract3
Contract3Purpose
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 |
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
}Contracts
ContractsPurpose
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 |
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"
}
]QuoteContract
QuoteContractPurpose
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 |
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
}DerivativeContracts
DerivativeContractsPurpose
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 |
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 |
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"
}
]Updated about 17 hours ago
