spb/vquant Public MIT
VibeQuant — AI-powered institutional-grade financial intelligence platform.
TypeScript 84.3%
Python 11.7%
JavaScript 1.6%
CSS 1.5%
HTML 0.7%
1<!--2 =============================================================================3 VibeQuant (vquant) — AI-Powered Financial Intelligence Platform4 -----------------------------------------------------------------------------5 File: docs/PYTHON_ANALYSIS.md67 Author: Simon-Pierre Boucher8 Contact: contact@spboucher.ai9 Website: https://www.spboucher.ai10 Demo: https://www.vquant.ai11 License: MIT (see LICENSE)1213 Copyright © 2026 Simon-Pierre Boucher. All rights reserved.14 =============================================================================15-->1617# Python Quantitative Analysis1819VibeQuant includes a powerful Python engine for quantitative financial analysis. All Python code executes in an isolated environment with 17 scientific libraries.2021## Built-in Analysis Models2223### 1. Monte Carlo Simulation2425Simulate future price paths using geometric Brownian motion.2627**Parameters**:28| Parameter | Type | Default | Description |29|-----------|------|---------|-------------|30| `symbol` | string | required | Stock ticker symbol |31| `num_simulations` | int | 10,000 | Number of simulation paths |32| `time_horizon` | int | 252 | Trading days to simulate |33| `initial_investment` | float | 10,000 | Starting portfolio value |3435**Example prompt**:36```37"Run a Monte Carlo simulation on NVDA with 50,000 paths over 500 trading days"38```3940**Output**: Distribution statistics, probability of profit, VaR estimates, simulation chart.4142---4344### 2. Options Pricing (Black-Scholes)4546Price European options with full Greeks calculation.4748**Parameters**:49| Parameter | Type | Description |50|-----------|------|-------------|51| `symbol` | string | Underlying asset |52| `strike_price` | float | Strike price |53| `expiry_days` | int | Days to expiration |54| `risk_free_rate` | float | Risk-free rate (default: 0.05) |55| `option_type` | string | "call" or "put" |5657**Output**: Option price, delta, gamma, theta, vega, rho, put-call parity check.5859**Example prompt**:60```61"Price a call option on AAPL with strike $200, 30 days to expiry"62```6364---6566### 3. GARCH Volatility Model6768Estimate and forecast volatility using GARCH(1,1).6970**Parameters**:71| Parameter | Type | Description |72|-----------|------|-------------|73| `symbol` | string | Stock ticker |74| `data_period` | int | Historical days (default: 756) |75| `forecast_horizon` | int | Days to forecast (default: 30) |7677**Output**: GARCH parameters (omega, alpha, beta), historical volatility, forecast, interpretation.7879---8081### 4. Value at Risk (VaR)8283Calculate VaR using three methods: Historical, Parametric, and Monte Carlo.8485**Parameters**:86| Parameter | Type | Default | Description |87|-----------|------|---------|-------------|88| `symbol` | string | required | Stock ticker |89| `portfolio_value` | float | 100,000 | Portfolio value |90| `confidence_levels` | float[] | [0.90, 0.95, 0.99] | Confidence levels |91| `time_horizon` | int | 1 | Holding period (days) |92| `num_simulations` | int | 10,000 | MC simulations |9394**Output**: VaR by method and confidence level, CVaR (Expected Shortfall), distribution statistics.9596---9798### 5. Portfolio Optimization99100Mean-variance optimization using Modern Portfolio Theory.101102**Parameters**:103| Parameter | Type | Default | Description |104|-----------|------|---------|-------------|105| `symbols` | string[] | required | Portfolio tickers |106| `risk_free_rate` | float | 0.05 | Risk-free rate |107| `min_weight` | float | 0.0 | Minimum allocation per asset |108| `max_weight` | float | 1.0 | Maximum allocation per asset |109| `generate_frontier` | bool | false | Generate efficient frontier |110111**Example prompt**:112```113"Optimize a portfolio of AAPL, MSFT, GOOGL, AMZN, NVDA for maximum Sharpe ratio"114```115116**Output**: Optimal weights (max Sharpe, min variance, equal weight), efficient frontier, correlation matrix.117118---119120### 6. Risk Metrics Analysis121122Comprehensive risk-adjusted performance metrics.123124**Parameters**:125| Parameter | Type | Default | Description |126|-----------|------|---------|-------------|127| `symbol` | string | required | Stock ticker |128| `benchmark_symbol` | string | SPY | Benchmark |129| `risk_free_rate` | float | 0.05 | Risk-free rate |130131**Output**:132- **Return metrics**: Annualized return, volatility, excess return133- **Risk-adjusted**: Sharpe, Sortino, Calmar, Information, Treynor ratios134- **Market**: Beta, Alpha, Correlation, R-squared, Tracking error135- **Drawdown**: Max drawdown, recovery days136- **Trading**: Win rate, profit factor, average win/loss137138---139140### 7. Chart Generation (`create_plot`)141142Create publication-quality charts.143144**Plot types**: `line`, `bar`, `scatter`, `histogram`, `candlestick`, `area`, `pie`, `heatmap`145146**Parameters**:147| Parameter | Type | Description |148|-----------|------|-------------|149| `plot_type` | string | Chart type |150| `data` | object | Data to plot |151| `title` | string | Chart title |152| `xlabel` / `ylabel` | string | Axis labels |153| `color` | string/string[] | Colors |154| `figsize` | [w, h] | Figure size |155| `theme` | string | "default", "dark", "colorful" |156157---158159### 8. Custom Python Code160161Execute arbitrary Python code with access to all 17 libraries and FMP data.162163**Example prompt**:164```165"Write Python code to:1661. Fetch 2 years of daily prices for AAPL and MSFT1672. Calculate 30-day rolling correlation1683. Plot correlation over time with a heatmap of monthly averages"169```170171The AI will generate and execute Python code, returning charts and output.172173**Available in custom code**:174- All 17 scientific libraries175- `fmp_api_key` for fetching financial data176- Matplotlib figure generation (saved as PNG)177- Print output captured and returned178179---180181## Python Libraries Reference182183| Library | Import | Key Functions |184|---------|--------|---------------|185| **numpy** | `import numpy as np` | Arrays, linear algebra, random |186| **pandas** | `import pandas as pd` | DataFrames, time series, IO |187| **scipy** | `from scipy import stats, optimize` | Statistics, optimization |188| **scikit-learn** | `from sklearn import ...` | ML models, preprocessing |189| **statsmodels** | `import statsmodels.api as sm` | OLS, ARIMA, tests |190| **matplotlib** | `import matplotlib.pyplot as plt` | Plotting |191| **seaborn** | `import seaborn as sns` | Statistical plots |192| **plotly** | `import plotly.graph_objects as go` | Interactive charts |193| **arch** | `from arch import arch_model` | GARCH, EGARCH |194| **cvxpy** | `import cvxpy as cp` | Convex optimization |195| **yfinance** | `import yfinance as yf` | Market data |196| **ta** | `import ta` | 40+ technical indicators |197| **quantstats** | `import quantstats as qs` | Portfolio analytics |198| **beautifulsoup4** | `from bs4 import BeautifulSoup` | HTML parsing |199| **requests** | `import requests` | HTTP client |200| **lxml** | `from lxml import etree` | XML parsing |201| **Pillow** | `from PIL import Image` | Image processing |202