[Data Source Manager]

Background multi-page OHLCV backfill to a past date, dataset validation, and gap fills — without blocking the chart.

Data Source Manager

Deep history accumulation for a symbol + source + timeframe, down to a past date. Work runs fully in the background: chart, live streams, and the editor stay free.

Abstract

PieceRole
Topbar LoadOne venue page (or historyBars) straight onto the chart
Data Sources panelQueue backfill jobs, watch progress, load cache onto chart
Walk-back pagesMulti-page REST with endTime only (avoids start+end one-page traps)
Validate + gap-fillAfter backfill, check density and re-download holes
IDB bars cacheDurable OHLCV per source|symbol|interval

Open from the topbar Data button, or command palette → Toggle Data Source Manager.

Conceptual model

How to use

  1. Open Data (Data Sources panel).
  2. Set symbol, source / exchange, timeframe, and accumulate to (UTC date).
  3. Optionally check Apply to chart when complete.
  4. Click Start background backfill — the job id appears immediately; work continues detached.
  5. Watch phases: BackfillingValidatingFilling gapsComplete (or Partial).
  6. Click Load to chart when ready (or rely on apply-when-complete).

Pause / resume / cancel apply between pages. Multiple jobs queue with low concurrency (rate-limit friendly).

Phases

PhaseBehavior
BackfillWalk newest → older using endTime + page limit only. Never send startTime+endTime together to venue APIs that return the first N bars from start (would falsely complete in one page).
ValidateMeasure coverage from target past date → job end time: leading, internal, and trailing holes via interval step + tolerance.
Gap-fillFor each gap window, walk-back download again; re-validate (several rounds).
DonedatasetComplete when dense; otherwise Partial with remaining gap count (venue may lack older history).

Job fields (UI)

FieldMeaning
Bars / PagesCached bar count and network pages this job
Oldest / TargetCurrent oldest open time vs past-date target
GapsDetected holes · how many fill attempts landed bars
Coveragefull / partial / in progress

Relation to Topbar Load

Topbar LoadData Source Manager
Blocks UIYes (status loading)No (background jobs)
DepthSingle page / historyBarsMulti-page to past date
ChartAlways paintsOnly on Load to chart or apply-when-complete
CacheEphemeral store.barsDurable IDB bars-cache

Use Load for desk-speed symbol switches; use the manager when you need years of 1m/1h/1d history for research.

Internals

PathRole
src/data/data-source-manager.tsJob queue, walk-back, validate, gap-fill
src/data/bars-cache.tsMemory-first + IDB durable OHLCV cache
src/data/bars-gaps.tsGap detection / coverage report
src/ui/DataSourceManagerPanel.tsxPanel UI
src/plugins/types.tsSourceOpts: startTime?, endTime?, signal?
src/sources/catalog.tsVenue date params + sourcePageLimit

bars-cache performance (2.0.1+)

bars-cache.ts is memory-first:

APIBehavior
getCachedBarsServe warm in-memory series immediately; cold miss hydrates from IndexedDB then fills memory
getCachedBarCountCount without cloning the full series when warm
Range / windowsliceBarsForLoad + count helpers avoid full clones for progress UI
Soft capsBARS_CACHE_MAX (100k bars/series), BARS_CACHE_MAX_SERIES (48 keys)

DSM gap-fill progress uses getCachedBarCount instead of loading full series each tick.

Limits & safety

  • Max concurrent network jobs: 1 (queue the rest).
  • Caps: pages per walk, bars per series (soft IDB cap), gap-fill rounds.
  • Backfill forces fallback: false so synthetic walks do not fake venue history.
  • Cancel uses AbortController on in-flight fetches (symbol / job switches abort mid-page).

See also