6 min read

7 Quant Strategies Wall Street Uses Daily — With Copy-Paste Code You Can Run Right Now

Source: http://x.com/i/article/2030545144659787776

Wall Street quant desks use these strategies daily. Most retail traders have never heard of them.

Each one has real edge, real math, and code you can run right now.

The strategies are real concepts from finance literature, this code is a simplified presentation.

Advanced quant implementations involve cointegration tests, transaction cost modeling, risk management, position sizing, and vastly more rigorous backtesting frameworks (Zipline, backtrader, QuantConnect, etc)

This article is written for educational purposes for people who are starting their journey in quantitative trading.

About me: I research market inefficiencies and build automated trading systems. Onchain since 2020. Currently building a quantitative toolset for prediction markets. Follow for more.

1. Pairs Trading Divergence: Profit From Mispricing

When two assets that normally move together suddenly diverge, quants treat it as a mispricing that will revert.

The logic: if two assets are 90% correlated and one drops 5% while the other stays flat, the spread is statistically unlikely to persist. You short the outperformer, buy the underperformer, and wait for convergence.

python

import yfinance as yf
import numpy as np

# Pull two correlated assets
a = yf.download("SPY", period="1y")["Close"].squeeze()
b = yf.download("QQQ", period="1y")["Close"].squeeze()

# Compute log-price spread
spread = np.log(a) - np.log(b)

# Standardize into z-score
z = (spread - spread.rolling(30).mean()) / spread.rolling(30).std()

# Signal: enter when |z| > 2, exit near 0
signals = z.apply(lambda x: -1 if x > 2 else (1 if x < -2 else 0))

print(f"Total signals generated: {(signals != 0).sum()}")
print(f"Current z-score: {z.iloc[-1]:.2f}")

When z-score crosses above 2: short the spread. Below -2: go long. Exit near zero. Simple, repeatable, backtestable.

Image

2. Volatility Compression Breakout

Large trends frequently start after periods when volatility collapses into the lowest 20-30% of its historical range. Compressed markets release into outsized directional moves.

Think of it like a spring. The tighter the compression, the bigger the breakout.

python

import yfinance as yf

data = yf.download("BTC-USD", period="2y")
data.columns = data.columns.get_level_values(0)

data["range"] = data["High"] - data["Low"]
data["avg_range_30"] = data["range"].rolling(30).mean()
data["percentile"] = data["avg_range_30"].rank(pct=True)

# Flag compression zones: bottom 20% of historical range
compression = data[data["percentile"] < 0.20]

print(f"Compression periods found: {len(compression)}")
print(f"Current range percentile: {data['percentile'].iloc[-1]:.2%}")

# Backtest: measure average move size 5 days after compression
data["fwd_5d"] = data["Close"].pct_change(5).shift(-5)
avg_move = data[data["percentile"] < 0.20]["fwd_5d"].abs().mean()
normal_move = data["fwd_5d"].abs().mean()

print(f"Avg 5-day move after compression: {avg_move:.2%}")
print(f"Avg 5-day move (normal): {normal_move:.2%}")

If compression breakouts consistently produce larger moves than average, you have a tradeable signal.

Image

3. Post-Earnings Drift

Stocks with strong earnings surprises keep moving in the same direction for 10-40 trading days after the announcement. This is one of the most well-documented anomalies in finance.

The market underreacts to earnings news. You profit by riding the drift.

python

import yfinance as yf
import pandas as pd

ticker = yf.Ticker("AAPL")
earnings = ticker.earnings_dates

# Get historical prices
prices = yf.download("AAPL", period="5y")["Close"].squeeze()

# For each earnings date, measure forward returns
results = []
for date in earnings.index[:20]:
    date = date.tz_localize(None)
    try:
        subset = prices.loc[date:]
        if len(subset) < 21:
            continue
        entry = float(subset.iloc[1])
        exit_20d = float(subset.iloc[20])
        ret = (exit_20d - entry) / entry
        results.append({"date": date, "return_20d": ret})
    except Exception:
        continue

df = pd.DataFrame(results)
print(f"Average 20-day post-earnings return: {df['return_20d'].mean():.2%}")
print(f"Win rate: {(df['return_20d'] > 0).mean():.0%}")

Filter for earnings surprises above 5% and the drift gets even stronger.

Image

4. Intraday Gap Continuation

Days that open with large gaps and strong early volume tend to trend more than normal sessions. These gaps reflect real institutional positioning, not random noise.

python

import yfinance as yf

data = yf.download("SPY", period="2y", interval="1d")
data.columns = data.columns.get_level_values(0)

# Calculate overnight gap: open vs previous close
data["gap"] = (data["Open"] - data["Close"].shift(1)) / data["Close"].shift(1)
data["day_return"] = (data["Close"] - data["Open"]) / data["Open"]

# Filter for significant gaps (>0.5%)
big_gaps_up = data[data["gap"] > 0.005]
big_gaps_down = data[data["gap"] < -0.005]

print(f"Gap up days: {len(big_gaps_up)}")
print(f"Avg continuation after gap up: {big_gaps_up['day_return'].mean():.3%}")

print(f"\nGap down days: {len(big_gaps_down)}")
print(f"Avg continuation after gap down: {big_gaps_down['day_return'].mean():.3%}")

If gap-up days continue higher on average, the strategy is: buy the open on gap-up days with strong volume, sell at close.

Image

5. Z-Score Mean Reversion

Select two assets with rolling correlation above 0.8. Compute the log-price spread, standardize it into a z-score, and trade when it hits extremes.

Statistically extreme deviations revert toward zero more often than they expand.

python

import yfinance as yf
import numpy as np

# Pick two highly correlated assets
gold = yf.download("GLD", period="2y")["Close"].squeeze()
silver = yf.download("SLV", period="2y")["Close"].squeeze()

# Rolling correlation
corr = gold.rolling(60).corr(silver)
print(f"Current 60-day correlation: {corr.iloc[-1]:.3f}")

# Log spread + z-score
spread = np.log(gold) - np.log(silver)
z = (spread - spread.rolling(60).mean()) / spread.rolling(60).std()

# Backtest mean reversion
data = z.to_frame("z")
data["spread_fwd_5d"] = spread.pct_change(5).shift(-5)

extreme = data[data["z"].abs() > 2]
print(f"\nExtreme z-score occurrences: {len(extreme)}")
if len(extreme) > 0:
    print(f"Avg 5-day spread reversion: {extreme['spread_fwd_5d'].mean():.3%}")
    print(f"Reversion rate: {(extreme['z'] * extreme['spread_fwd_5d'] < 0).mean():.0%}")
else:
    print("No extreme z-score events in this period")

Reversion rate above 60% with positive average return = tradeable edge.

Image

6. RSI Momentum Rotation

Top-performing stocks over the past 3-6 months often continue outperforming. Momentum spreads historically produce several percent yearly advantage over laggards.

The strategy: rank stocks monthly, hold the top performers, rotate monthly.

python

import yfinance as yf

tickers = ["AAPL", "MSFT", "GOOGL", "AMZN", "NVDA",
           "META", "TSLA", "JPM", "V", "WMT"]

# Pull 2 years of data
prices = yf.download(tickers, period="2y")["Close"]

# Calculate 3-month momentum
momentum = prices.pct_change(63)  # ~63 trading days = 3 months

# Monthly rotation: top 3 performers
latest = momentum.iloc[-1].sort_values(ascending=False)
top_3 = latest.head(3)
bottom_3 = latest.tail(3)

print("TOP 3 (buy):")
for t, m in top_3.items():
    print(f"  {t}: {m:.1%} 3-month return")

print("\nBOTTOM 3 (avoid):")
for t, m in bottom_3.items():
    print(f"  {t}: {m:.1%} 3-month return")

Backtest by measuring the spread between top-ranked and bottom-ranked baskets over rolling periods.

Image

7. Overnight Drift Strategy

A large portion of long-term equity returns historically comes from close-to-open gaps rather than intraday moves. Overnight returns reflect institutional positioning and after-hours information flow.

python

import yfinance as yf

data = yf.download("SPY", period="5y", interval="1d")
data.columns = data.columns.get_level_values(0)

# Split returns into overnight and intraday
data["overnight"] = (data["Open"] - data["Close"].shift(1)) / data["Close"].shift(1)
data["intraday"] = (data["Close"] - data["Open"]) / data["Open"]

# Cumulative returns
overnight_cum = (1 + data["overnight"].dropna()).cumprod()
intraday_cum = (1 + data["intraday"].dropna()).cumprod()

print(f"Overnight cumulative return: {(overnight_cum.iloc[-1] - 1):.1%}")
print(f"Intraday cumulative return: {(intraday_cum.iloc[-1] - 1):.1%}")
print(f"\nOvernight avg daily: {data['overnight'].mean():.4%}")
print(f"Intraday avg daily: {data['intraday'].mean():.4%}")

If overnight returns dominate, the strategy is buying at close and selling at open: capturing the drift while avoiding intraday noise.

Image

The Bigger Picture

These 7 strategies work on traditional equities. But the biggest edge right now is applying the same math to prediction markets where the competition is 100x weaker.

Prediction markets have:

  • Thinner orderbooks
  • More retail participants
  • Slower price discovery
  • Cross-venue mispricings that persist for hours

The same statistical thinking: mean reversion, momentum, volatility compression, spread arbitrage - applies to prediction markets with far less competition.

That's what I do daily.