Share backtest request contracts and isolate stored result mapping
This commit is contained in:
parent
007e35c747
commit
420c47704e
21 changed files with 777 additions and 244 deletions
13
README.md
13
README.md
|
|
@ -457,6 +457,14 @@ backend, normalizes the result, and commits the result and terminal status in on
|
|||
Completion events are published only after that commit. Progress cannot revive a terminal
|
||||
run, duplicate claims are rejected, and unsupported controls do not change persisted state.
|
||||
|
||||
`@stock-bot/stock-config/backtest` owns the pure execution request schema, parsing and
|
||||
defaults used by API definition snapshots, the runner and both backends. The subpath
|
||||
loads no configuration manager or infrastructure. API date labels are translated to UTC
|
||||
before execution; direct execution requests keep their existing full-ISO timestamp shape.
|
||||
Strategy-specific parameter validation remains with each execution backend. Invalid
|
||||
execution settings now fail before a definition/run write rather than being queued for
|
||||
later rejection. Existing schema imports from the orchestrator remain compatibility exports.
|
||||
|
||||
`@stock-bot/types` exports the shared `BacktestRunResult` used by the runner, API, and UI.
|
||||
Return, win-rate, drawdown, and chart-analytics percentages use fractions (`0.10` means 10%).
|
||||
Trade records identify their granularity with `kind: 'fill' | 'closed'`; `totalTrades` counts
|
||||
|
|
@ -478,6 +486,11 @@ be reconciled before applying that index. Historical rows without snapshots rema
|
|||
and are explicitly marked `legacy`; their configuration is reconstructed from the definition.
|
||||
New executions require PostgreSQL; there is no implicit in-memory production repository.
|
||||
|
||||
Stored-result compatibility conversion lives in the web API's pure `backtest-result.ts`
|
||||
mapper, separate from SQL and run control. Current snapshots are returned without unit
|
||||
conversion; pre-contract native/TypeScript rows retain their existing legacy unit rules.
|
||||
Reading a result never rewrites the stored history or recalculates its metrics.
|
||||
|
||||
Native execution uses a disposable **worker process**, not the HTTP thread. A small
|
||||
`BacktestExecutionEngine` port separates the runner from both implementations. The parent
|
||||
owns storage reads and persistence; only serializable configuration, bars, progress, and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue