@gabriel3615/ta_analysis
Version:
stock ta analysis
28 lines (27 loc) • 1.15 kB
TypeScript
import type { Candle } from '../../types.js';
import { Backtester, type BacktestResult, type Strategy } from './Backtester.js';
export type ParamGrid = Record<string, number[] | string[] | boolean[]>;
export interface GridSearchConfig {
initialCapital?: number;
positionSizing?: number;
maxConcurrentPositions?: number;
commissionPerTrade?: number;
slippageBps?: number;
allowShort?: boolean;
}
export interface GridSearchResultItem {
params: Record<string, any>;
result: BacktestResult;
}
export interface GridSearchSummaryMetrics {
bestByTotalPnL: GridSearchResultItem | null;
bestBySharpe: GridSearchResultItem | null;
bestByMaxDrawdown: GridSearchResultItem | null;
}
export interface GridSearchOutput {
runs: GridSearchResultItem[];
summary: GridSearchSummaryMetrics;
}
export type StrategyFactory = (params: Record<string, any>) => Strategy;
export declare function runGridSearch(candles: Candle[], grid: ParamGrid, strategyFactory: StrategyFactory, backtesterInstance?: Backtester): Promise<GridSearchOutput>;
export declare function formatMetricsPanel(run: GridSearchResultItem): string;