US Stock Candlestick Chart
US Stock Candlestick Chart
Documentation
API Introduction
This API provides historical K-line data query service for specified US stock symbols. It supports various time granularities from 1-minute to yearly K-lines, returning complete market data fields including open, high, low, close prices, trading volume, and turnover. It is suitable for quantitative analysis and technical chart plotting.
Use Cases
- Financial Terminal Development: Provide real-time or historical K-line chart data support for trading software.
- Quantitative Strategy Backtesting: Obtain historical price series at different time granularities for strategy validation.
- Market Monitoring Systems: Build custom US stock price fluctuation monitoring and alert mechanisms.
Request and Response Description
- Request Method: POST
- Core Parameters:
symbol(Required): US stock symbol, e.g., AAPL.type(Required): K-line type, supporting 11 granularities from 1 (1-minute) to 86400 (yearly K).limit(Optional): Number of items to return, default is 10.- Response Results: Standard JSON structure, including status code
code, messagemsg, and data bodydata. Thelistarray within the data body containsopen,high,low,close,volume,amount, anddaytimestamp for each K-line.
Integration Suggestions
- Parameter Validation: Ensure
symbolis a valid US stock code andtypevalue is within the enumerated range defined in the documentation. - Frequency Control: For high-frequency calls, it is recommended to add a local caching mechanism to avoid repeatedly requesting data for the same symbol and time period.
- Error Handling: Always parse the
codefield. If the status code is not 200, refer to themsginformation for error troubleshooting.
Integration Examples
Includes ready-to-use Shell, Python, Go, Java, and PHP examples for direct integration.
Request Example
{
"symbol": "品种代码",
"type": "k线类型, 1:1分钟,5:五分钟;15:15分钟;30:30分钟,60:60分钟,120:120分钟,240:日K,1200:周K,7200:月K,21600...",
"limit": "返回条数,默认10"
}Response Example
{
"msg": "成功",
"code": 200,
"taskNo": "279719607212732212780135",
"data": {
"list": [
{
"volume": 1689339,
"high": "220.5800",
"amount": 371739000,
"low": "219.6200",
"day": "2024-07-03 11:00:00",
"close": "220.5400",
"open": "219.8300"
}
]
}
}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 | 品种代码 |
| properties.type | object | {...} |
| properties.type.type | string | 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 | {...} |