Skip to main content

Candlesticks

Interface Description

  • Function description:

    • Returns to Instrument in the window aggregated data.

    • According to the last N K-lines of the stock code, it supports various granularity K-lines such as m1 and m5. Currently, only the K-line with the previous weight is provided for the daily K-line and above, and only the un-weighted K-line is provided for the minute K.

  • Request URL: /market-data/bars

  • Request method: Support HTTP and GRPC protocol.

    • HTTP only supports A-share (China Connect) and Hong Kong stock BMP query.

    • GRPC can support all market quotations, if the user have the corresponding quotation authority.

  • Frequency limit: The calling frequency of each AppId is limited to 60 times per minute.

Request Parameters

ParameterTypeRequired fieldsDescription
symbolStringYesSecurities code
categoryStringYesSecurity Type, Enumeration, Reference:Category
timespanStringYesK-line time granularity, reference: Timespan
countIntegerNoThe number of lines: the default is 200, and the maximum limit is 1200

Response Parameter

FieldTypeDescription
timeStringUTC time, eg: "2021-12-28T09:00:09.945+0000"
openStringOpening price
closeStringClosing price
highStringHighest price
lowStringLowest price
volumeStringTrading volume

Request Example

HTTP

from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region

api_client = ApiClient(your_app_key, your_app_secret, Region.HK.value)
api = API(api_client)
response = api.market_data.get_history_bar(symbols, category, timespan)
if response.status_code == 200:
bars = response.json()

gRPC

from webullsdktrade.grpc_api import API
from webullsdkquotescore.grpc.grpc_client import GrpcApiClient
from webullsdkcore.common.region import Region

grpc_client = GrpcApiClient(your_app_key, your_app_secret, Region.HK.value)
api = API(grpc_client)
response = api.market_data.get_history_bar(symbols, category, timespan)
if response.status_code == 200:
bars = response.json()

Response Example

[
{
"time": "2021-12-28T09:00:00.000+0000",
"open": "100",
"close": "101",
"high": "105",
"low": "99",
"volume": "100000"
}
]