feat: Trump-Backtest-Wrapper (gleicher Code-Pfad wie Live)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 08:39:20 +00:00
parent 204c0541a7
commit 22c84187b2

View File

@@ -0,0 +1,14 @@
import type { Candle, Pair } from '../types';
import { processTrumpCycle, type TrumpCycleConfig, type TrumpCycleResult, type TrumpEventInput } from '../live/trump-cycle';
/** Backtest = ein Cycle-Lauf von frischem State. Gleicher Code-Pfad wie Live (Spec §5). */
export function runTrumpBacktest(
candles15ByPair: Map<Pair, Candle[]>,
events: TrumpEventInput[],
startCapital: number,
cfg: TrumpCycleConfig,
): TrumpCycleResult {
let minTs = Infinity;
for (const cs of candles15ByPair.values()) if (cs.length > 0) minTs = Math.min(minTs, cs[0].ts);
return processTrumpCycle(candles15ByPair, events, { cash: startCapital, positions: [], cursorTs: minTs - 1 }, cfg);
}