Skip to main content

Get Real-time Quotes Of Securities

This API is used to obtain the real-time quotes of securities, and supports all types of securities.

Request

Parameters

NameTypeRequiredDescription
symbolstring[]YesSecurity code list, in ticker.region format, for example: [700.HK]

Check rules:
The maximum number of symbols in each request is 500

Protobuf

message MultiSecurityRequest {
repeated string symbol = 1;
}

Request Example

# Get Real-time Quotes Of Securities
# https://open.longportapp.com/docs/quote/pull/quote
# Before running, please visit the "Developers to ensure that the account has the correct quotes authority.
# If you do not have the quotes authority, you can enter "Me - My Quotes - Store" to purchase the authority through the "LongPort" mobile app.
from longport.openapi import QuoteContext, Config

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

resp = ctx.quote(["700.HK", "AAPL.US", "TSLA.US", "NFLX.US"])
print(resp)

Response

Response Properties

NameTypeDescription
secu_quoteobject[]Securities quote
∟ symbolstringSecurity code
∟ last_donestringLatest price
∟ prev_closestringYesterday's close
∟ openstringOpen
∟ highstringHigh
∟ lowstringLow
∟ timestampint64Time of latest price
∟ volumeint64Volume
∟ turnoverstringTurnover
∟ trade_statusint32Security trading status, see TradeStatus
∟ pre_market_quoteobjectQuote of US pre market
∟∟ last_donestringLatest price
∟∟ timestampint64Time of latest price
∟∟ volumeint64Volume
∟∟ turnoverstringTurnover
∟∟ highstringHigh
∟∟ lowstringLow
∟∟ prev_closestringClose of the last trade session
∟ post_market_quoteobjectQuote of US post market
∟∟ last_donestringLatest price
∟∟ timestampint64Time of latest price
∟∟ volumeint64Volume
∟∟ turnoverstringTurnover
∟∟ highstringHigh
∟∟ lowstringLow
∟∟ prev_closestringClose of the last trade session

Protobuf

message  SecurityQuoteResponse {
repeated SecurityQuote secu_quote = 1;
}

message SecurityQuote {
string symbol = 1;
string last_done = 2;
string prev_close = 3;
string open = 4;
string high = 5;
string low = 6;
int64 timestamp = 7;
int64 volume = 8;
string turnover = 9;
TradeStatus trade_status = 10;
PrePostQuote pre_market_quote = 11;
PrePostQuote post_market_quote = 12;
}

message PrePostQuote {
string last_done = 1;
int64 timestamp = 2;
int64 volume = 3;
string turnover = 4;
string high = 5;
string low = 6;
string prev_close = 7;
}

Response JSON Example

{
"secu_quote": [
{
"symbol": "700.HK",
"last_done": "338.000",
"prev_close": "334.800",
"open": "340.600",
"high": "340.600",
"low": "333.000",
"timestamp": 1651115955,
"volume": 7310881,
"turnover": "2461463161.000"
},
{
"symbol": "AAPL.US",
"last_done": "156.570",
"prev_close": "156.800",
"open": "155.910",
"high": "159.790",
"low": "155.380",
"timestamp": 1651089600,
"volume": 88063191,
"turnover": "13865092584.000",
"pre_market_quote": {
"last_done": "155.880",
"timestamp": 1651066201,
"volume": 1575504,
"turnover": "246653442.000",
"high": "158.400",
"low": "155.100",
"prev_close": "156.800"
},
"post_market_quote": {
"last_done": "158.770",
"timestamp": 1651103995,
"volume": 6188441,
"turnover": "970874184.759",
"high": "159.400",
"low": "156.400",
"prev_close": "156.570"
}
}
]
}

API Restrictions

caution
  • The HK stocks quotation beyond the 20th will be delayed if the quote level is BMP.

Error Code

Protocol Error CodeBusiness Error CodeDescriptionTroubleshooting Suggestions
3301600Invalid requestInvalid request parameters or unpacking request failed
3301606Request rate limitReduce the frequency of requests
7301602Server errorPlease try again or contact a technician to resolve the issue
7301607Too many request symbolsReduce the number of symbols in a request