Skip to content

Regime-aware quant risk and market stability monitoring framework.

License

Notifications You must be signed in to change notification settings

anupam16singh/Market-Regime-Risk-Monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Market-Regime-Risk-Monitor

Regime-aware quant risk and market stability monitoring framework.

Market Regime & Risk Monitoring Framework

(formerly THERMOQUANT – research name)


Overview

RegimeGuard is a regime-aware quant risk and market stability monitoring framework.

It is designed to answer one core question:

When are markets structurally safe or unsafe for models, strategies, and assumptions?

RegimeGuard does not predict prices, generate trading signals, or execute trades.
Instead, it operates as a meta-risk layer that evaluates market regimes, structural instability, and model reliability.

Think of it as weather radar for markets — not to forecast prices, but to warn when conditions become dangerous.


Why RegimeGuard Exists

Most financial losses do not occur because models are incorrect.
They occur because models are used during the wrong market regime.

Traditional risk tools (volatility, correlation, VaR):

  • assume stable distributions
  • react late to regime shifts
  • fail during systemic transitions
  • ignore irreversibility and coordination failure

RegimeGuard addresses this by modeling markets as non-equilibrium systems and tracking structural instability, not price direction.


What This Project Is

  • A market regime and stability monitor
  • A quant risk & model-reliability system
  • A non-predictive decision-support framework
  • A research-grade implementation with a working API

What This Project Is NOT

  • ❌ Not a trading system
  • ❌ Not an alpha generator
  • ❌ Not a signal engine
  • ❌ Not a backtesting platform
  • ❌ Not investment advice

RegimeGuard focuses on risk governance, not performance optimization.


Core Architecture

RegimeGuard is built in three conceptual stages.


Stage 1 — Structural Market Risk (Thermodynamic Layer)

Models market-wide instability using physics-inspired state variables:

  • Entropy – distributional uncertainty
  • Entropy rate – instability acceleration
  • Free energy – available exploitable structure
  • Instability probability

This layer detects latent fragility, even when volatility appears low.


Stage 2 — Agent & Coordination Stress

Models endogenous instability caused by agent interaction:

  • payoff dispersion
  • coordination breakdown
  • structural stress index

This explains why instability emerges internally, not only from external shocks.


Stage 3 — Regime Classification (Observer Layer)

A non-predictive observer that classifies market regimes:

  • ORDERED
  • TRANSITION
  • DISORDERED

Machine learning is used only to detect regime structure —
not to predict prices or returns.


Key Design Principles

  • Non-predictive by design
  • Regime-first, not return-first
  • Physics-inspired constraints, not curve fitting
  • Explainable outputs, not black boxes
  • Works without historical price dependence (no-data validation possible)

API (MVP)

RegimeGuard exposes a minimal FastAPI interface.

Available Endpoints

  • GET /regime_state
    Returns the current market regime and confidence

  • GET /stability
    Returns structural stability metrics and instability probability

  • GET /structural_stress
    Returns agent coordination stress indicators

  • GET /explain
    Provides human-readable explanations for current risk conditions

The root endpoint (/) redirects to /regime_state.


Example Output

{
  "regime": "DISORDERED",
  "confidence": 0.87
}
Interpretation

When RegimeGuard reports an unstable regime, it implies:

Market structure is unstable

Quant assumptions may be unreliable

Aggressive strategies should be disabled

This output is intended to guide risk posture, not trade direction.

How RegimeGuard Is Used

RegimeGuard is designed to be used alongside existing models, not instead of them.

Typical usage includes:

Enabling or disabling strategies based on the detected regime

Dynamically adjusting leverage and exposure

Detecting when diversification assumptions are likely to fail

Providing defensible, structural explanations to risk committees

RegimeGuard governs when models should be trusted, not what trades to place.

Typical Users

RegimeGuard is intended for institutional and research-focused users, including:

Hedge funds (quantitative and discretionary)

Asset management firms

Family offices

Risk and model-governance teams

Macro and systemic-risk researchers

## Repository Structure
regimeguard/
├── api/ # FastAPI application
├── core/ # Entropy, energy, instability logic
├── agents/ # Agent stress & coordination models
├── observer/ # Regime classification logic
├── validation/ # No-data and structural tests
├── examples/ # Demo runs
├── run.py # API runner
└── README.md

Installation & Running pip install -r requirements.txt python run.py


Open in your browser:

http://127.0.0.1:8000/
API documentation (Swagger UI):

http://127.0.0.1:8000/docs

Disclaimer

This project is provided for research and educational purposes only.

It does not provide investment advice, trading signals, portfolio recommendations, or execution logic.

Use at your own risk.

License

This project is licensed under the Apache License 2.0.

You are free to use, modify, and extend it, including for commercial purposes, subject to the license terms.

Project Status

MVP complete

Core logic implemented

API operational

Ready for research use, pilots, and further development

Contributions & Discussion

This repository represents an ongoing research and engineering effort.

Contributions, critiques, and discussions are welcome — especially around:

market regimes

systemic risk

non-equilibrium finance

model-risk governance

One-Line Summary

RegimeGuard is a market regime and risk monitoring system that determines when quant models and assumptions are structurally safe or unsafe — without predicting prices.


✅ This README is now:

  • Fully complete
  • GitHub-ready
  • Institution-safe
  • Research-credible
  • Product-aligned
  • Zero hype