$

Trade Signals LIVE

Forward-looking quant signals for each ticker — RSI, momentum, mean-reversion z-scores, MA crossovers, volatility regime — combined into a BUY / HOLD / SELL verdict with suggested entry, stop-loss, and target.

Quant Top Trade Ideas

Trades ranked, sized, and structured entirely by the quant models — RSI mean-reversion, Bollinger Z-score, dual-timeframe momentum, 50/200 MA crossover, ATR risk units, and 21-day GBM forecast. Position sizing scales each trade to your portfolio using a fixed-fractional risk model (1% risk per trade) and the model's conviction tier.

Quant Signal Matrix

Quant Pairs Trading Scan

Signals are derived from technical indicators on historical end-of-day data and are not investment advice. Always size positions to your own risk tolerance and confirm with your own research before trading.

Portfolio Overview

Risk-adjusted performance summary and historical behavior.

Efficient Frontier

Mean-variance optimization across 5,000 random portfolios.

Max Sharpe Portfolio
Min Volatility Portfolio

Backtest vs S&P 500

Cumulative growth of $1 against the broad market benchmark.

Monte Carlo Simulation

1,000 forward paths via correlated geometric Brownian motion.

Dynamic Rebalancing

Buy-and-hold drift versus periodic rebalancing back to target weights.

Sector Exposure

Concentration analysis across GICS sector classifications.

QPL Risk Index

Composite 0–100 score blending volatility, drawdown, and downside deviation.

How It Works

A behind-the-scenes tour of what happens when you click "Run Analysis."

i
Quant Portfolio Lab is a quantitative research workstation. It produces forward-looking trade signals (RSI, momentum, mean-reversion, MA crossovers, pairs trading) alongside portfolio-level analytics (Sharpe, Markowitz frontier, Monte Carlo, drawdown, sector exposure). You enter the trade ideas yourself — the lab does the math; the broker does the execution.

The Pipeline

  1. 1

    You enter inputs

    Up to 10 tickers, optional weights, a date range, and a risk-free rate. Weights default to equal-weight if you leave them blank.

  2. 2

    The browser sends your request to the Flask server

    Each module hits a separate API endpoint — /signals, /analytics, /optimize, /backtest, /simulate, /rebalance, /sector, /riskscore — in parallel.

  3. 3

    The server fetches historical prices from Yahoo Finance

    We use the open-source yfinance library to pull daily adjusted-close prices for every ticker over your window. If a ticker doesn't have a full history, it's flagged and skipped.

  4. 4

    Prices become returns

    For each stock we compute daily log returns: rt = ln(Pt / Pt-1). From the matrix of daily returns we derive the mean-vector, covariance matrix, and rolling drawdown series — the inputs every model needs.

  5. 5

    Each module runs its own model

    Pure NumPy / SciPy. Trade Signals compute Wilder-RSI, 20d Z-score, Bollinger position, 1M/3M/6M momentum, 50/200 MA crossover, ATR-based entry/stop/target levels, and a 21-day GBM forecast per ticker — then rank a BUY/HOLD/SELL composite score. Frontier samples 5,000 random weights. Monte Carlo Cholesky-decomposes the covariance and simulates 1,000 GBM paths. Pairs trading finds the top-correlated pair, fits an OLS hedge ratio, and z-scores the spread.

  6. 6

    Results stream back as JSON

    Plotly renders the charts in your browser. The Insight Engine turns the numbers into one-sentence plain-English summaries.

What the Lab Does & Doesn't

What this app DOES

  • Generates BUY / HOLD / SELL signals per ticker
  • Suggests entry zones, stop-losses, and price targets (ATR-sized)
  • Forecasts 21-day return distributions (lognormal / GBM)
  • Scans for pairs-trading opportunities (cointegration-style spread z)
  • Backtests portfolios vs. the S&P 500 benchmark
  • Optimizes weights along the Markowitz efficient frontier
  • Runs 1,000-path Monte Carlo simulations of future equity

What this app does NOT do

  • Place real trades or connect to a broker
  • Move money in or out of any account
  • Account for taxes, commissions, or slippage
  • Use real-time intraday quotes (it's end-of-day data)
  • Guarantee its forecasts — they're statistical projections, not predictions
  • Provide personalized investment advice

A Worked Example

Say you enter AAPL, MSFT, GOOGL, AMZN, JPM at equal weights over the last 3 years.

  1. Trade Signals tab: "AMZN's RSI is 73 (overbought) and a death cross is active — model verdict: HOLD with -32 score. JPM is mid-range, no edge. Here are the entry zones, stops, and targets if any cross the BUY threshold."
  2. Pairs scan: "MSFT ↔ AMZN co-move at ρ = 0.56. Their log-spread sits at -0.61σ — within the ±1.5σ no-trade band, so wait."
  3. Backtest tab: "If you had bought $1 of this basket 3 years ago, here's the equity curve vs. the S&P 500."
  4. Frontier tab: "Of all the ways you could weight these 5 stocks, the Max-Sharpe portfolio would have given the best risk-adjusted return."
  5. Monte Carlo tab: "Assuming the next N years look statistically like the past, here are 1,000 plausible paths your $10k could take."
  6. Sector tab: "4 of these 5 are Tech — your basket is more concentrated than it looks."
  7. Risk Score tab: "Composite risk index 72 / 100 → 'Aggressive.'"

The signals are quant-derived hypotheses. You decide whether to act on them in your own brokerage account.

Tech Stack

Backend Python 3 · Flask · Gunicorn
Data yfinance (Yahoo Finance API)
Math NumPy · pandas · SciPy
Frontend Vanilla JS · Plotly.js · Inter typeface
Hosting Replit Autoscale Deployment

Explanations & Methodology

A plain-English guide to every model in the lab — what it is, how it's calculated, and how to read the chart.

Trade Signals

Forward-Looking Signals

What it is. A composite verdict (BUY / HOLD / SELL) for each ticker, derived from five independent quant indicators that each capture a different market regime.

The indicators.

  • RSI(14) — Wilder's Relative Strength Index. Below 30 = oversold (mean-reversion long); above 70 = overbought (mean-reversion short).
  • Z-score (20d) — how many standard deviations price sits from its 20-day mean. z = (P − μ20) / σ20. |z| > 1.5 flags a stretched move.
  • Momentum — total % return over 20 / 60 / 120 trading days. Strong positive momentum is a trend-following long; strong negative is a short.
  • 50/200 MA crossover — golden cross (50d > 200d) is a long-term bullish regime; death cross is bearish.
  • Volatility regime — ratio of 20-day to 1-year annualized vol. > 1.4 = elevated risk; < 0.7 = compressed.

The score. Each indicator contributes ±25 / ±15 / ±10 points to a -100 to +100 composite. ≥ +35 → BUY, ≤ -35 → SELL, otherwise HOLD.

Trade levels. Entry zone, stop-loss, and target are sized using the 14-day ATR (Average True Range) so position risk is normalized across high- and low-vol stocks.

21-day forecast. Projects a price distribution using the lognormal / GBM model: ln(PT/P0) ~ N((μ − ½σ²)T, σ²T). Reports the median expected return and the 5th–95th percentile range.

Pairs Trading

Statistical Arbitrage

What it is. A market-neutral strategy that bets two highly co-moving stocks will revert toward their long-run spread, regardless of overall market direction.

How we run it.

  • Compute pairwise daily-return correlations across your basket.
  • Pick the pair with the highest ρ (must be ≥ 0.50 to be considered a real pair).
  • Fit a hedge ratio β by OLS regression of ln(PA) on ln(PB).
  • Build the spread S = ln(PA) − β · ln(PB) and z-score it on a 60-day rolling window.

The trade. When |z| > 1.5σ, the spread is statistically stretched. The signal: short the over-performer and go long the under-performer in proportions 1 : β. Unwind when z reverts to 0.

Overview

Risk-Adjusted Performance

What it is. A snapshot of how your portfolio has performed historically, after accounting for the risk you took to get there.

Key metrics.

  • Annual Return — geometric mean daily return, annualized: (1 + r̄)252 − 1.
  • Annual Volatility — standard deviation of daily returns × √252.
  • Sharpe Ratio(Return − Rf) / Volatility. Reward per unit of total risk. Above 1.0 is good, above 2.0 is excellent.
  • Sortino Ratio — like Sharpe but only penalizes downside volatility, so it doesn't punish lucky upside.
  • Max Drawdown — the worst peak-to-trough loss the portfolio would have suffered.
Frontier

Efficient Frontier (Markowitz)

What it is. Of all possible weight combinations, the frontier shows the ones that give the highest expected return for each level of risk. It comes from Harry Markowitz's 1952 Modern Portfolio Theory.

How we compute it. We generate 5,000 random weight vectors (long-only, summing to 1), and for each one calculate annualized return, volatility, and Sharpe. The upper-left edge of the cloud is the efficient frontier.

Two reference portfolios. Max Sharpe = best risk-adjusted return. Min Volatility = lowest possible variance.

Backtest

Benchmark Backtest

What it is. A side-by-side comparison: $1 invested in your portfolio versus $1 invested in the S&P 500 (^GSPC) over the same window.

How to read it. Where your line is above the benchmark, you outperformed; where it dips below, you trailed. The gap at the end is your total alpha for the period.

Caveat. Past performance is not predictive. Backtests assume zero transaction costs, taxes, and slippage.

Monte Carlo

Monte Carlo Simulation

What it is. A statistical "what if" — we simulate 1,000 possible futures for your portfolio over the chosen horizon and show the distribution of outcomes.

How we compute it. We take the historical mean-vector and covariance matrix, do a Cholesky decomposition, and generate correlated normal shocks each day. Then we compound them.

Reading the fan. The shaded band is the 5th-to-95th percentile. The center line is the median. Wider fans = more uncertainty.

Rebalancing

Drift vs Rebalancing

What it is. Without intervention, winners grow into a larger share of your book and your portfolio drifts away from your target weights. Rebalancing periodically sells winners and buys laggards to restore balance.

How we compute it. One path holds weights constant after launch (drift). The other resets weights back to the target on a monthly, quarterly, or yearly schedule. We compare ending value and risk.

Tradeoff. Rebalancing usually reduces volatility and can boost long-term Sharpe, at the cost of taxes and transaction friction.

Sector

Sector Exposure

What it is. The percentage of your capital sitting in each GICS sector (Technology, Financials, Healthcare, etc.).

Why it matters. Two portfolios with totally different tickers can be exposed to identical macro risks if they cluster in the same sector. A "diversified" book of 10 names that's 80% Tech isn't really diversified.

How we compute it. We pull each ticker's sector classification from Yahoo Finance and aggregate by your weights.

Risk Score

QPL Risk Index

What it is. A single 0–100 number designed to make portfolio risk legible at a glance. 0 is bond-like; 100 is highly speculative.

Formula. A weighted blend, normalized to a benchmark range:

raw = 0.40 · σ + 0.35 · |MaxDD|² + 0.25 · downsideDev

then mapped to 0–100. We also score the Max-Sharpe and Min-Vol portfolios so you can see how your current allocation compares.

Bands. 0–25 Conservative · 25–50 Balanced · 50–75 Aggressive · 75–100 Speculative.

Insight Engine

Auto-Generated Insights

What it is. The blue boxes under each chart turn the numbers into one or two sentences of plain English — flagging strong Sharpe ratios, deep drawdowns, sector concentration, weak diversification, and so on.

Think of them as a junior analyst's notes — useful as a starting point, not a substitute for judgment.

For educational and research use. Not investment advice. Market data via Yahoo Finance.