Skip to content

HoraDomu/QuantEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quant Engine

A desktop research workstation for equity and options analysis, built in Python.

Python License Status

Quant Engine is a fourteen-tab GUI application built with tkinter that covers the full research workflow, from quick price checks to options chains, volatility analysis, and strategy backtesting. All data is pulled live via yfinance. No brokerage connection required.


Table of Contents


Overview

Quant Engine is a single-file Python application (main.py) running a native GUI via tkinter. Every tab fetches data in a background thread so the interface stays responsive, and charts open in separate matplotlib windows so you can compare them side by side.

Intended workflow: look at macro context → check your watchlist → study a chart → validate a thesis through the backtester → size a position using volatility and risk metrics. All without leaving the app.


Requirements

Python 3.9+
yfinance
matplotlib
mplfinance
pandas
numpy
scipy
scikit-learn

Installation

git clone https://github.com/HoraDomu/QuantEngine.git
cd QuantEngine
pip install -r requirements.txt
python main.py

Tabs

Watchlist

Track a persistent list of tickers saved to watchlist.json. Click Refresh Prices to fetch current price, day change (absolute and percent), and 3-month average volume for every ticker at once. Gainers show in green, losers in red.


Stock Scout

Pull a candlestick or line chart for any ticker over a selectable period (1 month to 5 years). Candlestick mode uses mplfinance with 20-day and 50-day moving average overlays and a volume panel.


Compare

Overlay up to four tickers on a single chart to compare relative performance. Normalize to 100 rebases all series to the same starting value so percentage gains are directly comparable regardless of price differences.


Indicators

Three-panel technical analysis chart:

  • Price panel: daily close with configurable fast/slow SMA lines, bullish crossovers marked ▲, bearish crossovers marked ▼
  • RSI panel: Relative Strength Index with overbought (70) and oversold (30) shading
  • MACD panel: MACD line, signal line, and histogram bars colored by direction

Linear Reg

Fits a linear regression line to the closing price series. Reports intercept (β₀), slope (β₁), and R² score in-app. The slope gives directional trend strength; R² tells you how cleanly price followed a straight path.


Correlation

Computes the Pearson correlation matrix of daily returns across a list of tickers and renders it as a color-coded heatmap. Use this to check whether your basket is diversified or just a cluster of correlated names.


Distribution

Analyzes the daily return distribution for a single ticker:

Statistic Description
Mean (daily) Average daily return
Std Dev (daily) Daily return standard deviation
Skewness Asymmetry of the distribution
Kurtosis Fat-tail heaviness vs normal
Ann. Return Daily mean × 252
Ann. Volatility Daily std × √252
VaR 95% / 99% Worst expected loss at each confidence level

HV vs IV

Plots rolling historical volatility (HV) against the current at-the-money implied volatility (IV) fetched from the nearest options expiry. The shaded region highlights the IV–HV spread.

  • IV > HV: elevated premium environment, options pricing in a larger move than history suggests
  • IV < HV: options cheap relative to realized volatility

Risk Metrics

Portfolio-level risk statistics for a weighted or equal-weight basket:

Metric Description
Ann. Return Annualized portfolio return
Ann. Volatility Annualized portfolio standard deviation
Sharpe Ratio Excess return per unit of total risk
Sortino Ratio Excess return per unit of downside risk
Max Drawdown Largest peak-to-trough decline
Calmar Ratio Ann. return divided by max drawdown

Sectors

Fetches performance for all 11 SPDR sector ETFs over a selected period. Output: a horizontal bar chart sorted best-to-worst, and a color-coded heatmap. Use this to identify sector rotation and macro regime shifts.


Earnings

Earnings calendar for your watchlist or any ticker. Shows next earnings date, days until the event, and analyst EPS/revenue estimates. Color-coded by urgency: red (≤ 7 days), orange (≤ 30 days), green (further out).


Macro

Five macro indicators in one view:

Symbol What it tracks
VIX Market fear / expected S&P 500 volatility
S&P 500 Broad equity market level
10Y Yield Long-term interest rate
13W Yield Short-term interest rate
DXY U.S. dollar strength

A sixth panel shows the yield curve spread (10Y − 13W). When negative, displays INVERTED ⚠, historically a leading recession indicator.


Backtest

SMA crossover strategy backtester, long-only, no transaction costs, research use only.

Generates a buy signal when the fast SMA crosses above the slow SMA, holds until the cross back below. Strategy equity curve is plotted alongside buy-and-hold for direct comparison.

Stat Description
Strategy Return Total return of the crossover strategy
Buy & Hold Return Total return of holding through the period
Sharpe (Strategy) Strategy risk-adjusted return
Max Drawdown Strategy's worst peak-to-trough drop
Win Rate Percentage of trades that closed positive
Avg Trade Return Mean return per trade

To swap in a different signal, replace the df["Signal"] line in Backtester._run(), everything downstream just works.


Options

Full options chain viewer with IV skew charting.

  1. Enter a ticker → Load Expiries
  2. Select an expiry → Load Chain (calls and puts in separate sub-tabs)
  3. Optionally → IV Skew Chart to plot IV across all strikes

In-the-money rows highlighted in green. At-the-money strikes (within 1.5% of spot) highlighted in yellow/bold.


Architecture

Component Role
WatchlistStore Persists the ticker list to watchlist.json, loaded on startup
Black-Scholes helpers bs_call, bs_put, bs_delta, bs_gamma, bs_vega, bs_theta, pure functions used across tabs
_flatten() Normalizes yfinance 2.x MultiIndex DataFrames to single-level columns
Per-tab classes Each tab is self-contained; __init__ takes a parent frame and builds its own UI
main() Creates the root window, wires tabs with one line each via tab(name, Class, *args)

Adding a new tab:

tab("Tab Name", YourClass)
# or, if it needs the watchlist:
tab("Tab Name", YourClass, store)

File Structure

QuantEngine/
├── main.py           # Entire application
├── requirements.txt  # Python dependencies
├── watchlist.json    # Persistent ticker list (auto-created)
└── notes.txt         # Daily/weekly research workflow guide

Notes

  • yfinance API changes: yfinance occasionally renames columns or changes return formats. Each tab wraps its own fetch independently, so a breakage in one tab won't affect others.
  • No real-time data: prices are fetched on demand, not streamed. Refresh manually.
  • Options availability: not all tickers have options data. Tickers without listed options will show "No options data available."
  • Backtester limitations: long-only, no slippage, no transaction costs. For thesis validation only, not live trading signals.

License

Copyright (c) 2026 HoraDomu. All rights reserved.

This software is proprietary. Unauthorized copying, distribution, modification, or use of this software, in whole or in part, is strictly prohibited without the express written permission of the author.

About

Desktop research workstation for equity and options analysis 14 tabs, live data via yfinance, no brokerage required.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages