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
Parameter | Type | Required fields | Description |
---|---|---|---|
symbol | String | Yes | Securities code |
category | String | Yes | Security Type, Enumeration, Reference:Category |
timespan | String | Yes | K-line time granularity, reference: Timespan |
count | Integer | No | The number of lines: the default is 200, and the maximum limit is 1200 |
Response Parameter
Field | Type | Description |
---|---|---|
time | String | UTC time, eg: "2021-12-28T09:00:09.945+0000" |
open | String | Opening price |
close | String | Closing price |
high | String | Highest price |
low | String | Lowest price |
volume | String | Trading volume |
Request Example
HTTP
- Python
- Java
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()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.hk.name())
.build();
try (QuotesApiClient quotesApiClient = new HttpQuotesApiClient(apiConfig)) {
List<Bar> bars = quotesApiClient.getBars(symbols, category, timespan);
}
gRPC
- Python
- Java
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()
try (QuotesApiClient quotesApiClient = QuotesApiClient.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.hk.name())
.build()) {
List<Bar> bars = quotesApiClient.getBars(symbols, category, timespan);
}