证券
获取股票代码列表
功能说明
查询全量合约代码。服务端返回字符串列表,不是对象列表。
方法签名
func (c *QuoteClient) GetSymbols(req model.SymbolsRequest) ([]string, error)参数
model.SymbolsRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Market | string | 否 | 空值省略 | 无;可选值:ALL, US, HK, CN, SG |
SecType | string | 否 | 空值省略 | 无;可选值:ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]string, error)
示例
result, err := qc.GetSymbols(model.SymbolsRequest{
Market: "US",
SecType: "STK",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
"AAPL",
"MSFT",
"GOOGL",
"AMZN",
"TSLA"
]获取股票代码和名称列表
功能说明
查询全量合约代码+名称。
方法签名
func (c *QuoteClient) GetSymbolNames(req model.SymbolsRequest) ([]model.SymbolName, error)参数
model.SymbolsRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Market | string | 否 | 空值省略 | 无;可选值:ALL, US, HK, CN, SG |
SecType | string | 否 | 空值省略 | 无;可选值:ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.SymbolName, error)。关键字段来自 model.SymbolName:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Name | string | name |
Market | string | market |
示例
result, err := qc.GetSymbolNames(model.SymbolsRequest{
Market: "US",
SecType: "STK",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"name": "Apple Inc",
"market": "US"
},
{
"symbol": "MSFT",
"name": "Microsoft Corp",
"market": "US"
},
{
"symbol": "GOOGL",
"name": "Alphabet Inc",
"market": "US"
}
]获取交易元数据
功能说明
交易元数据。
方法签名
func (c *QuoteClient) GetTradeMetas(req model.TradeMetasRequest) ([]model.TradeMeta, error)参数
model.TradeMetasRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.TradeMeta, error)。关键字段来自 model.TradeMeta:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
LotSize | int | lotSize |
MinTick | float64 | minTick |
SpreadScale | float64 | spreadScale |
ShortableFlag | string | shortableFlag |
MarginableFlag | string | marginableFlag |
示例
result, err := qc.GetTradeMetas(model.TradeMetasRequest{
Symbols: []string{"AAPL"},
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"lotSize": 1,
"minTick": 0.01,
"spreadScale": 0.01,
"shortableFlag": "Y",
"marginableFlag": "Y"
}
]获取实时行情
功能说明
获取股票实时行情。
方法签名
func (c *QuoteClient) GetRealTimeQuote(req model.BriefRequest) ([]model.Brief, error)参数
model.BriefRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
SecType | string | 否 | 空值省略 | 无;可选值:ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.Brief, error)。关键字段来自 model.Brief:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Open | float64 | open |
High | float64 | high |
Low | float64 | low |
Close | float64 | close |
PreClose | float64 | preClose |
LatestPrice | float64 | latestPrice |
LatestTime | int64 | latestTime |
AskPrice | float64 | askPrice |
AskSize | int64 | askSize |
BidPrice | float64 | bidPrice |
BidSize | int64 | bidSize |
Volume | int64 | volume |
Status | string | status |
示例
result, err := qc.GetRealTimeQuote(model.BriefRequest{
Symbols: []string{"AAPL"},
SecType: "STK",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"open": 304.81,
"high": 310.69,
"low": 300.0,
"close": 308.91,
"preClose": 333.43,
"latestPrice": 308.91,
"latestTime": 1785528000000,
"askPrice": 310.97,
"askSize": 400,
"bidPrice": 310.89,
"bidSize": 80,
"volume": 176739024,
"status": "NORMAL"
}
]获取延迟行情
功能说明
获取延迟行情.
方法签名
func (c *QuoteClient) GetDelayedQuote(req model.StockDelayBriefsRequest) ([]model.Brief, error)查询延迟行情;参数
model.StockDelayBriefsRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
SecType | string | 否 | 空值省略 | 无;可选值:ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.Brief, error)。关键字段来自 model.Brief:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Open | float64 | open |
High | float64 | high |
Low | float64 | low |
Close | float64 | close |
PreClose | float64 | preClose |
LatestPrice | float64 | latestPrice |
LatestTime | int64 | latestTime |
AskPrice | float64 | askPrice |
AskSize | int64 | askSize |
BidPrice | float64 | bidPrice |
BidSize | int64 | bidSize |
Volume | int64 | volume |
Status | string | status |
示例
result, err := qc.GetDelayedQuote(model.StockDelayBriefsRequest{
Symbols: []string{"AAPL"},
SecType: "STK",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"open": 304.81,
"high": 310.69,
"low": 300.0,
"close": 308.91,
"preClose": 333.43,
"latestPrice": 308.91,
"latestTime": 1785528000000,
"askPrice": 310.97,
"askSize": 400,
"bidPrice": 310.89,
"bidSize": 80,
"volume": 176739024,
"status": "NORMAL"
}
]获取 K 线数据
功能说明
获取 K 线数据,支持按时间范围或索引分页。
方法签名
func (c *QuoteClient) GetKline(req model.KlineRequest) ([]model.Kline, error)参数
model.KlineRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Period | string | 否 | 空值省略 | 无;可选值:day, week, month, year, 1min, 5min, 15min, 30min, 60min |
Right | string | 否 | 空值省略 | 无;可选值:PUT, CALL (option side); br, nr when used as quote adjustment |
BeginTime | int64 | 否 | 空值省略 | 无;与 BeginIndex/EndIndex 二选一;毫秒时间戳 |
EndTime | int64 | 否 | 空值省略 | 无;与 BeginIndex/EndIndex 二选一;毫秒时间戳 |
SecType | string | 否 | 空值省略 | 无;可选值:ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.Kline, error)。关键字段来自 model.Kline:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Period | string | period |
NextPageToken | string | nextPageToken |
Items | []KlineItem | items |
示例
result, err := qc.GetKline(model.KlineRequest{
Symbols: []string{"AAPL"},
Period: "day",
Right: "CALL",
BeginTime: 1735689600000,
EndTime: 1738281600000,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"period": "day",
"nextPageToken": null,
"items": [
{
"time": 1785384000000,
"volume": 74817792,
"open": 333.10,
"close": 333.43,
"high": 334.75,
"low": 329.59,
"amount": 24701334239.0
},
{
"time": 1785470400000,
"volume": 132489137,
"open": 304.81,
"close": 308.91,
"high": 310.69,
"low": 300.0,
"amount": 40348574927.0
}
]
}
]分页获取 K 线数据
功能说明
分页获取 K 线,客户端循环直到收集足够数据后合并返回。
方法签名
func (c *QuoteClient) GetKlineByPage(req model.KlineByPageRequest) ([]model.KlineItem, error)参数
model.KlineByPageRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Period | string | 否 | 空值省略 | 无;可选值:day, week, month, year, 1min, 5min, 15min, 30min, 60min |
TotalSize | int | 否 | 空值省略 | 1000;想获取的总条数 |
PageSize | int | 否 | 空值省略 | 200;每页条数 |
Right | string | 否 | 空值省略 | 无;可选值:PUT, CALL (option side); br, nr when used as quote adjustment |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.KlineItem, error)。关键字段来自 model.KlineItem:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Time | int64 | time |
Volume | int64 | volume |
Open | float64 | open |
Close | float64 | close |
High | float64 | high |
Low | float64 | low |
Amount | float64 | amount |
示例
result, err := qc.GetKlineByPage(model.KlineByPageRequest{
Symbol: "AAPL",
Period: "day",
BeginTime: 1735689600000,
EndTime: 1738281600000,
TotalSize: 100,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"time": 1785384000000,
"volume": 74817792,
"open": 333.10,
"close": 333.43,
"high": 334.75,
"low": 329.59,
"amount": 24701334239.0
},
{
"time": 1785470400000,
"volume": 132489137,
"open": 304.81,
"close": 308.91,
"high": 310.69,
"low": 300.0,
"amount": 40348574927.0
}
]获取分时数据
功能说明
获取分时数据。
方法签名
func (c *QuoteClient) GetTimeline(symbols []string) ([]model.Timeline, error)参数
| 参数 | 类型 | 必填 | SDK 默认值 | 约束 |
|---|---|---|---|---|
symbols | []string | 是 | 无 | 标的代码列表;SDK 不设置批量上限 |
返回
([]model.Timeline, error)。关键字段来自 model.Timeline:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Period | string | period |
PreClose | float64 | preClose |
Intraday | *TimelineBucket | intraday |
PreHours | *TimelineBucket | preHours |
AfterHours | *TimelineBucket | afterHours |
示例
result, err := qc.GetTimeline([]string{"AAPL"})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"period": "day",
"preClose": 333.43,
"intraday": {
"items": [
{"time": 1785504600000, "price": 304.05, "avgPrice": 304.77, "volume": 3808851},
{"time": 1785504660000, "price": 301.93, "avgPrice": 304.60, "volume": 1704737},
{"time": 1785504720000, "price": 302.03, "avgPrice": 304.24, "volume": 2029081}
]
},
"preHours": null,
"afterHours": null
}
]获取历史分时数据
功能说明
历史分时。
方法签名
func (c *QuoteClient) GetTimelineHistory(req model.TimelineHistoryRequest) ([]model.Timeline, error)参数
model.TimelineHistoryRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Date | string | 否 | 空值省略 | 无;yyyy-MM-dd |
Right | string | 否 | 空值省略 | 无;可选值:PUT, CALL (option side); br, nr when used as quote adjustment |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.Timeline, error)。关键字段来自 model.Timeline:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Period | string | period |
PreClose | float64 | preClose |
Intraday | *TimelineBucket | intraday |
PreHours | *TimelineBucket | preHours |
AfterHours | *TimelineBucket | afterHours |
示例
result, err := qc.GetTimelineHistory(model.TimelineHistoryRequest{
Symbols: []string{"AAPL"},
Date: "2025-01-15",
Right: "CALL",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"period": "day",
"preClose": 333.43,
"intraday": {
"items": [
{"time": 1785504600000, "price": 304.05, "avgPrice": 304.77, "volume": 3808851},
{"time": 1785504660000, "price": 301.93, "avgPrice": 304.60, "volume": 1704737},
{"time": 1785504720000, "price": 302.03, "avgPrice": 304.24, "volume": 2029081}
]
},
"preHours": null,
"afterHours": null
}
]获取逐笔成交
功能说明
获取逐笔成交数据,支持分页。
方法签名
func (c *QuoteClient) GetTradeTick(req model.TradeTickRequest) ([]model.TradeTick, error)参数
model.TradeTickRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.TradeTick, error)。关键字段来自 model.TradeTick:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
BeginIndex | int64 | beginIndex |
EndIndex | int64 | endIndex |
Items | []TradeTickItem | items |
示例
result, err := qc.GetTradeTick(model.TradeTickRequest{
Symbols: []string{"AAPL"},
Limit: 20,
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"beginIndex": 2062878,
"endIndex": 2062880,
"items": [
{"time": 1785528000829, "volume": 36, "price": 308.91, "type": "-"},
{"time": 1785528000899, "volume": 1, "price": 309.0, "type": "*"}
]
}
]获取深度行情
功能说明
获取盘口深度数据。
方法签名
func (c *QuoteClient) GetQuoteDepth(req model.DepthQuoteRequest) ([]model.Depth, error)参数
model.DepthQuoteRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Market | string | 否 | 空值省略 | 无;可选值:ALL, US, HK, CN, SG |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.Depth, error)。关键字段来自 model.Depth:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Asks | []DepthLevel | asks |
Bids | []DepthLevel | bids |
示例
result, err := qc.GetQuoteDepth(model.DepthQuoteRequest{
Symbols: []string{"AAPL"},
Market: "US",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"asks": [
{"price": 310.97, "volume": 400, "count": 0},
{"price": 310.98, "volume": 200, "count": 0},
{"price": 311.00, "volume": 1500, "count": 0}
],
"bids": [
{"price": 310.89, "volume": 80, "count": 0},
{"price": 310.88, "volume": 300, "count": 0},
{"price": 310.85, "volume": 600, "count": 0}
]
}
]获取资金流向
功能说明
获取资金流向数据。period 可选值:day/intraday/week/month。
方法签名
func (c *QuoteClient) GetCapitalFlow(symbol, market, period string) (*model.CapitalFlow, error)参数
| 参数 | 类型 | 必填 | SDK 默认值 | 约束 |
|---|---|---|---|---|
symbol | string | 是 | 无 | 标的代码 |
market | string | 是 | 无 | 市场代码;SDK 枚举值为 ALL/US/HK/CN/SG |
period | string | 是 | 无 | K 线周期;见 BarPeriod 枚举 |
返回
(*model.CapitalFlow, error)。关键字段来自 model.CapitalFlow:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Period | string | period |
Items | []CapitalFlowItem | items |
示例
result, err := qc.GetCapitalFlow("AAPL", "US", "day")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
{
"symbol": "AAPL",
"period": "day",
"items": [
{"time": 1785470400000, "netInflow": -52341890.50, "inBig": 182345000.0, "inMid": 95432100.0, "inSmall": 23456000.0, "outBig": 195678900.0, "outMid": 98765400.0, "outSmall": 59131690.5}
]
}获取资金分布
功能说明
获取资金分布数据。
方法签名
func (c *QuoteClient) GetCapitalDistribution(symbol, market string) (*model.CapitalDistribution, error)参数
| 参数 | 类型 | 必填 | SDK 默认值 | 约束 |
|---|---|---|---|---|
symbol | string | 是 | 无 | 标的代码 |
market | string | 是 | 无 | 市场代码;SDK 枚举值为 ALL/US/HK/CN/SG |
返回
(*model.CapitalDistribution, error)。关键字段来自 model.CapitalDistribution:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
NetInflow | float64 | netInflow |
InAll | float64 | inAll |
InBig | float64 | inBig |
InMid | float64 | inMid |
InSmall | float64 | inSmall |
OutAll | float64 | outAll |
OutBig | float64 | outBig |
OutMid | float64 | outMid |
OutSmall | float64 | outSmall |
示例
result, err := qc.GetCapitalDistribution("AAPL", "US")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
{
"symbol": "AAPL",
"netInflow": -52341890.50,
"inAll": 301233100.0,
"inBig": 182345000.0,
"inMid": 95432100.0,
"inSmall": 23456000.0,
"outAll": 353574990.50,
"outBig": 195678900.0,
"outMid": 98765400.0,
"outSmall": 59130690.50
}获取交易榜单
功能说明
成交榜单(涨跌幅榜)。
方法签名
func (c *QuoteClient) GetTradeRank(req model.TradeRankRequest) ([]model.TradeRankItem, error)参数
model.TradeRankRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Market | string | 否 | 空值省略 | 无;可选值:ALL, US, HK, CN, SG |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.TradeRankItem, error)。关键字段来自 model.TradeRankItem:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
Name | string | name |
LatestPr | float64 | latestPrice |
Change | float64 | change |
ChangeRate | float64 | changeRate |
Volume | int64 | volume |
Amount | float64 | amount |
示例
result, err := qc.GetTradeRank(model.TradeRankRequest{
Market: "US",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "NVDA",
"name": "NVIDIA Corp",
"latestPrice": 132.15,
"change": 8.42,
"changeRate": 0.068,
"volume": 385241000,
"amount": 50871234567.0
},
{
"symbol": "TSLA",
"name": "Tesla Inc",
"latestPrice": 285.50,
"change": 12.30,
"changeRate": 0.045,
"volume": 112456000,
"amount": 32089765432.0
}
]获取卖空数据
功能说明
做空数据。
方法签名
func (c *QuoteClient) GetShortInterest(req model.ShortInterestRequest) ([]model.ShortInterest, error)参数
model.ShortInterestRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
([]model.ShortInterest, error)。关键字段来自 model.ShortInterest:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
SettlementDate | string | settlementDate |
ShortInterest | float64 | shortInterest |
AvgDailyVolume | float64 | avgDailyVolume |
DaysToCover | float64 | daysToCover |
PercentOfFloat | float64 | percentOfFloat |
ShortInterestPrevious | float64 | shortInterestPrevious |
PercentChange | float64 | percentChange |
示例
result, err := qc.GetShortInterest(model.ShortInterestRequest{
Symbols: []string{"AAPL"},
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
[
{
"symbol": "AAPL",
"settlementDate": "2025-07-15",
"shortInterest": 98234567.0,
"avgDailyVolume": 65432100.0,
"daysToCover": 1.5,
"percentOfFloat": 0.65,
"shortInterestPrevious": 96543210.0,
"percentChange": 1.75
}
]获取经纪商席位
功能说明
经纪商持仓。
方法签名
func (c *QuoteClient) GetStockBroker(req model.StockBrokerRequest) (*model.StockBroker, error)参数
model.StockBrokerRequest
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
SecType | string | 否 | 空值省略 | 无;可选值:ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Lang | string | 否 | 空值省略 | 无;可选值:zh_CN, zh_TW, en_US |
返回
(*model.StockBroker, error)。关键字段来自 model.StockBroker:
| 字段 | 类型 | JSON 字段 |
|---|---|---|
Symbol | string | symbol |
LevelAskList | []StockBrokerItem | levelAskList |
LevelBidList | []StockBrokerItem | levelBidList |
示例
result, err := qc.GetStockBroker(model.StockBrokerRequest{
Symbol: "AAPL",
Limit: 20,
SecType: "STK",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)返回示例
{
"symbol": "00700",
"levelAskList": [
{
"level": 1,
"price": 420.80,
"brokerCount": 2,
"broker": [
{"id": "8461", "name": "FUTU Securities"},
{"id": "8577", "name": "HSBC"}
]
}
],
"levelBidList": [
{
"level": 1,
"price": 420.60,
"brokerCount": 3,
"broker": [
{"id": "6997", "name": "China Investment"},
{"id": "8134", "name": "BOC"},
{"id": "5342", "name": "J.P. Morgan"}
]
}
]
}Updated 8 days ago
