Add blocker research and routing rename
This commit is contained in:
1
routing/__init__.py
Normal file
1
routing/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import annotations
|
||||
22
routing/router.py
Normal file
22
routing/router.py
Normal file
@@ -0,0 +1,22 @@
|
||||
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,
|
||||
)
|
||||
Reference in New Issue
Block a user