glacez-soa-simulator
Lane: backend · Repo: glacez/glacez-soa-simulator · Editing rules: Glacez/SOAs/glacez-soa-simulator/AGENTS.md
Backtests: replays a strategy against historical prices and records what it would have done.
Responsibility
| Area | What it means |
|---|---|
| Job consumption | SimulatorConsumer listens on glacez.simulations.queue |
| Backtest engine | SimulationService walks a strategy's actions over historical price series |
| Persistence | Simulation, SimulationSnapshot, SimulationTransaction — the run, its periodic valuation, its trades |
It does not own: the strategy definition (core), price history (findata), the user-facing API (webservice — simulations are started and read through it).
Flow
- Webservice publishes a
SimulationJobonglacez.simulations.queue. SimulatorConsumerreceives it andSimulationServiceloads the strategy and its price history.- The run produces snapshots and simulated transactions, saved to Mongo.
- Webservice reads the result back for the UI.
Data
Reads Strategy and Action directly from the shared database (no Feign call, no core API) — the platform's read-directly discipline, see Data ownership. Writes only the three simulation document types.
Fidelity limits
A backtest is only as faithful as the data it replays. Price-change, ATH and halving conditions are the ones the engine evaluates; a strategy that leans on conditions outside that set will not reproduce live behaviour, and a "the simulation says something different from the live run" report deserves that check before the engine is suspected.
The history itself is bounded by the venue that supplied it — Kraken, for instance, caps its OHLC catalogue at roughly 720 daily candles — so a long backtest is limited by the shallowest input series, not by the strategy's age.
Dependencies
findata (historical prices, OHLCV, ATH, changes) over Feign; glacez-lib for strategy models and simulation factories.
Jobs
None scheduled. A simulation is triggered per user action through the queue, and the queue is the only entry point.