Skip to content

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
  • Delete a candle range
  • 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 usually transferred in the compact array format:

[open, high, low, close, volume, time]

Exception:

  • DeleteChartCandle currently 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:

  • symbol for symbol-scoped operations
  • from, to for range-based history requests
  • index, sec_index, flushData for feeder-driven sync/import operations
  • properly formatted candles array
  • 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 range replacement or full overwrite
Update Candle Data Update a specific existing candle in history
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
Sync History Chart Data Request feeder-side history sync for one symbol or a security-group symbol list

Data Flow

flowchart LR
    Client --> TCP_API
    TCP_API --> QuoteManager
    QuoteManager --> HistoryStorage

Performance Recommendations

  • When using SyncChartData, pass from/to explicitly if you need a narrower sync window than the default 4 years
  • Import data in batches
  • Use flushData carefully in production environments