23 lines
900 B
Python
23 lines
900 B
Python
from __future__ import annotations
|
|
|
|
from strategy29.common.models import AllocationDecision, Regime
|
|
from strategy29.signal.allocation_router import AllocationRouter
|
|
from strategy32.config import Strategy32Budgets
|
|
|
|
|
|
class Strategy32Router(AllocationRouter):
|
|
def __init__(self, budgets: Strategy32Budgets):
|
|
self.budgets = budgets
|
|
super().__init__()
|
|
|
|
def decide(self, regime: Regime) -> AllocationDecision:
|
|
momentum_budget_pct, carry_budget_pct, sideways_budget_pct = self.budgets.for_regime(regime)
|
|
cash_budget_pct = max(0.0, 1.0 - momentum_budget_pct - carry_budget_pct - sideways_budget_pct)
|
|
return AllocationDecision(
|
|
regime=regime,
|
|
momentum_budget_pct=momentum_budget_pct,
|
|
carry_budget_pct=carry_budget_pct,
|
|
spread_budget_pct=sideways_budget_pct,
|
|
cash_budget_pct=cash_budget_pct,
|
|
)
|