//Quant-Enthusiasts-Risk-EnginebyAnsh-Sarkar

Quant-Enthusiasts-Risk-Engine

The Robust Risk Engine of the Quant Enthusiasts Community

1
0
1

Quant Enthusiasts Risk Engine

A high-performance quantitative finance platform for portfolio risk management and options pricing. Built with C++17 core, Python bindings, and an interactive web dashboard.

License: MIT
C++17
Python 3.11+

Overview

Cross-language quantitative finance platform offering:

  • undefinedMultiple Pricing Models: Black-Scholes, Binomial Tree, Merton Jump Diffusion
  • undefinedRisk Analytics: Greeks calculation, Value at Risk (Monte Carlo), Portfolio aggregation
  • undefinedLive Market Data: Automatic fetching from Yahoo Finance with caching
  • undefinedRESTful API: Flask-based endpoints with comprehensive validation
  • undefinedWeb Dashboard: Interactive portfolio builder and risk visualizer

Quick Start

# Clone repository
git clone https://github.com/Quant-Enthusiasts/Quant-Enthusiasts-Risk-Engine.git
cd Quant-Enthusiasts-Risk-Engine

# Build C++ engine
cd cpp_engine
mkdir build && cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release
cmake --build .
cmake --install .

# Setup Python API
cd ../../python_api
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python setup.py build_ext --inplace

# Start API server
python app.py

Server runs at http://127.0.0.1:5000

For detailed setup instructions, see INSTALLATION.md.

Architecture

JavaScript Dashboard (Frontend)
         |
         | HTTP/JSON
         v
  Python API Layer (Flask)
         |
         | pybind11
         v
   C++ Risk Engine (Core)

undefinedProject Structure:undefined

Quant-Enthusiasts-Risk-Engine/
├── cpp_engine/          # C++ core with pricing models
├── python_api/          # Flask API + Python bindings
├── js_dashboard/        # Web interface
└── docs/                # Additional documentation

Core Features

Pricing Models

Model Type Options Key Features
Black-Scholes Analytical European Fast, Greeks calculation
Binomial Tree Numerical European/American Early exercise, configurable steps
Merton Jump Diffusion Analytical European Discontinuous jumps

Risk Metrics

  • undefinedGreeks: Delta, Gamma, Vega, Theta, Rho
  • undefinedVaR: Monte Carlo simulation (configurable paths)
  • undefinedExpected Shortfall: 95%/99% confidence levels
  • undefinedPortfolio Analytics: Net positions, PV aggregation

Market Data Integration

  • Automatic fetching from Yahoo Finance
  • SQLite-based caching (24-hour expiration)
  • Bulk ticker updates
  • Volatility calculation from historical data

See MARKET_DATA.md for details.

Usage Example

# Fetch market data
curl -X POST http://127.0.0.1:5000/update_market_data \
  -H "Content-Type: application/json" \
  -d '{"tickers": ["AAPL", "GOOGL"]}'

# Calculate portfolio risk (auto-fetches missing data)
curl -X POST http://127.0.0.1:5000/calculate_risk \
  -H "Content-Type: application/json" \
  -d '{
    "portfolio": [
      {
        "type": "call",
        "strike": 180,
        "expiry": 1.0,
        "asset_id": "AAPL",
        "quantity": 100,
        "style": "european"
      }
    ],
    "market_data": {}
  }'

Full API documentation: API.md

Performance

Operation Latency Notes
Single option pricing < 1 microsecond Black-Scholes
Portfolio (100 options) < 1 ms Full Greeks
VaR (100K simulations) < 1 s 95% confidence

Documentation

Contributing

We welcome contributions! Please see DEVELOPMENT.md for:

  • Development setup
  • Code style guidelines
  • Testing requirements
  • Pull request process

Support

License

This project is licensed under the MIT License. See LICENSE for details.


undefinedMade by Quant Enthusiasts | Documentation | GitHub

[beta]v0.14.0