Getting Started
This API provides real-time stock data from Eastmoney. All endpoints return JSON responses.
Base URL
https://your-domain.pages.devResponse Format
All responses include success field and either data or error.
API Endpoints
GET
/api/stock/priceGet current stock price
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
stock_code | string | Required | 6-digit stock code (e.g., 600519) |
Example Request
GET /api/stock/price?stock_code=600519Example Response
{
"success": true,
"data": {
"stockCode": "600519",
"price": 1688.88
}
}GET
/api/stock/klinesGet K-line (candlestick) data
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
stock_code | string | Required | 6-digit stock code |
limit | number | Optional | Number of data points (default: 120, max: 1000) |
Example Request
GET /api/stock/klines?stock_code=600519&limit=30Example Response
{
"success": true,
"data": [
{
"date": "2024-01-15",
"open": 1680.00,
"close": 1688.88,
"high": 1695.00,
"low": 1675.50,
"volume": 12345678,
"amount": 20876543210
}
]
}GET
/api/stock/ma20_breakoutCheck MA20 breakout condition
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
stock_code | string | Required | 6-digit stock code |
min_days | number | Optional | Minimum breakout days (default: 3) |
max_days | number | Optional | Maximum breakout days (default: 7) |
Example Request
GET /api/stock/ma20_breakout?stock_code=600519Example Response
{
"success": true,
"data": {
"breakout": true,
"breakoutDays": 5,
"ma20": 1650.25,
"currentPrice": 1688.88,
"priorTrend": "sideways"
}
}GET
/api/stock/infoGet comprehensive stock information
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
stock_code | string | Required | 6-digit stock code |
Example Request
GET /api/stock/info?stock_code=600519Example Response
{
"success": true,
"data": {
"stockCode": "600519",
"name": "贵州茅台",
"price": 1688.88,
"open": 1680.00,
"high": 1695.00,
"low": 1675.50,
"prevClose": 1678.00,
"volume": 12345678,
"amount": 20876543210,
"turnoverRate": 0.98
}
}Health Check
GET
/api/health- Check API status