Forex Candlestick Charts
Forex Candlestick Charts
Documentation
API Introduction
This API provides historical and real-time K-line market data for major foreign exchange pairs. Developers can specify a currency pair code (symbol) and time period (type) to obtain structured array data including open, close, high, low prices, change, and timestamp, suitable for building financial charts or conducting technical analysis.
Use Cases
- Quantitative Trading Strategy Backtesting: Obtain historical price series at different time granularities (e.g., 1-minute, 5-minute, daily) for strategy validation.
- Financial Terminal Development: Provide real-time candlestick chart data sources for forex trading software.
- Market Quote Monitoring: Monitor short-term volatility trends and price anomalies for specific currency pairs.
Request and Response Description
- Request Method: POST
- Core Parameters:
symbol(Required): Foreign exchange pair code, e.g., FXINDEX. Refer to the code table for specific values.type(Required): K-line period, supporting 0 (daily K), 1 (1-minute), 5 (5-minute), 15, 30, 60, 120, 240 minutes, etc.limit(Optional): Number of data items to return, default is 10.- Response Results:
data.lines: A two-dimensional array, where each item corresponds to a K-line, with fields ordered according to thefieldsdefinition (e.g., open, close, high, low, change, changeRate, tick_at).data.fields: Field definition array, clarifying the meaning of values inlines.code/msg: API status code and description, 200 indicates success.
Integration Suggestions
- Period Selection: Choose the appropriate
typevalue based on business requirements. For high-frequency trading, minute-level is recommended; for trend analysis, daily K-lines are suggested. - Data Parsing: The returned K-line data is in a compact array format. Please strictly parse the values in
linesaccording to the order of thefieldsarray to avoid misalignment. - Frequency Control: Please be aware of API call rate limits. It is recommended to add a caching mechanism on the client side to reduce repeated requests for data from the same period.
Integration Examples
Includes ready-to-use Shell, Python, Go, Java, and PHP examples for direct integration.
Request Example
{
"symbol": "品种代码,如:FXINDEX。详见代码表",
"type": "k线类型,0:日k,1:1分钟,5:五分钟;15:十五分钟;30:30分钟,60:60分钟,120:120分钟,240:240分钟",
"limit": "返回条数,默认10"
}Response Example
{
"msg": "成功",
"code": 200,
"taskNo": "202960247220113090298671",
"data": {
"lines": [
[
12.879,
12.8786,
12.879,
12.8786,
"-0.00040",
"-0.0031",
1713761100
]
],
"fields": [
"open",
"close",
"high",
"low",
"change",
"changeRate",
"tick_at"
]
}
}Request Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.symbol | object | {...} |
| properties.symbol.type | string | string |
| properties.symbol.description | string | 品种代码,如:FXINDEX。详见代码表 |
| properties.type | object | {...} |
| properties.type.type | string |
Response Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.msg | object | {...} |
| properties.msg.type | string | string |
| properties.msg.example | string | 成功 |
| properties.msg.description | string | 返回码对应描述 |
| properties.code | object | {...} |