TraderX State 015 Proposal: Historical Synthetic Market Data and Charting
Context
We are working in the FINOS TraderX repository and Spec-Kit state model.
The current state graph includes:
- 008 Pricing Awareness and Market Data Streaming
- 009 Order Management and Matcher (C2 Advanced Demo)
- 010 Kubernetes Runtime
- 011 Tilt Kubernetes Dev Loop
- 012 Platform Convergence C3
- 013 Radius Platform (optional)
- 014 FDC3 Intent Interoperability
This proposal should become a new functional state:
015 Historical Synthetic Market Data and Charting
The new state should branch from:
012-platform-convergence-c3
similar to how 014 branches from 012.
This feature is intended to improve the realism, educational value, and demonstration capabilities of TraderX by introducing historical market data, charting, volatility analytics, and synthetic price history generation.
The implementation must follow the existing TraderX state-generation architecture and should be implemented as a proper Spec-Kit state rather than a one-off code change.
High-Level Goals
TraderX currently publishes synthetic market prices and supports pricing-aware order management.
We want to introduce:
- Historical price storage
- Intraday charting
- Historical charting
- Volatility calculations
- High/low statistics
- Deterministic synthetic history generation
- Optional seeding from public market data
- Market-data services that are architecturally separated from the live price publisher
- Future support for more advanced execution and fill simulations
The result should feel much closer to a realistic trading platform while remaining completely synthetic and safe for educational/demo use.
State Placement
Create a new state:
015-historical-synthetic-market-data
Suggested metadata:
track: functional
previous:
- 012-platform-convergence-c3
primaryLineageRole: canonical
convergenceLevel: none
isConvergence: false
This should not modify the intent of state 009.
Instead, it should layer new functionality on top of the converged platform.
Architectural Principles
Principle 1: Do Not Put Persistence Inside The Price Publisher
The existing price publisher should remain responsible for:
- generating synthetic prices
- publishing price events
- broadcasting market activity
The price publisher must NOT become responsible for:
- database writes
- historical persistence
- chart generation
- analytics calculations
- backfill generation
Principle 2: Use NATS As The Boundary
All market-data persistence should occur downstream of NATS.
Recommended architecture:
price-publisher
|
v
NATS
|
+--------------------+
| |
v v
live consumers market-data-recorder
|
v
market-data-db
The recorder should subscribe to the same pricing events already emitted by the system.
Principle 3: Historical Data Must Be Optional And Non-Invasive
If market-data persistence fails:
- pricing should continue
- order matching should continue
- the platform should remain operational
Historical storage is additive.
It must not become a dependency of the trading path.
New Components
Market Data Recorder
Create a new service:
Responsibilities:
- Subscribe to market price events
- Batch writes
- Persist ticks
- Generate OHLC bars
- Calculate high/low statistics
- Calculate volatility metrics
- Serve as source-of-truth for chart data
Non-responsibilities:
- Publishing live prices
- Matching orders
- Managing accounts
Market Data Bootstrapper
Create a new startup component:
Responsibilities:
- Execute on clean startup
- Load the TraderX security universe
- Obtain baseline prices
- Generate synthetic historical data
- Populate the market-data database
The bootstrapper should be idempotent.
Repeated startups should not endlessly duplicate data.
Market Data API
Create a new API surface:
Responsibilities:
- Serve charts
- Serve history
- Serve statistics
- Serve metadata
- Serve provenance information
Storage Design
Evaluate the best implementation.
Option A (Preferred)
Separate TimescaleDB instance.
Reasons:
- PostgreSQL compatibility
- Time-series optimization
- Easy chart queries
- Easy future scaling
Option B
Separate PostgreSQL instance.
Design schema so migration to TimescaleDB is trivial later.
Data Model
price_tick
Fields:
symbol
asset_class
timestamp
price
volume
bid
ask
source
synthetic
generated_run_id
price_bar_1m
symbol
bucket_time
open
high
low
close
volume
price_bar_5m
Optional.
Can be materialized or generated from 1m bars.
price_bar_1d
symbol
date
open
high
low
close
volume
security_price_profile
symbol
baseline_price
current_price
all_time_high
all_time_low
volatility
last_seeded_at
baseline_source
Historical Generation Requirements
Clean Startup
When a clean environment starts:
- Load securities
- Seed baseline prices
- Generate synthetic history
- Start live publishing
Public Baseline Pricing
Attempt to retrieve realistic recent prices.
Examples:
- Yahoo Finance compatible feeds
- AlphaVantage
- Stooq
- Other public/open market data providers
Implementation should be pluggable.
Failure to reach a provider must not break startup.
Offline Mode
Support fully offline operation.
Provide:
or equivalent reference data.
If no public source is available:
- use local seed prices
- continue startup
Deterministic Mode
Support:
TRADERX_MARKETDATA_SEED=12345
or equivalent.
The same seed should generate identical synthetic history.
This is valuable for:
- demos
- workshops
- tutorials
- automated tests
Synthetic Price Generation
Generate 2–5 days of synthetic history.
The generated history should:
- trend realistically
- exhibit volatility
- avoid obviously random behavior
- preserve continuity
Suggested inputs:
baseline price
volatility factor
daily drift
random seed
Avoid pure uniform random walks.
Prefer realistic market-like movement.
Potential enhancements:
- geometric Brownian motion
- volatility clustering
- mean reversion
- regime changes
Future Asset Classes
Design for future expansion:
equities
etfs
indices
crypto
fx
bonds
commodities
Do not hardcode equity assumptions into storage schemas.
Charting Requirements
Add chart support to the Angular UI.
Every priced security should support:
or equivalent.
Intraday View
Display:
- live price
- intraday history
- high
- low
Historical View
Display:
- daily history
- multi-day history
- trend
Statistics
Display:
- volatility
- high
- low
- current price
Disclaimer
Every chart and market-data view should clearly display:
Prices shown are synthetic simulation data. Initial baselines may be seeded from public market data, but generated prices do not represent actual market prices, executable quotes, or investment information.
Retention Strategy
Raw Ticks
Retain:
1 Minute Bars
Retain long-term.
Daily Bars
Retain indefinitely.
Performance Requirements
Historical persistence must never become a bottleneck.
Requirements:
- Batch inserts
- Back-pressure handling
- Async persistence
- Recorder failures isolated from trading services
- Recorder restart safe
- Bootstrap restart safe
Future Roadmap
Design this state so future states can support:
Advanced Fill Simulation
Examples:
- VWAP fills
- TWAP fills
- Slippage
- Market impact
- Liquidity curves
Strategy Simulation
Examples:
- Trend following
- Mean reversion
- Momentum
Market Replay
Ability to replay historical synthetic sessions.
Deliverables
Produce:
- State 015 specification
- State graph update
- ADR describing architecture decisions
- Market-data-recorder service
- Market-data-bootstrapper service
- Market-data-api service
- Database schema
- Docker Compose changes
- NATS integration
- Angular chart integration
- Synthetic price generation design
- Public-price seeding design
- Test plan
- Documentation
- Migration strategy
Expected Design Review Output
Before implementation:
- Inspect existing state-generation conventions.
- Identify the minimal set of generated assets required.
- Propose architecture.
- Identify risks.
- Present implementation plan.
- Explain why the chosen database architecture is appropriate.
- Explain how the design remains compatible with future execution simulation enhancements.
- Only then begin implementation.
Success Criteria
A newly started TraderX environment should:
- Display realistic-looking charts immediately after startup.
- Have 2–5 days of historical synthetic pricing available.
- Continue generating live synthetic prices.
- Persist history without affecting trading-path performance.
- Support future expansion into execution simulation and market replay.
- Remain fully functional when external market-data providers are unavailable.
- Clearly indicate that all displayed prices are synthetic.
TraderX State 015 Proposal: Historical Synthetic Market Data and Charting
Context
We are working in the FINOS TraderX repository and Spec-Kit state model.
The current state graph includes:
This proposal should become a new functional state:
015 Historical Synthetic Market Data and Charting
The new state should branch from:
similar to how 014 branches from 012.
This feature is intended to improve the realism, educational value, and demonstration capabilities of TraderX by introducing historical market data, charting, volatility analytics, and synthetic price history generation.
The implementation must follow the existing TraderX state-generation architecture and should be implemented as a proper Spec-Kit state rather than a one-off code change.
High-Level Goals
TraderX currently publishes synthetic market prices and supports pricing-aware order management.
We want to introduce:
The result should feel much closer to a realistic trading platform while remaining completely synthetic and safe for educational/demo use.
State Placement
Create a new state:
Suggested metadata:
This should not modify the intent of state 009.
Instead, it should layer new functionality on top of the converged platform.
Architectural Principles
Principle 1: Do Not Put Persistence Inside The Price Publisher
The existing price publisher should remain responsible for:
The price publisher must NOT become responsible for:
Principle 2: Use NATS As The Boundary
All market-data persistence should occur downstream of NATS.
Recommended architecture:
The recorder should subscribe to the same pricing events already emitted by the system.
Principle 3: Historical Data Must Be Optional And Non-Invasive
If market-data persistence fails:
Historical storage is additive.
It must not become a dependency of the trading path.
New Components
Market Data Recorder
Create a new service:
Responsibilities:
Non-responsibilities:
Market Data Bootstrapper
Create a new startup component:
Responsibilities:
The bootstrapper should be idempotent.
Repeated startups should not endlessly duplicate data.
Market Data API
Create a new API surface:
Responsibilities:
Storage Design
Evaluate the best implementation.
Option A (Preferred)
Separate TimescaleDB instance.
Reasons:
Option B
Separate PostgreSQL instance.
Design schema so migration to TimescaleDB is trivial later.
Data Model
price_tick
Fields:
price_bar_1m
price_bar_5m
Optional.
Can be materialized or generated from 1m bars.
price_bar_1d
security_price_profile
Historical Generation Requirements
Clean Startup
When a clean environment starts:
Public Baseline Pricing
Attempt to retrieve realistic recent prices.
Examples:
Implementation should be pluggable.
Failure to reach a provider must not break startup.
Offline Mode
Support fully offline operation.
Provide:
or equivalent reference data.
If no public source is available:
Deterministic Mode
Support:
or equivalent.
The same seed should generate identical synthetic history.
This is valuable for:
Synthetic Price Generation
Generate 2–5 days of synthetic history.
The generated history should:
Suggested inputs:
Avoid pure uniform random walks.
Prefer realistic market-like movement.
Potential enhancements:
Future Asset Classes
Design for future expansion:
Do not hardcode equity assumptions into storage schemas.
Charting Requirements
Add chart support to the Angular UI.
Every priced security should support:
or equivalent.
Intraday View
Display:
Historical View
Display:
Statistics
Display:
Disclaimer
Every chart and market-data view should clearly display:
Retention Strategy
Raw Ticks
Retain:
1 Minute Bars
Retain long-term.
Daily Bars
Retain indefinitely.
Performance Requirements
Historical persistence must never become a bottleneck.
Requirements:
Future Roadmap
Design this state so future states can support:
Advanced Fill Simulation
Examples:
Strategy Simulation
Examples:
Market Replay
Ability to replay historical synthetic sessions.
Deliverables
Produce:
Expected Design Review Output
Before implementation:
Success Criteria
A newly started TraderX environment should: