MM Flow

mmflow Charts

Replay session manifests

Export and import replay setup as a versioned config manifest. Replay layer loading is independent and hardened without storing large market-data arrays.

Config only

Replay JSON stores symbol, range, speed, source, enabled layers, and layer options. It does not embed fetched candles, events, trades, footprint bars, or orderbook snapshots.

Safe import

The parser rejects unsupported versions, unsafe keys such as apiKey/privateKey/token, oversized JSON, and market-data array fields before applying anything.

Compact URLs

Share URLs use small query params for replay setup only. Drawings, ChartScript source, API keys, and market data arrays stay out of the URL.

Layer-isolated loading

Historical candles, events, trades, footprint, and orderbook snapshots load independently. A failed optional layer does not break the rest of the replay session.

Package helpers

The replay manifest helpers live in @mmflow/chartsbecause they describe chart/replay setup, not an authenticated data request. Package-level symbol validation accepts safe market strings up to 32 characters instead of hardcoding the playground dropdown.

Replay config helpers
import {
  parseReplaySessionConfig,
  replaySessionConfigFromQuery,
  replaySessionConfigToQuery,
  serializeReplaySessionConfig,
  type ReplaySessionConfig,
} from "@mmflow/charts";

const config: ReplaySessionConfig = {
  version: 1,
  symbol: "BTC",
  venue: "hl",
  from: 1730000000000,
  to: 1730003600000,
  resolution: "1m",
  speed: 10,
  source: "historical",
  layers: {
    candles: true,
    events: true,
    trades: true,
    footprint: false,
    orderbook: false,
  },
  events: { types: ["whale", "funding"] },
};

const json = serializeReplaySessionConfig(config);
const parsed = parseReplaySessionConfig(json);
const query = replaySessionConfigToQuery(config);
const fromQuery = replaySessionConfigFromQuery(query);

Share URL format

The playground can copy a compact URL built from query params. Thelayers parameter wins over older booleans likereplayEvents, tradeTape,footprintReplay, and orderbookReplay.

Compact replay URL
/developers/playground?replay=1&source=historical&symbol=BTC&venue=hl&from=1730000000000&to=1730003600000&resolution=1m&speed=10&layers=candles,events,trades&eventTypes=whale,funding

Loading behavior

The playground owns an in-memory, per-instance replay loader. Changing symbol, range, or layers cancels stale historical requests; duplicate requests within one load cycle are deduped; successful and partial responses may be served from a small LRU cache. Synthetic replay stays deterministic and offline. Cached data is never exported in replay manifests or share URLs. Historical mode also shows advisory data quality from /api/v1/history/status; a status probe failure does not block replay loading.

Optional extras

Drawing JSON can be included only by explicit export action and must pass the existing drawing parser before import applies. ChartScript is metadata-only in Phase 14: enabled/example/overlay are exportable, but custom user-authored script source is intentionally omitted.

Limitations

Replay session export is not cloud persistence, collaborative sharing, a market-data export, a saved account workspace, backtesting, or order simulation. Applying a manifest may trigger the normal history endpoints for enabled layers, and failures remain isolated to each layer. The app-local loading coordinator is an implementation detail of the playground, not a public SDK API.

Repo starter template

Copy frontend/examples/replay-workbench for a compact local replay controller using deterministic synthetic events and config-only export.