Chart Generation
Chart Generation API
Generate professional K-line chart images with technical indicators overlay.
Endpoint
| Method | Endpoint |
|---|---|
| POST | /v2/tradingview/advanced-chart/storage |
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
symbol | string | ✅ | - | Stock code (e.g., SZSE:000001, 000001.SZ) |
interval | string | - | 1d | Time interval: 1m, 5m, 15m, 1h, 4h, 1d, 1w |
studies | array | - | [] | Technical indicators list |
width | int | - | 800 | Image width (px) |
height | int | - | 600 | Image height (px) |
format | string | - | png | Format: png / jpeg |
theme | string | - | light | Theme: light / dark |
from_date | string | - | - | Start date (YYYY-MM-DD) |
to_date | string | - | - | End date (YYYY-MM-DD) |
Try It
POST
/v2/tradingview/advanced-chart/storageSupported Technical Indicators (studies)
[
{"name": "Bollinger Bands"},
{"name": "Relative Strength Index"},
{"name": "Volume"},
{"name": "MACD"}
]
Code Examples
Python
import requests
API_KEY = "your_api_key"
response = requests.post(
"https://tickerlab.org/v2/tradingview/advanced-chart/storage",
headers={"X-API-Key": API_KEY},
json={
"symbol": "SZSE:000001",
"interval": "1d",
"width": 1200,
"height": 800,
"theme": "dark",
"studies": [
{"name": "Bollinger Bands"},
{"name": "Volume"}
]
}
)
result = response.json()
print(f"Chart URL: {result['url']}")
print(f"Expires at: {result['expireAt']}")
# Download image
import urllib.request
urllib.request.urlretrieve(result['url'], 'chart.png')
JavaScript
const response = await fetch(
'https://tickerlab.org/v2/tradingview/advanced-chart/storage',
{
method: 'POST',
headers: {
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
symbol: 'SZSE:000001',
interval: '1d',
width: 1200,
height: 800,
theme: 'dark',
studies: [{ name: 'Bollinger Bands' }]
})
}
);
const result = await response.json();
console.log('Chart URL:', result.url);
cURL
curl -X POST "https://tickerlab.org/v2/tradingview/advanced-chart/storage" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"symbol": "SZSE:000001",
"interval": "1d",
"width": 1200,
"height": 800,
"theme": "dark",
"studies": [{"name": "Bollinger Bands"}]
}'
Response Example
{
"url": "https://tickerlab.org/static/charts/abc123.png",
"size": 45678,
"etag": "abc123def456",
"createdAt": "2024-01-15T10:30:00Z",
"expireAt": "2024-01-15T11:30:00Z"
}
Notes
- Generated images expire after 1 hour
- Recommended image size not exceeding 2000x2000
- Supported stock code formats:
000001.SZ,SZSE:000001,600000.SH,SSE:600000