跳到主要內容

获取标的当日分时

该接口用于获取标的的当日分时数据。

SDK Links

Python
longport.openapi.QuoteContext.intraday
Rust
longport::quote::QuoteContext#intraday
Go
QuoteContext.Intraday
Node.js
QuoteContext#intraday
信息

Request

Parameters

NameTypeRequiredDescription
symbolstring标的代码,使用 ticker.region 格式,例如:700.HK

Protobuf

message SecurityIntradayRequest {
string symbol = 1;
}

Request Example

# 获取标的分时
# https://open.longportapp.com/docs/quote/pull/intraday
# 运行前请访问“开发者中心”确保账户有正确的行情权限。
# 如没有开通行情权限,可以通过“LongPort”手机客户端,并进入“我的 - 我的行情 - 行情商城”购买开通行情权限。
from longport.openapi import QuoteContext, Config

config = Config.from_env()
ctx = QuoteContext(config)

resp = ctx.intraday("700.HK")
print(resp)

Response

Response Properties

NameTypeDescription
symbolstring标的代码,例如:AAPL.US
linesobject[]分时数据
∟ pricestring当前分钟的收盘价格
∟ timestampint64当前分钟的开始时间
∟ volumeint64成交量
∟ turnoverstring成交额
∟ avg_pricestring均价

Protobuf

message SecurityIntradayResponse{
string symbol = 1;
repeated Line lines = 2;
}

message Line {
string price = 1;
int64 timestamp = 2;
int64 volume = 3;
string turnover = 4;
string avg_price = 5;
}

Response JSON Example

{
"symbol": "700.HK",
"lines": [
{
"price": "330.400",
"timestamp": 1651023000,
"volume": 375870,
"turnover": "123949699.000",
"avg_price": "329.767470"
},
{
"price": "331.200",
"timestamp": 1651023060,
"volume": 233095,
"turnover": "77269032.800",
"avg_price": "330.427416"
},
{
"price": "330.400",
"timestamp": 1651023120,
"volume": 192565,
"turnover": "63711556.000",
"avg_price": "330.530719"
},
{
"price": "330.800",
"timestamp": 1651023180,
"volume": 143397,
"turnover": "47471072.400",
"avg_price": "330.608989"
},
{
"price": "330.800",
"timestamp": 1651023240,
"volume": 141834,
"turnover": "46890605.600",
"avg_price": "330.608078"
}
]
}

错误码

协议错误码业务错误码描述排查建议
3301600无效的请求请求参数有误或解包失败
3301606限流降低请求频次
7301602服务端内部错误请重试或联系技术人员处理
7301600请求标的不存在检查请求的 symbol 是否正确
7301603标的无行情标的没有请求的行情数据
7301604无权限没有获取标的行情的权限