feat: strategy builder

This commit is contained in:
OpenSquared
2026-07-30 11:30:59 +02:00
parent 15528e0c98
commit 1c4d8013c4
4 changed files with 240 additions and 3 deletions

View File

@@ -1856,6 +1856,19 @@ export const useOptimizeStrategy = () =>
api.post<OptimizeResponse>('/strategy-builder/optimize', body).then(r => r.data),
})
// Day-by-day mark-to-market of a fixed set of legs against REAL accumulated Saxo history
// between two dates — not a scenario, a replay of what actually happened.
export type ReplayPoint = { date: string; spot: number | null; position_value: number; pnl: number }
export type ReplayResult = {
symbol: string; saxo_symbol: string; start_date: string; end_date: string
entry_date: string; entry_value: number; final_pnl: number
points: ReplayPoint[]; missing_dates: string[]
}
export const useReplayStrategy = () =>
useMutation<ReplayResult, Error, { symbol: string; legs: StrategyLeg[]; start_date: string; end_date: string; contract_size?: number }>({
mutationFn: (body) => api.post('/strategy-builder/replay', body).then(r => r.data),
})
// Mode 1 of the scenario/profile/constraints split — what Greek behavior the scenario
// alone already implies, before the user sets any explicit target (project memory:
// Strategy Builder Greeks plan, Phase 4).