Skip to content

[High] Solver Simulation Harness and Strategy Backtesting Tool #452

Description

@james2177

Description:
Evolve scripts/solver-bot.ts into a simulation harness that replays historical intent streams against pluggable solver strategies, producing PnL, fill-rate, and slash-risk reports.

Problem Statement & Context:
Prospective solvers can't evaluate economics before bonding capital, and protocol parameter changes (fill windows, fees, auction curves) can't be evaluated against realistic behaviour.

Scope & Acceptance Criteria:

  • Replay engine reading archived intents/prices; deterministic simulated clock.
  • Strategy interface (onIntent, onQuoteRequest, onTick) with two reference strategies.
  • Parameter sweep mode for protocol params (fill window, fee bps) producing comparative reports.
  • Out of scope: live trading.

Implementation Guidelines:

  1. Key Files/Modules: scripts/solver-bot.ts, new tools/simulator/, reuse src/auctions/, src/fees/, src/routing/.
  2. Design/Architecture: Import pure domain modules directly (no Nest bootstrap) — reinforces keeping domain logic pure.
  3. Edge Cases/Constraints: Must replay 1M intents in < 5 minutes.
  4. Testing: Determinism test (same seed ⇒ identical report).

Definition of "Done": Common DoD; docs in scripts/README.md.

Resources:

  • Design reference: N/A (backend-only)
  • scripts/solver-bot.ts

Common Definition of "Done" (applies in addition to the criteria above):

  • Code written, tested, and documented (TSDoc on public APIs, README/runbook/ADR updates where behaviour changes).
  • All acceptance criteria met; npm run lint, npm run typecheck, npm test, npm run test:e2e pass in CI.
  • PR follows .github/PULL_REQUEST_TEMPLATE, uses a Conventional Commit title (enforced by commitlint), includes test output / metrics screenshots, and references the issue.
  • New env vars are added to .env.example variants and src/config/env.validation.ts (the check:env-drift script must pass).
  • Reviewed and approved by at least one CODEOWNER.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions