refactor(api): validate shared product response contracts (CL25)
This commit is contained in:
parent
e2292e4883
commit
366a6054bf
22 changed files with 989 additions and 451 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import type { QueryResultRow } from 'pg';
|
||||
import type { IServiceContainer } from '@stock-bot/services';
|
||||
import type { BacktestDefinitionInput } from '@stock-bot/stock-config/backtest';
|
||||
import type { BacktestResponse, RunResponse } from '@stock-bot/stock-config/product-responses';
|
||||
import type {
|
||||
BacktestRunDatasetSelection,
|
||||
ResearchActor,
|
||||
|
|
@ -28,38 +29,30 @@ export interface BacktestRequest {
|
|||
strategyParameters?: Record<string, StrategyParameterValue> | null;
|
||||
}
|
||||
|
||||
export interface Backtest {
|
||||
id: string;
|
||||
archivedAt: string | null;
|
||||
/** The HTTP serializer converts these database Dates to the shared JSON wire shape. */
|
||||
export interface Backtest
|
||||
extends Omit<BacktestResponse, 'startDate' | 'endDate' | 'createdAt' | 'updatedAt'> {
|
||||
strategyVersionId: string | null;
|
||||
strategyParameters: Record<string, StrategyParameterValue> | null;
|
||||
name: string;
|
||||
strategy: string;
|
||||
symbols: string[];
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
initialCapital: number;
|
||||
config: Record<string, unknown>;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface Run {
|
||||
export interface Run
|
||||
extends Omit<
|
||||
RunResponse,
|
||||
'startedAt' | 'completedAt' | 'pausedAt' | 'currentDate' | 'createdAt' | 'updatedAt'
|
||||
> {
|
||||
originalRunId: string | null;
|
||||
dataset: BacktestRunDatasetSelection;
|
||||
id: string;
|
||||
backtestId: string;
|
||||
runNumber: number;
|
||||
status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'paused';
|
||||
speedMultiplier: number | null;
|
||||
error?: string;
|
||||
startedAt?: Date;
|
||||
completedAt?: Date;
|
||||
pausedAt?: Date;
|
||||
progress: number;
|
||||
startedAt?: Date | null;
|
||||
completedAt?: Date | null;
|
||||
pausedAt?: Date | null;
|
||||
cancelRequested: boolean;
|
||||
attemptNumber: number;
|
||||
currentDate?: Date;
|
||||
currentDate?: Date | null;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue