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.
URL: /market-data/bars
Method: GET
Rate limit: The calling frequency of each App ID is limited to 60 times per minute.
Request Parameters
Parameter | Type | Required fields | Description |
---|---|---|---|
symbol | String | Yes | Securities code, eg: BTCUSD |
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 1440 |
Response Parameter
Field | Type | Description |
---|---|---|
timestamp | Long | UTC timestamp, eg: 1739100939000 |
open | String | Opening price |
close | String | Closing price |
high | String | Highest price |
low | String | Lowest price |
Request Example
- Python
- Java
from webullpaysdkcore.client import ApiClient
from webullpaysdkmdata.common.category import Category
from webullpaysdkmdata.common.timespan import Timespan
from webullpaysdkmdata.request.get_historical_bars_request import GetHistoricalBarsRequest
from webullpaysdkcore.common.region import Region
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
request = GetHistoricalBarsRequest()
request.set_category(Category.CRYPTO.name)
request.set_symbol("BTCUSD")
request.set_count(1440)
request.set_timespan(Timespan.M1.name)
response = api_client.get_response(request)
if response.status_code == 200:
bars = response.json()
print(bars)
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey("<your_app_key>")
.appSecret("<your_app_secret>")
.regionId(Region.us.name())
.build();
try (QuotesApiClient quotesApiClient = new HttpQuotesApiClient(apiConfig)) {
// get bars
List<Bar> bars = quotesApiClient.getBars("BTCUSD", Category.CRYPTO.name(), Timespan.D.name(), 200);
//print
System.out.println(JsonSerializer.toJson(bars, SerializeConfig.builder().underscoresToCamel(true).build()));
}
Response Example
[
{
"timestamp": 1739100939000,
"open": "100",
"close": "101",
"high": "105",
"low": "99"
}
]