Skip to content

Interactive History Sync Jobs

Interactive history sync lets a Back Office manager inspect the symbol/source plan, start a job, poll per-symbol results, cancel work, and retry only unsuccessful symbols. It is a separate protocol from legacy SyncChartData. The server enables this workflow only when the selected feeder explicitly advertises the supported capability. Existing feeders that do not advertise it remain on their legacy behavior; the server does not emulate progress or silently start a legacy request.

All commands in this page use the regular TCP command envelope. The examples show the decoded JSON body; the platform response envelope includes extID, status, and data.

Access

The commands require an ADMIN, MANAGER, or DEALER session, the access_backoffice scope, and the set_accounts permission. A manager may read, cancel, or retry only jobs created by that manager. A super_admin may read and manage any job. Feeder configuration and credentials are not returned by the source-list command.

Workflow

  1. Call MngGetHistorySyncSources to find an enabled feeder and its capability state.
  2. Call MngPreviewHistorySync with either one internal symbol or a sec_index, plus a time range and mode. Review every returned source and error. Do not start if can_start is false.
  3. Call MngStartHistorySync with the same preview fields, the returned plan_revision, and a client-generated unique request_id.
  4. Poll MngGetHistorySyncJob or MngGetHistorySyncJobs for progress. Poll metadata every one or two seconds; the job response does not include candle arrays.
  5. Optionally call MngCancelHistorySync. Retry unsuccessful symbols with MngRetryHistorySync and a new request_id.

Progress is exposed through polling commands; the job protocol does not publish a separate progress event stream.

from and to are positive Unix timestamps in UTC seconds. The server normalizes the range to closed one-minute bars: the start is rounded up to a minute, and the end is rounded down and capped at the latest closed minute. A preview supports at most 200 symbols and a range of at most 10 years. The plan revision binds the start request to the previewed symbol/source plan; if that plan changed, preview again.

Request field Used by Type and constraints
index Preview, start Nonnegative feeder index.
symbol Preview, start Optional internal symbol name. When supplied, it selects one symbol.
sec_index Preview, start Required when symbol is omitted; selects the symbols in that security group.
from, to Preview, start Required integer Unix timestamps in UTC seconds; from must not exceed to; maximum range is 10 years.
mode Preview, start Required merge or replace_all.
plan_revision Start Required opaque value returned by preview.
request_id Start, retry Required unique idempotency key: 8–128 ASCII letters, digits, _, or -. Reuse the same value only to repeat the identical operation for the same owner.
job_id Get one job, cancel, retry Required job identifier returned by start/list/get.

mode is one of:

Value Effect
merge Upsert each returned closed minute. Existing candles outside the returned timestamps, including gaps omitted by the source, are preserved.
replace_all Stage all returned chunks for each symbol before atomically replacing that symbol's old history through the job cutoff. Newer closed bars and the current forming minute are preserved. Each symbol is committed independently.

These semantics apply to the interactive protocol only. They do not change the legacy flushData behavior. A symbol for which the feeder returns no candles is reported as no_data; an empty result never clears existing history.

Commands

MngGetHistorySyncSources

Request:

{"command":"MngGetHistorySyncSources"}

Response data fields:

Field Type Description
rows array Feeder availability and interactive protocol information.
rows[].index integer Feeder index used by preview/start.
rows[].name string Display name of the feeder.
rows[].enabled boolean Whether the feeder is enabled.
rows[].interactive boolean Whether the feeder is ready for the interactive protocol.
rows[].protocol integer or null Supported interactive protocol version; null when it is not available.
rows[].status string ready, unavailable, or legacy.
rows[].message string Human-readable readiness explanation; may be empty.
count integer Number of returned feeder rows.

Complete example:

{"extID":"r-101","status":200,"data":{"rows":[{"index":7,"name":"SCT market data","enabled":true,"interactive":true,"protocol":1,"status":"ready","message":""},{"index":8,"name":"Legacy provider","enabled":true,"interactive":false,"protocol":null,"status":"legacy","message":"Interactive history sync is not supported by this feeder"}],"count":2}}

MngPreviewHistorySync

Provide either symbol or sec_index. A group preview resolves the symbols from that security group. from, to, index, and mode are required.

Request for one symbol:

{"command":"MngPreviewHistorySync","index":7,"symbol":"EURUSD","from":1794787200,"to":1794873600,"mode":"merge"}

Request for a security group:

{"command":"MngPreviewHistorySync","index":7,"sec_index":2,"from":1794787200,"to":1794873600,"mode":"replace_all"}

Response data fields:

Field Type Description
index integer Selected feeder index.
mode string Normalized mode, merge or replace_all.
from integer Normalized inclusive start timestamp in UTC seconds.
to integer Normalized inclusive end timestamp in UTC seconds.
interactive boolean Whether the feeder advertised the interactive protocol.
can_start boolean Whether the request is valid and can be started now.
plan_revision string Opaque revision for the previewed plan; pass unchanged to start.
symbols array Resolved local symbols and their feeder source names.
symbols[].symbol string Internal platform symbol.
symbols[].source string Name requested from the feeder.
symbols[].error string Per-symbol mapping/validation error; empty when valid.
errors array of strings Plan-level validation errors.

Complete example:

{"extID":"r-102","status":200,"data":{"index":7,"mode":"merge","from":1794787200,"to":1794873540,"interactive":true,"can_start":true,"plan_revision":"rev-8f31a6","symbols":[{"symbol":"EURUSD","source":"EURUSD","error":""},{"symbol":"EURUSD.w","source":"EURUSD.w","error":""}],"errors":[]}}

MngStartHistorySync

The request contains the preview inputs unchanged, plus plan_revision and a unique request_id. Repeating the same request with the same owner and request_id returns the same job. Reusing that key for different inputs is a conflict. If the start response is lost, query the jobs list before retrying; use the same request_id to safely repeat the identical start request.

Request:

{"command":"MngStartHistorySync","index":7,"symbol":"EURUSD","from":1794787200,"to":1794873600,"mode":"merge","plan_revision":"rev-8f31a6","request_id":"bo-20261118-9ad47c"}

Success response:

{"extID":"r-103","status":200,"data":{"job":{"id":"hs-000041","request_id":"bo-20261118-9ad47c","index":7,"feeder_name":"SCT market data","mode":"merge","from":1794787200,"to":1794873540,"status":"queued","created_at":1795000000,"updated_at":1795000000,"finished_at":0,"cancel_requested":false,"total_symbols":1,"completed_symbols":0,"failed_symbols":0,"processed_chunks":0,"total_chunks":1,"received_candles":0,"imported_candles":0,"current_symbol":"EURUSD","error":"","items":[{"symbol":"EURUSD","source":"EURUSD","status":"queued","processed_chunks":0,"total_chunks":1,"received_candles":0,"imported_candles":0,"attempt":0,"error":"","first_time":0,"last_time":0}]}}}

MngGetHistorySyncJobs

Returns up to the latest 20 jobs visible to the caller. count is the number of rows returned, not the total number of stored jobs. The store accepts up to 1,000 job records; when full, new jobs are rejected with HISTORY_SYNC_BUSY and old records are not silently deleted. The command takes no parameters.

{"command":"MngGetHistorySyncJobs"}

Response data is { "rows": [<job>, ...], "count": integer }; each job uses the complete Job schema below. Example:

{"extID":"r-104","status":200,"data":{"rows":[{"id":"hs-000041","request_id":"bo-20261118-9ad47c","index":7,"feeder_name":"SCT market data","mode":"merge","from":1794787200,"to":1794873540,"status":"running","created_at":1795000000,"updated_at":1795000003,"finished_at":0,"cancel_requested":false,"total_symbols":1,"completed_symbols":0,"failed_symbols":0,"processed_chunks":1,"total_chunks":1,"received_candles":360,"imported_candles":0,"current_symbol":"EURUSD","error":"","items":[{"symbol":"EURUSD","source":"EURUSD","status":"fetching","processed_chunks":1,"total_chunks":1,"received_candles":360,"imported_candles":0,"attempt":1,"error":"","first_time":0,"last_time":0}]}],"count":1}}

MngGetHistorySyncJob

Request:

{"command":"MngGetHistorySyncJob","job_id":"hs-000041"}

Response:

{"extID":"r-105","status":200,"data":{"job":{"id":"hs-000041","request_id":"bo-20261118-9ad47c","index":7,"feeder_name":"SCT market data","mode":"merge","from":1794787200,"to":1794873540,"status":"completed","created_at":1795000000,"updated_at":1795000008,"finished_at":1795000008,"cancel_requested":false,"total_symbols":1,"completed_symbols":1,"failed_symbols":0,"processed_chunks":1,"total_chunks":1,"received_candles":360,"imported_candles":360,"current_symbol":"","error":"","items":[{"symbol":"EURUSD","source":"EURUSD","status":"completed","processed_chunks":1,"total_chunks":1,"received_candles":360,"imported_candles":360,"attempt":1,"error":"","first_time":1794787200,"last_time":1794808740}]}}}

MngCancelHistorySync

Cancellation is cooperative. Symbols committed before cancellation remain committed. A commit already in progress may finish before the cancellation is observed; reload the job and affected history to determine the final outcome.

Request and response:

{"command":"MngCancelHistorySync","job_id":"hs-000041"}
{"extID":"r-106","status":200,"data":{"job":{"id":"hs-000041","request_id":"bo-20261118-9ad47c","index":7,"feeder_name":"SCT market data","mode":"merge","from":1794787200,"to":1794873540,"status":"cancelling","created_at":1795000000,"updated_at":1795000004,"finished_at":0,"cancel_requested":true,"total_symbols":1,"completed_symbols":0,"failed_symbols":0,"processed_chunks":1,"total_chunks":1,"received_candles":360,"imported_candles":0,"current_symbol":"EURUSD","error":"","items":[{"symbol":"EURUSD","source":"EURUSD","status":"fetching","processed_chunks":1,"total_chunks":1,"received_candles":360,"imported_candles":0,"attempt":1,"error":"","first_time":0,"last_time":0}]}}}

MngRetryHistorySync

Retry creates a new job for failed, no-data, cancelled, or interrupted symbols from the original frozen symbol/range/mode plan and cutoff. Previously completed symbols are not submitted again. Provide a new unique request_id for each retry operation.

Request:

{"command":"MngRetryHistorySync","job_id":"hs-000041","request_id":"bo-20261118-retry-9ad47c"}

The response has the same { "job": <Job> } shape as MngStartHistorySync.

Job response fields

Field Type Description
id string Server-generated job identifier.
request_id string Client idempotency key for this creation/retry request.
index integer Feeder index.
feeder_name string Feeder display name captured for this job.
mode string merge or replace_all.
from, to integer Normalized inclusive UTC seconds for closed M1 bars.
status string Job lifecycle state: queued, running, waiting_source, cancelling, completed, partial, failed, cancelled, or interrupted.
created_at, updated_at integer Unix timestamps in seconds.
finished_at integer Completion timestamp, or 0 while unfinished.
cancel_requested boolean Whether cooperative cancellation has been requested.
total_symbols integer Number of planned symbols.
completed_symbols integer Number of symbols completed successfully.
failed_symbols integer Number of symbols that failed, returned no data, or were interrupted.
processed_chunks integer Chunks processed across all symbols.
total_chunks integer Planned chunks across all symbols.
received_candles integer Valid candles received from the feeder.
imported_candles integer Candles committed to local history.
current_symbol string Symbol currently being processed, or empty when none.
error string Job-level error; empty if none.
items array Per-symbol status and counters.
items[].symbol string Internal platform symbol.
items[].source string Feeder source name.
items[].status string queued, fetching, waiting_source, staging, committing, completed, no_data, failed, cancelled, or interrupted.
items[].processed_chunks, items[].total_chunks integer Per-symbol chunk progress.
items[].received_candles, items[].imported_candles integer Per-symbol received and committed candle counts.
items[].attempt integer Current/last fetch attempt number.
items[].error string Per-symbol error; empty if none.
items[].first_time, items[].last_time integer First/last imported candle timestamp, or 0 when no candle was committed.

Persistence, restart, and retry

Jobs are persisted. After a server restart, nonterminal jobs become interrupted; the server does not automatically replay them. If the server stopped during a storage commit, inspect the history and job before retrying: the operation's final commit outcome may need reconciliation. Do not interpret an interrupted job as proof that no candles were written.

Errors

Error responses use the common TCP shape:

{"extID":"r-error","status":409,"data":{"error":"HISTORY_SYNC_UNSUPPORTED","message":"The selected feeder does not support interactive history sync"}}
Status Error Meaning
400 INVALID_DATA Invalid command fields, range, mode, or request identifier.
403 FORBIDDEN The session lacks required scope/permission or does not own the job.
404 HISTORY_SYNC_NOT_FOUND The requested job does not exist or is not visible to the caller.
409 HISTORY_SYNC_UNSUPPORTED The selected feeder does not explicitly support this protocol.
409 HISTORY_SYNC_BUSY Feeder or overlapping symbol work is already active.
409 HISTORY_SYNC_PLAN_CHANGED The symbol/source plan changed after preview; preview again.
409 HISTORY_SYNC_REQUEST_CONFLICT The idempotency key was reused with different request data.
409 HISTORY_SYNC_RECONCILIATION_REQUIRED A previous commit outcome is uncertain; inspect persisted history and create a new preview.
409 HISTORY_SYNC_INTERRUPTED The feeder stopped/restarted or returned a mismatched chunk during a job.
409 HISTORY_SYNC_FETCH_FAILED The feeder fetch failed, returned invalid state/data, or exceeded its fetch deadline.
500 HISTORY_SYNC_STORAGE_ERROR The job or candle storage operation failed; reload state before retrying.

The exact message is diagnostic text and may vary. Legacy SyncChartData errors and acknowledgment semantics remain documented separately.

SCT Feeder wire protocol

The server uses existing feeder CustomAction dispatch. This is an additive SCT Feeder capability; it does not add SDK virtual methods or change SDK ABI. See SCT Feeder history actions for complete action payloads and responses. The server performs candle staging and commit; the new actions return bounded chunks and do not call the legacy SDK candle-import callback.