deltaforge-real-time-cross-.../deltaforge/backtester.py

16 lines
493 B
Python

from __future__ import annotations
from typing import Dict
from .dsl import PlanDelta
class Backtester:
"""Toy deterministic replay-based backtester for MVP."""
def run(self, plan: PlanDelta) -> Dict[str, float]:
# Deterministic pseudo-PnL based on number of hedges and total_cost
hedge_count = len(plan.hedges)
pnl = max(0.0, 100.0 - plan.total_cost * 2.0) if hedge_count > 0 else 0.0
return {"deterministic_pnl": pnl, "hedge_count": hedge_count}