跳到主要內容

獲取標的當日分時

該接口用於獲取標的的當日分時數據。

信息

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無權限沒有獲取標的行情的權限