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
|
|
@ -2,9 +2,10 @@ import { randomUUID } from 'node:crypto';
|
|||
import type { PoolClient } from 'pg';
|
||||
import type { TransactionCallback } from '@stock-bot/postgres';
|
||||
import type { PostgresClient } from '@stock-bot/services';
|
||||
import { parseBacktestRequest } from '@stock-bot/stock-config/backtest';
|
||||
import type { BacktestRunResult, HistoricalDataset } from '@stock-bot/types';
|
||||
import { prepareDataset } from '../data/historical-dataset';
|
||||
import { BacktestConfigSchema, type BacktestConfig } from '../types';
|
||||
import type { BacktestConfig } from '../types';
|
||||
import { BacktestCancelledError } from './execution-engine';
|
||||
import {
|
||||
BacktestConflictError,
|
||||
|
|
@ -54,7 +55,7 @@ export class PostgresBacktestRunRepository implements BacktestRunRepository {
|
|||
if (!run) {
|
||||
throw new BacktestConflictError('Run is missing, already claimed, or terminal');
|
||||
}
|
||||
const snapshot = BacktestConfigSchema.parse(run.request_snapshot);
|
||||
const snapshot = parseBacktestRequest(run.request_snapshot);
|
||||
return {
|
||||
runId: String(run.id),
|
||||
backtestId: String(run.backtest_id),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue