diff --git a/trex_core/runtime/config.py b/trex_core/runtime/config.py index 03c84c2..3980771 100644 --- a/trex_core/runtime/config.py +++ b/trex_core/runtime/config.py @@ -143,6 +143,10 @@ class DaemonInstanceConfig: # Optional — absent keys fall back to KST / midnight defaults. trading_timezone: str = "Asia/Seoul" daily_preallocation_time: str = "00:00" + # dcy-020 / REQ-060 (BAT-028): max concurrent active (holding) slots, M. + # Presence is the asset-centric mode gate: set -> universe reconcile + FCFS/M + # admission; absent -> legacy pool model (preallocation + find_allocatable). + max_active_slots: Optional[int] = None @staticmethod def from_toml(path: str) -> "DaemonInstanceConfig": @@ -155,11 +159,18 @@ class DaemonInstanceConfig: raise RuntimeError( f"instance TOML missing required 'instance_key': {path}" ) + raw_max = data.get("max_active_slots") + max_active = int(raw_max) if raw_max is not None else None + if max_active is not None and max_active <= 0: + raise RuntimeError( + f"instance TOML 'max_active_slots' must be > 0, got {raw_max}: {path}" + ) return DaemonInstanceConfig( instance_key=str(instance_key), portfolio_hub_token=str(data.get("portfolio_hub_token") or ""), trading_timezone=str(data.get("trading_timezone") or "Asia/Seoul"), daily_preallocation_time=str(data.get("daily_preallocation_time") or "00:00"), + max_active_slots=max_active, ) @@ -172,6 +183,9 @@ class DaemonConfig: # BAT-013 / REQ-049: instance identity for multi-instance queue naming. # "default" keeps legacy literal queue names (backward-compat). instance_key: str = "default" + # dcy-020 / REQ-060 (BAT-028): M (max concurrent active slots) + asset-centric + # mode gate. None -> legacy pool model. + max_active_slots: Optional[int] = None kis: Optional[KISConfig] = None # REQ-011: paper broker tuning (only consulted when broker == 'paper'). paper: PaperBrokerConfig = PaperBrokerConfig() @@ -316,4 +330,5 @@ class DaemonConfig: portfolio_hub=pf, trading_timezone=inst.trading_timezone, daily_preallocation_time=inst.daily_preallocation_time, + max_active_slots=inst.max_active_slots, )