期货
获取期货交易所
功能说明
获取期货交易所列表。
方法签名
func (c *QuoteClient) GetFutureExchange() ([]model.FutureExchange, error)参数
无参数。
返回
([]model.FutureExchange, error)。关键字段来自 model.FutureExchange:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Code | string | code |
Name | string | name |
ZoneID | string | zoneId |
示例
result, err := qc.GetFutureExchange()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"code": "CME",
"name": "Chicago Mercantile Exchange",
"market": "US",
"zone": "America/Chicago"
},
{
"code": "NYMEX",
"name": "New York Mercantile Exchange",
"market": "US",
"zone": "America/New_York"
},
{
"code": "HKEX",
"name": "Hong Kong Exchanges",
"market": "HK",
"zone": "Asia/Hong_Kong"
}
]获取期货合约列表
功能说明
获取某交易所的期货合约列表。
方法签名
func (c *QuoteClient) GetFutureContracts(exchange string) ([]model.FutureContractInfo, error)参数
| 参数 | 类型 | 必填 | SDK 默认值 | 约束 |
|---|---|---|---|---|
exchange | string | 是 | 无 | 见方法签名;SDK 不提供额外默认值 |
返回
([]model.FutureContractInfo, error)。关键字段来自 model.FutureContractInfo:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Continuous | bool | continuous |
Trade | bool | trade |
Type | string | type |
ContractCode | string | contractCode |
IbCode | string | ibCode |
Name | string | name |
ContractMonth | string | contractMonth |
LastTradingDate | string | lastTradingDate |
FirstNoticeDate | string | firstNoticeDate |
LastBiddingCloseTime | int64 | lastBiddingCloseTime |
Currency | string | currency |
ExchangeCode | string | exchangeCode |
Multiplier | float64 | multiplier |
MinTick | float64 | minTick |
示例
result, err := qc.GetFutureContracts("value")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"contractCode": "ES2609",
"symbol": "ES",
"name": "E-mini S&P 500",
"exchange": "CME",
"exchangeCode": "CME",
"market": "US",
"currency": "USD",
"multiplier": 50.0,
"lastTradingDate": "2025-09-19",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0
},
{
"contractCode": "ES2612",
"symbol": "ES",
"name": "E-mini S&P 500",
"exchange": "CME",
"exchangeCode": "CME",
"market": "US",
"currency": "USD",
"multiplier": 50.0,
"lastTradingDate": "2025-12-19",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0
}
]获取期货合约
功能说明
按 contract_code 查单个期货合约。服务端可能返回单个对象或列表,此处统一展开为 []FutureContractInfo。
方法签名
func (c *QuoteClient) GetFutureContract(req model.FutureContractSingleRequest) ([]model.FutureContractInfo, error)参数
model.FutureContractSingleRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Type | string | 否 | 空值省略 | 无;可选值:Exercise or Expire for option exercise requests; product type for futures requests |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureContractInfo, error)。关键字段来自 model.FutureContractInfo:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Continuous | bool | continuous |
Trade | bool | trade |
Type | string | type |
ContractCode | string | contractCode |
IbCode | string | ibCode |
Name | string | name |
ContractMonth | string | contractMonth |
LastTradingDate | string | lastTradingDate |
FirstNoticeDate | string | firstNoticeDate |
LastBiddingCloseTime | int64 | lastBiddingCloseTime |
Currency | string | currency |
ExchangeCode | string | exchangeCode |
Multiplier | float64 | multiplier |
MinTick | float64 | minTick |
示例
result, err := qc.GetFutureContract(model.FutureContractSingleRequest{
ContractCode: "ES2609",
Type: "Exercise",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
{
"contractCode": "ES2609",
"symbol": "ES",
"name": "E-mini S&P 500",
"exchange": "CME",
"exchangeCode": "CME",
"market": "US",
"currency": "USD",
"multiplier": 50.0,
"lastTradingDate": "2025-09-19",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0
}获取所有期货合约
功能说明
查询所有期货合约。
方法签名
func (c *QuoteClient) GetAllFutureContracts(req model.AllFutureContractsRequest) ([]model.FutureContractInfo, error)参数
model.AllFutureContractsRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Type | string | 否 | 空值省略 | 无;可选值:Exercise or Expire for option exercise requests; product type for futures requests |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureContractInfo, error)。关键字段来自 model.FutureContractInfo:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Continuous | bool | continuous |
Trade | bool | trade |
Type | string | type |
ContractCode | string | contractCode |
IbCode | string | ibCode |
Name | string | name |
ContractMonth | string | contractMonth |
LastTradingDate | string | lastTradingDate |
FirstNoticeDate | string | firstNoticeDate |
LastBiddingCloseTime | int64 | lastBiddingCloseTime |
Currency | string | currency |
ExchangeCode | string | exchangeCode |
Multiplier | float64 | multiplier |
MinTick | float64 | minTick |
示例
result, err := qc.GetAllFutureContracts(model.AllFutureContractsRequest{
Type: "Exercise",
Exchange: "CME",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"contractCode": "ES2609",
"symbol": "ES",
"name": "E-mini S&P 500",
"exchange": "CME",
"exchangeCode": "CME",
"market": "US",
"currency": "USD",
"multiplier": 50.0,
"lastTradingDate": "2025-09-19",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0
},
{
"contractCode": "ES2612",
"symbol": "ES",
"name": "E-mini S&P 500",
"exchange": "CME",
"exchangeCode": "CME",
"market": "US",
"currency": "USD",
"multiplier": 50.0,
"lastTradingDate": "2025-12-19",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0
}
]获取当前合约
功能说明
当前主力合约。
方法签名
func (c *QuoteClient) GetCurrentFutureContract(req model.FutureContractSingleRequest) (*model.FutureContractInfo, error)参数
model.FutureContractSingleRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Type | string | 否 | 空值省略 | 无;可选值:Exercise or Expire for option exercise requests; product type for futures requests |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
(*model.FutureContractInfo, error)。关键字段来自 model.FutureContractInfo:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Continuous | bool | continuous |
Trade | bool | trade |
Type | string | type |
ContractCode | string | contractCode |
IbCode | string | ibCode |
Name | string | name |
ContractMonth | string | contractMonth |
LastTradingDate | string | lastTradingDate |
FirstNoticeDate | string | firstNoticeDate |
LastBiddingCloseTime | int64 | lastBiddingCloseTime |
Currency | string | currency |
ExchangeCode | string | exchangeCode |
Multiplier | float64 | multiplier |
MinTick | float64 | minTick |
示例
result, err := qc.GetCurrentFutureContract(model.FutureContractSingleRequest{
ContractCode: "ES2609",
Type: "Exercise",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
{
"contractCode": "ES2609",
"symbol": "ES",
"name": "E-mini S&P 500",
"exchange": "CME",
"exchangeCode": "CME",
"market": "US",
"currency": "USD",
"multiplier": 50.0,
"lastTradingDate": "2025-09-19",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0
}获取连续合约
功能说明
连续主力合约。
方法签名
func (c *QuoteClient) GetFutureContinuousContracts(req model.FutureContinuousContractsRequest) ([]model.FutureContractInfo, error)参数
model.FutureContinuousContractsRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Type | string | 否 | 空值省略 | 无;可选值:Exercise or Expire for option exercise requests; product type for futures requests |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureContractInfo, error)。关键字段来自 model.FutureContractInfo:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Continuous | bool | continuous |
Trade | bool | trade |
Type | string | type |
ContractCode | string | contractCode |
IbCode | string | ibCode |
Name | string | name |
ContractMonth | string | contractMonth |
LastTradingDate | string | lastTradingDate |
FirstNoticeDate | string | firstNoticeDate |
LastBiddingCloseTime | int64 | lastBiddingCloseTime |
Currency | string | currency |
ExchangeCode | string | exchangeCode |
Multiplier | float64 | multiplier |
MinTick | float64 | minTick |
示例
result, err := qc.GetFutureContinuousContracts(model.FutureContinuousContractsRequest{
Type: "Exercise",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"contractCode": "ESmain",
"symbol": "ES",
"name": "E-mini S&P 500 Continuous",
"exchange": "CME",
"exchangeCode": "CME",
"market": "US",
"currency": "USD",
"multiplier": 50.0,
"type": "main"
}
]获取历史主力合约
功能说明
期货主力合约历史。
方法签名
func (c *QuoteClient) GetFutureHistoryMainContract(req model.FutureHistoryMainContractRequest) ([]model.FutureMainContractHistory, error)参数
model.FutureHistoryMainContractRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureMainContractHistory, error)。关键字段来自 model.FutureMainContractHistory:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
ContractCode | string | contractCode |
Symbol | string | symbol |
BeginDate | string | beginDate |
EndDate | string | endDate |
示例
result, err := qc.GetFutureHistoryMainContract(model.FutureHistoryMainContractRequest{
ContractCodes: []string{"ES2609"},
BeginTime: 1735689600000,
EndTime: 1738281600000,
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"contractCode": "ES2609",
"symbol": "ES",
"beginDate": "2025-06-20",
"endDate": "2025-09-19"
},
{
"contractCode": "ES2606",
"symbol": "ES",
"beginDate": "2025-03-21",
"endDate": "2025-06-19"
}
]获取期货实时行情
功能说明
获取期货实时行情。
方法签名
func (c *QuoteClient) GetFutureRealTimeQuote(req model.FutureBriefRequest) ([]model.FutureQuote, error)参数
model.FutureBriefRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureQuote, error)。关键字段来自 model.FutureQuote:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
ContractCode | string | contractCode |
LatestPrice | float64 | latestPrice |
LatestSize | int64 | latestSize |
LatestTime | int64 | latestTime |
BidPrice | float64 | bidPrice |
AskPrice | float64 | askPrice |
BidSize | int64 | bidSize |
AskSize | int64 | askSize |
OpenInterest | int64 | openInterest |
OpenInterestChange | int64 | openInterestChange |
Volume | int64 | volume |
Open | float64 | open |
High | float64 | high |
Low | float64 | low |
示例
result, err := qc.GetFutureRealTimeQuote(model.FutureBriefRequest{
ContractCodes: []string{"ES2609"},
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "ES2609",
"open": 5620.25,
"high": 5658.50,
"low": 5605.00,
"close": 5645.75,
"preClose": 5618.00,
"latestPrice": 5645.75,
"latestTime": 1785528000000,
"askPrice": 5646.00,
"askSize": 125,
"bidPrice": 5645.75,
"bidSize": 98,
"volume": 1523400,
"status": "NORMAL"
}
]获取期货 K 线
功能说明
获取期货 K 线数据。beginTimeMs/endTimeMs 为 13 位毫秒时间戳,-1 表示不限。
方法签名
func (c *QuoteClient) GetFutureKline(req model.FutureKlineRequest) ([]model.FutureKline, error)参数
model.FutureKlineRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Period | string | 否 | 空值省略 | 无;可选值:day, week, month, year, 1min, 5min, 15min, 30min, 60min |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureKline, error)。关键字段来自 model.FutureKline:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
NextPageToken | string | nextPageToken |
Items | []FutureKlineItem | items |
示例
result, err := qc.GetFutureKline(model.FutureKlineRequest{
ContractCodes: []string{"ES2609"},
ContractCode: "ES2609",
Period: "day",
BeginTime: 1735689600000,
EndTime: 1738281600000,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "ES2609",
"period": "day",
"nextPageToken": null,
"items": [
{
"time": 1785384000000,
"volume": 1234567,
"open": 5618.00,
"close": 5620.25,
"high": 5635.50,
"low": 5598.75,
"amount": 0
},
{
"time": 1785470400000,
"volume": 1523400,
"open": 5620.25,
"close": 5645.75,
"high": 5658.50,
"low": 5605.00,
"amount": 0
}
]
}
]分页获取期货 K 线
功能说明
分页获取期货 K 线,客户端循环直到收集足够数据后合并返回。
方法签名
func (c *QuoteClient) GetFutureKlineByPage(req model.FutureKlineByPageRequest) ([]model.FutureKlineItem, error)参数
model.FutureKlineByPageRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Period | string | 否 | 空值省略 | 无;可选值:day, week, month, year, 1min, 5min, 15min, 30min, 60min |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureKlineItem, error)。关键字段来自 model.FutureKlineItem:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Time | int64 | time |
Volume | int64 | volume |
Open | float64 | open |
Close | float64 | close |
High | float64 | high |
Low | float64 | low |
LastTime | int64 | lastTime |
OpenInterest | int64 | openInterest |
Settlement | float64 | settlement |
示例
result, err := qc.GetFutureKlineByPage(model.FutureKlineByPageRequest{
ContractCode: "ES2609",
Period: "day",
BeginTime: 1735689600000,
EndTime: 1738281600000,
TotalSize: 100,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"time": 1785384000000,
"volume": 1234567,
"open": 5618.00,
"close": 5620.25,
"high": 5635.50,
"low": 5598.75,
"amount": 0
},
{
"time": 1785470400000,
"volume": 1523400,
"open": 5620.25,
"close": 5645.75,
"high": 5658.50,
"low": 5605.00,
"amount": 0
}
]获取期货逐笔
功能说明
期货逐笔。服务端返回 {contractCode, items:[...]} 对象,需解包 items 并回填 contractCode。 end_index 服务端要求必须 >= 0;未设置时默认 30(与 Python SDK 一致)。
方法签名
func (c *QuoteClient) GetFutureTradeTicks(req model.FutureTradeTicksRequest) ([]model.FutureTradeTickItem, error)参数
model.FutureTradeTicksRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureTradeTickItem, error)。关键字段来自 model.FutureTradeTickItem:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
ContractCode | string | contractCode |
Index | int64 | index |
Time | int64 | time |
Price | float64 | price |
Volume | int64 | volume |
Direction | string | direction |
示例
result, err := qc.GetFutureTradeTicks(model.FutureTradeTicksRequest{
ContractCode: "ES2609",
Limit: 20,
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "ES2609",
"beginIndex": 98200,
"endIndex": 98202,
"items": [
{"time": 1785527990000, "volume": 5, "price": 5645.50, "type": "+"},
{"time": 1785527995000, "volume": 12, "price": 5645.75, "type": "-"}
]
}
]获取期货深度
功能说明
期货盘口。
方法签名
func (c *QuoteClient) GetFutureDepth(req model.FutureDepthRequest) ([]model.FutureDepth, error)参数
model.FutureDepthRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.FutureDepth, error)。关键字段来自 model.FutureDepth:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
ContractCode | string | contractCode |
Timestamp | int64 | timestamp |
Asks | []DepthLevel | asks |
Bids | []DepthLevel | bids |
示例
result, err := qc.GetFutureDepth(model.FutureDepthRequest{
ContractCodes: []string{"ES2609"},
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "ES2609",
"asks": [
{"price": 5646.00, "volume": 125, "count": 0},
{"price": 5646.25, "volume": 200, "count": 0},
{"price": 5646.50, "volume": 350, "count": 0}
],
"bids": [
{"price": 5645.75, "volume": 98, "count": 0},
{"price": 5645.50, "volume": 180, "count": 0},
{"price": 5645.25, "volume": 275, "count": 0}
]
}
]获取期货交易时间
功能说明
期货交易时段。服务端返回单个对象({timeSection/tradingTimes/biddingTimes})。
方法签名
func (c *QuoteClient) GetFutureTradingTimes(req model.FutureTradingTimesRequest) (*model.FutureTradingTime, error)参数
model.FutureTradingTimesRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
(*model.FutureTradingTime, error)。关键字段来自 model.FutureTradingTime:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
ContractCode | string | contractCode |
BizDate | string | bizDate |
Zone | string | zone |
TradingTimes | []FutureTradingSegment | tradingTimes |
示例
result, err := qc.GetFutureTradingTimes(model.FutureTradingTimesRequest{
ContractCode: "ES2609",
TradingDate: "2025-01-15",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "ES",
"tradingTimes": [
{"start": "18:00:00", "end": "17:00:00", "zone": "America/Chicago", "tradingSession": "Electronic"}
]
}
]Updated 8 days ago
