Chart TCP API¶
Overview¶
The Chart section describes how historical candlestick (OHLC) data is managed via the TCP API of the trading server.
The Chart API provides a complete set of operations for managing price history:
- Retrieve historical candles
- Import candle history
- Update a single candle
- Delete a candle
- Fix spike candles
- Synchronize chart history
All operations are handled internally by the QuoteManager module and
use the unified CandleStore structure.
Candle Data Model¶
All candlestick data is transferred in a compact array format:
[open, high, low, close, volume, time]
Standard Response Structure¶
{
"structure": ["open", "high", "low", "close", "volume", "time"],
"data": [
[1.1234, 1.1250, 1.1200, 1.1240, 1500, 1700000000]
]
}
Field Description¶
Field Type Description
open double Opening price high double Highest price during period low double Lowest price during period close double Closing price volume double Trading volume time int64 Unix timestamp
Validation Rules¶
Most methods require:
symbol--- required parameterfrom,to--- time range (Unix time)- properly formatted
candlesarray - strict OHLC structure compliance
If validation fails, the API returns:
{
"error": "INVALID_DATA",
"message": "validation error description"
}
Navigation¶
| Method Name | Description |
|---|---|
| Get Candles Data | Retrieve historical OHLC candles within a specified time range |
| Import Candles Data | Import historical candle data with optional full history replacement (flushData) |
| Update Candle Data | Update a specific existing candle in history |
| Delete Candle Data | Delete a specific candle from historical data |
| Fix Spike Candle | Automatically detect and correct abnormal spike candles |
| Sync History Chart Data | Synchronize historical chart data between data sources or servers |
Data Flow¶
flowchart LR
Client --> TCP_API
TCP_API --> QuoteManager
QuoteManager --> HistoryStorage
Performance Recommendations¶
- Limit the
from/totime range when possible - Import data in batches
- Use
flushDatacarefully in production environments