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
- Preview and apply bounded bulk candle edits or deletions
- Delete a candle
- Delete a candle range
- Fix spike candles
- Preview, start and monitor interactive feeder history synchronization
- Request legacy acknowledgment-only chart synchronization
- Set a custom live quote through the standard quote pipeline
Candle reads and writes use the server's candle history storage through
QuoteManager. Interactive sync orchestration is handled by the history sync
service and an explicitly capable feeder.
Access Control¶
Public candle read methods keep their existing market-data access.
Manager write and maintenance methods require set_accounts. Manager permissions are resolved from the cached staff manager record; token payload is used only for manager id and session type.
Candle Data Model¶
All candlestick data is usually transferred in the compact array format:
[open, high, low, close, volume, time]
Exception:
DeleteChartCandlecurrently expects[open, high, low, close, time, volume]
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¶
Typical validation rules include:
symbolfor symbol-scoped operationsfrom,tofor range-based history requestsindex,sec_index,flushDatafor feeder-driven sync/import operations- 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 |
| Get Candles Data By Count | Retrieve latest OHLC candles by count without a date range |
| Import Candles Data | Import historical candle data with range replacement or full overwrite |
| Update Candle Data | Update a specific existing candle in history |
| Preview or Mutate Candles | Preview and apply bounded edits or deletions to closed one-minute candles |
| Delete Candle Data | Delete a specific candle from historical data |
| Delete Candle Period | Delete a whole historical candle interval for one symbol |
| Fix Spike Candle | Automatically detect and correct abnormal spike candles |
| Interactive History Sync Jobs | Preview, start, monitor, cancel and retry opt-in feeder history jobs |
| Legacy Sync History Chart Data | Request a legacy feeder sync for one symbol or a security-group symbol list; its acknowledgment is not a completion report |
| Set Custom Quote | Set a custom live quote through the standard quote pipeline |
Data Flow¶
flowchart LR
Client --> TCP_API
TCP_API --> QuoteManager
TCP_API --> CoreOnQuote[Core::OnQoute]
CoreOnQuote --> QuoteManager
QuoteManager --> HistoryStorage
Performance Recommendations¶
- Use interactive sync jobs for capability-aware preview and per-symbol results; legacy
SyncChartDataonly reports whether the feeder accepted the request - Import data in batches
- Use
flushDatacarefully in production environments