feat: Trump-Backtest-Wrapper (gleicher Code-Pfad wie Live)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
14
src/server/backtest/trump.ts
Normal file
14
src/server/backtest/trump.ts
Normal 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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user