Repository navigation
Risk Guardrails
In the context of short-term momentum trading on high-volatility venues like the NSE and BSE, traditional asset allocation paradigms (e.g., fixed equity-to-bond splits) do not apply. For an active intraday automated system, Portfolio Diversity is re-defined strictly as Exposure Management and Correlation Control.
Systemic shocks—such as sudden Reserve Bank of India (RBI) policy shifts or structural sector index breakdowns—can instantly trigger correlated liquidations across closely related equities. The core operational philosophy of Navier-Stocks is to actively restrict capital correlation before an execution occurs, ensuring that no single macroeconomic event can induce catastrophic multi-position drawdowns.
To reconcile execution safety, the Risk Manager implements exposure controls across three distinct software layers.
The system eliminates the need to process full market depth across all listed securities by enforcing a restricted execution playground before the opening bell.
- Execution Window: Triggered automatically at 8:45 AM IST.
- Mechanism: Resolves a strict, highly liquid Daily Universe bounded at a maximum of 15 to 25 securities. The selection filters out illiquid mid-caps and concentrates exclusively on the primary structural drivers of Nifty Sectoral Indices.
- Memory Optimization: By restricting the global universe to a maximum of 25 assets, the core Ingestor Agent limits live WebSocket subscription lines to high-liquidity order books, keeping background memory footprint minimal and ensuring sub-millisecond execution loops.
| Sector Index | Standard Baseline Tickers |
|---|---|
| Nifty IT | TCS, INFY |
| Nifty Bank | HDFCBANK, SBIN, ICICIBANK |
| Nifty Auto | TATAMOTORS, M&M |
| Nifty Metal | TATASTEEL, JSWSTEEL |
| Nifty Energy / FMCG | RELIANCE, ITC |
The tracking of real-time sector concentration must not block the core execution pipeline. The Risk Manager utilizes high-speed internal lookups:
-
Static Read-Only Mapping: Standard Go
map[string]stringdictionary structures link asset identifiers to their respective industry clusters instantly, executing with zero garbage collection or runtime overhead. -
Concurrent Tracker State: Open position volumes per sector are modified inside a thread-safe
sync.Map. This prevents resource contention or state corruption when multiple asynchronous signals hit the Risk Manager via NATS concurrently.
Upon receipt of a technical setup intent, the Risk Manager processes the transaction through a series of logical validation gates:
- Gate 1: The Sector Concentration Cap: The component pulls the asset's structural sector from the memory matrix. If the target sector has already reached the maximum active allocation ceiling (e.g., maximum 1 open trade per sector), the incoming intent is immediately discarded.
- Gate 2: The Concurrency Ceiling: To prevent capital fragmentation and over-exposure, the system enforces a strict parameter limit of maximum 4 concurrent active positions across the entire platform. If the portfolio footprint is saturated, incoming signals are bypassed until a current holding hits its structural boundary conditions.
- Gate 3: Directional Bias Control: The system enforces strict architectural equilibrium between Long and Short allocations. At no point can the directional ratio exceed 3:1 in favor of a single market vector, mitigating systemic exposure during un-hedged macro drops.
The transition from an raw market observation to an absolute trade execution moves through an un-blocked, event-driven state machine:
[ Quantitative Scout ]
│
▼ (Generates Alpha Metrics)
NATS Stream: signal.intent.SBIN
│
▼
[ Risk Manager Core ]
│
├─► 1. Lookup SectorMap ("SBIN" -> "BANKING")
├─► 2. Load ActiveSectorExposure (State: 0 Active)
├─► 3. Validate Global Capacity (State: 2/4 Active)
│
▼ (Validation Strategy Passed)
Update Sector State Map (Banking -> 1)
│
▼ (Execute Mathematical Capital Allocator)
NATS Stream: signal.execute.SBIN ────► [ Dumb-Pipe Trader Interface ]
The Quantitative Scout implements a mathematical VWAP Volume Breakout execution strategy to detect short-term institutional momentum shifts:
- The Breakout Factor: A buy indicator triggers exclusively when the 1-minute candle close crosses decisively above the Volume-Weighted Average Price (VWAP) line.
- Volume Confirmation Filter: The target execution candle must display a transaction volume value at least 2x the rolling 10-minute simple moving average of volume, proving institutional backing behind the directional shift.
To protect margins against the heavy slippage parameters typical of high-volatility breakouts, market orders are prohibited on the fast path.
- Entry Execution: Orders are sent as Limit Orders pinned strictly at or marginally above the active VWAP trigger boundary line.
- Stop-Loss (Risk Boundary): The absolute structural stop is placed precisely below the lowest traded price of the initiating breakout candle block.
-
Take-Profit (Reward Boundary): The profit target operates on a strict mathematical Risk-to-Reward Ratio (
$R:R$ ) scale of 1:2. If the technical stop-loss calls for an exposure of ₹10 per unit, the profit boundary is locked at +₹20 above the entry point.
Once structural gates clear, the exact order size is derived via a strict fixed-fractional account management loop, ensuring no single execution vulnerabilities risk more than 2% of total deployable funding:
Operational Note: All variables are evaluated dynamically in real time within the Go memory frame, maintaining high-precision floating-point accuracy before translation to the final broker-facing integer order quantity.
The Risk Manager reads its two core parameters from the environment at boot and logs the effective values once at startup:
| Variable | Default | Effect |
|---|---|---|
TOTAL_CAPITAL |
1000000 |
Deployable capital fed into the 2% allocator matrix above. |
RISK_MIN_CONFIDENCE |
0.30 |
Gate-4 floor: intents whose ticker's latest sentiment confidence scores below this value are rejected. |
Operational Note: Both variables fall back to the defaults above when unset; an invalid numeric value also falls back with a warning logged. The effective configuration is printed on every agent start (
risk config: capital=… minConfidence=…).
- Home
- Core Architecture
- Indicator Reference
-
Developer Sandbox
- Local Environment & Quickstart (Pending)
- Testing & Backtesting Strategy (Pending)
-
Operational Systems
- Infrastructure Runbook & Recovery (Pending)