← /projectsFinancePython · FastAPI · React

Full-stack quantitative finance platform with a 7-module React frontend, FastAPI backend, automated data pipeline via APScheduler, SQLite storage, and a local Ollama AI analyst.

Built with Python, FastAPI, React, TypeScript, SQLite, Ollama, NumPy and yfinance. The code is on GitHub.

A Bloomberg Terminal–inspired quantitative research platform built entirely from scratch with Python and React. It provides institutional-grade equity analysis tools in a fully local environment — no cloud API keys required beyond optional data sources, no subscription fees, and complete data privacy since everything runs on your own machine.

The React frontend is organized into seven specialized modules, each backed by a dedicated FastAPI endpoint. The Dashboard displays portfolio overview, live price charts (Recharts), and active alerts via a WebSocket connection. The Stock Screener accepts 50+ filter criteria — P/E range, RSI bounds, minimum volume, sector, EPS growth — and returns a ranked list processed server-side via Pandas DataFrames. The Research Panel pulls fundamental data (income statement, balance sheet, cash flow) from yfinance and FRED economic indicators, presenting P/E, EBITDA, ROE, and debt ratios side-by-side. The Risk Calculator runs a Monte Carlo simulation (10,000 paths via NumPy) to compute 95% Value-at-Risk, Sharpe ratio, beta against the S&P 500, and maximum drawdown. The Portfolio Tracker manages a holdings ledger in SQLite, calculating real-time P&L and allocation percentages as prices update. The Options Pricing module implements Black-Scholes from first principles using SciPy's normal CDF, outputting fair value and the full Greeks (Δ, Γ, Θ, Vega, Rho) for any call or put. The AI Analyst module submits a structured prompt containing the stock's key metrics to a local Ollama llama3.2 model and streams the response token-by-token back to the UI.

The data pipeline is automated by APScheduler with three background jobs: a 1-minute interval job fetches live OHLCV data via yfinance and writes to the price_history table; an hourly job refreshes fundamentals and FRED indicators; a nightly 2am job runs the full Monte Carlo risk computation and caches results in the analysis_cache table. Five SQLite tables (stocks, price_history, portfolio, analysis_cache, alerts) form the persistence layer, with INSERT OR REPLACE semantics to handle deduplication automatically.

What it does

  • 7-module React frontend: Dashboard, Screener, Research, Risk, Portfolio, Options, AI Analyst
  • FastAPI backend with 8 routes: GET, POST, and WebSocket endpoints for live streaming
  • Stock Screener: 50+ filter criteria processed via Pandas DataFrame on the server
  • Black-Scholes options pricing from scratch: fair value + full Greeks (Δ Γ Θ Vega Rho)
  • Monte Carlo VaR: 10,000 simulation paths via NumPy for 95% confidence risk metrics
  • APScheduler: 3 background jobs — 1min live prices, 1hr fundamentals, 02:00 risk metrics
  • 5 SQLite tables: stocks, price_history, portfolio, analysis_cache, alerts
  • Ollama AI Analyst: llama3.2 streaming analysis with bull/bear/risk breakdown, fully local
  • FRED API integration: CPI, Fed Funds Rate, GDP, unemployment alongside equity data
  • Alert system: threshold-based triggers (PRICE_ABOVE, PRICE_BELOW, RSI) pushed via WebSocket

From the code

python
# Black-Scholes options pricing — core implementation
from scipy.stats import norm
import numpy as np

def black_scholes(S, K, T, r, sigma, option_type="call"):
    """
    S: spot price  K: strike  T: time to expiry (years)
    r: risk-free rate  sigma: implied volatility
    """
    d1 = (np.log(S / K) + (r + 0.5 * sigma**2) * T) / (sigma * np.sqrt(T))
    d2 = d1 - sigma * np.sqrt(T)

    if option_type == "call":
        price = S * norm.cdf(d1) - K * np.exp(-r * T) * norm.cdf(d2)
        delta = norm.cdf(d1)
    else:
        price = K * np.exp(-r * T) * norm.cdf(-d2) - S * norm.cdf(-d1)
        delta = -norm.cdf(-d1)

    gamma = norm.pdf(d1) / (S * sigma * np.sqrt(T))
    theta = (-(S * norm.pdf(d1) * sigma) / (2 * np.sqrt(T))
             - r * K * np.exp(-r * T) * norm.cdf(d2)) / 365
    vega  = S * norm.pdf(d1) * np.sqrt(T) / 100
    rho   = K * T * np.exp(-r * T) * norm.cdf(d2) / 100

    return {"price": round(price, 4), "delta": round(delta, 4),
            "gamma": round(gamma, 6), "theta": round(theta, 4),
            "vega":  round(vega,  4), "rho":   round(rho,   4)}

Keep reading

A few sentences is plenty. If it's a fit, our first call starts with the work instead of an intro.

Send me a noteClass of 2029