Tradescript Analyst retweeted
JUST IN: 🇺🇸🇮🇷 U.S. Treasury Secretary Bessent says the U.S. will have “50 days of higher prices for 50 years of no Iran nukes.”
Tradescript Analyst retweeted
Prime Minister Benjamin Netanyahu, today, at the site of the missile hit in Dimona:
“If anyone needed an explanation of why Iran is the enemy of civilization, and the enemy and the danger to the entire world. You got it in the last 48 hours.
gov.il/en/pages/event-dimona…
Tradescript Analyst retweeted
Iran needs only a 1,500 km range to strike Israel.
Why has the regime developed 4,000 km range missiles that cover western Europe? For the same reason they are developing intercontinental ballistic missiles to cover North America.
Tradescript Analyst retweeted
BREAKING: Trump says the U.S. does not use the Strait of Hormuz, and does not need it.
Tradescript Analyst retweeted
NOW - Trump: "We don't use the Strait [of Hormuz], the United States, we don't need it."
Tradescript Analyst retweeted
The very thing Donald Trump campaigned against doing.
BREAKING: The Pentagon is preparing detailed plans for a possible U.S. ground force deployment in Iran, sources say. cbsn.ws/4bsFiCw
Tradescript Analyst retweeted
Q: Do you intend to put U.S. troops in Iran?
Trump: Look, the Dow just hit 50,000
Tradescript Analyst retweeted
NATO chief Mark Rutte today said he was "confident" allies would find a way to restart traffic through the Strait of Hormuz blocked by Iran after it was attacked by the U.S. and Israel.
politico.eu/article/natos-ru…
Tradescript Analyst retweeted
Iran is negotiating with 8 countries to allow passage through the Strait of Hormuz on the condition that oil is traded in Chinese yuan.
Wow.
Tradescript Analyst retweeted
QM #15: GARCH: When Your Volatility Estimate Is a Strategy
VIX printed 27.29 this morning, up 12.63% from yesterday's close, while SPY dropped 1.52% to 666.06 and QQQ fell 1.72% to 597.26. That cluster of simultaneous moves is not coincidence. It is exactly what GARCH was built to model, and if you are trading without a volatility estimate that updates dynamically, you are pricing your risk with a tool that was already wrong before the open.
Most traders use 20-day historical volatility. They compute the standard deviation of the last 20 daily returns, annualize it by multiplying by the square root of 252, and call it done. The problem is that this estimate treats every day in the window equally. The move from three weeks ago carries the same weight as yesterday's move. On a day like today, where overnight news sent VIX surging 12% before the cash open, yesterday's observation should count for far more than a reading from February. GARCH formalizes that intuition into a model with real forecasting power.
The Structure of GARCH(1,1)
Robert Engle introduced ARCH in 1982, winning a Nobel Prize for it in 2003. Tim Bollerslev extended it to GARCH in 1986. The canonical model, GARCH(1,1), describes how variance evolves over time:
sigma_t^2 = omega + alpha * epsilon_{t-1}^2 + beta * sigma_{t-1}^2
Here, sigma_t^2 is the conditional variance at time t. epsilon_{t-1}^2 is the squared return shock from the previous period. sigma_{t-1}^2 is the previous period's variance estimate. omega is a constant that anchors the model to a long-run average. Alpha and beta are parameters you estimate from data.
The economic interpretation is direct. Alpha measures how much last period's shock updates the current variance estimate. Beta measures how much of the previous variance estimate carries forward. A high beta means volatility is persistent: once it rises, it stays elevated. A high alpha means volatility is reactive: a large shock today immediately revises tomorrow's estimate upward.
For stationarity, you need alpha + beta < 1. Fitting GARCH to equity indices typically gives something like alpha = 0.09, beta = 0.88, so alpha + beta = 0.97. That near-unit-sum is not a numerical accident. It is the market telling you that volatility shocks decay slowly.
The Long-Run Variance and Half-Life
The long-run unconditional variance implied by GARCH(1,1) is:
sigma_inf^2 = omega / (1 - alpha - beta)
With the typical equity parameters above, if omega = 0.000002, the long-run daily variance is 0.000002 / (1 - 0.97) = 0.0000667, corresponding to annualized volatility of sqrt(0.0000667 * 252) = 12.97%.
The half-life of a volatility shock under GARCH(1,1) is:
half_life = -ln(2) / ln(alpha + beta)
With alpha + beta = 0.97, note that ln(0.97) = -0.0305, so:
half_life = -0.693 / (-0.0305) = 22.7 days
If today's volatility spikes to 30%, GARCH predicts it will still be above the long-run average 22 days from now. Simple 20-day historical vol does not give you that kind of forward-looking information. It just shows you what happened. GARCH tells you what to expect.
Fitting It in Python
Here is a minimal implementation using the arch library:
import numpy as np
import pandas as pd
from arch import arch_model
import yfinance as yf
spy = yf.download("SPY", start="2023-01-01", end="2026-03-12", auto_adjust=True)
returns = 100 * spy["Close"].pct_change().dropna()
garch = arch_model(returns, vol="Garch", p=1, q=1, dist="normal")
result = garch.fit(disp="off")
cond_vol = result.conditional_volatility
annualized_vol = cond_vol * np.sqrt(252)
forecast = result.forecast(horizon=5)
forecast_var = forecast.variance.iloc[-1]
forecast_vol = np.sqrt(forecast_var) * np.sqrt(252)
print(f"Forecast vol (next 5 days): {forecast_vol.values}")
Pay attention to standard errors. If your alpha estimate is 0.09 with a standard error of 0.04, that is a meaningful estimate. If the standard error is 0.09, you have an identification problem.
Why Student-t Innovations Matter
The actual equity return distribution has heavier tails than normal: days where SPY moves 3 standard deviations happen far more often than a Gaussian model predicts.
garch_t = arch_model(returns, vol="Garch", p=1, q=1, dist="t")
result_t = garch_t.fit(disp="off")
nu = result_t.params["nu"]
print(f"Estimated degrees of freedom: {nu:.2f}")
Degrees of freedom estimates for equity indices typically land between 4 and 8. A Student-t with 5 degrees of freedom has roughly 4x more probability mass in the extreme tails than a normal distribution.
GJR-GARCH: The Leverage Effect
Standard GARCH treats a positive 2% return and a negative 2% return symmetrically. Equity markets are not symmetric. A 2% down day in SPY drives more fear, more realized vol, and a bigger VIX spike than a 2% up day. Today's data is a clean example: SPY fell 1.52% and VIX rose 12.63%.
GJR-GARCH (Glosten, Jagannathan, Runkle 1993) captures this:
sigma_t^2 = omega + alpha * epsilon_{t-1}^2 + gamma * epsilon_{t-1}^2 * I(epsilon_{t-1} < 0) + beta * sigma_{t-1}^2
When gamma > 0, negative shocks push variance higher than equivalent positive shocks would.
gjr = arch_model(returns, vol="Garch", p=1, o=1, q=1, dist="t")
result_gjr = gjr.fit(disp="off")
Gamma estimates for SPY are reliably positive and statistically significant. GJR-GARCH will almost always have a lower AIC than plain GARCH on equity data.
GARCH as a Trading Filter
Volatility targeting: you decide your portfolio should run at 10% annualized volatility, then size your position daily using the GARCH conditional vol estimate:
target_vol = 0.10
positions = pd.Series(index=returns.index, dtype=float)
for i in range(1, len(returns)):
garch_daily_vol = cond_vol.iloc[i-1] / 100
garch_annual_vol = garch_daily_vol * np.sqrt(252)
positions.iloc[i] = target_vol / garch_annual_vol
positions = positions.clip(0, 2.0)
When VIX is at 12, your position scales up. When VIX is at 27 (today), you scale down. This is not market timing. You are not predicting direction. You are sizing correctly given current risk.
Signal normalization: normalizing a momentum signal by GARCH vol removes regime dependency:
normalized_returns = returns / cond_vol
momentum_signal = normalized_returns.rolling(20).sum()
Options pricing: if today's GARCH conditional vol is high but the model expects mean reversion over the next month, near-dated options should be priced at higher implied vol than longer-dated ones. That is exactly the shape you see in the VIX term structure on days like today.
Forecasting and Its Limits
For 1-day-ahead forecasts, GARCH outperforms simple historical vol in nearly every published out-of-sample study. For 22-day-ahead forecasts, GARCH is largely predicting convergence toward the long-run mean.
Three things GARCH cannot do: it cannot forecast direction; it ignores scheduled catalysts like earnings and Fed decisions; and it assumes stable parameters that may not survive structural breaks.
The practical fix for parameter instability is rolling estimation on a 252-day window:
window = 252
rolling_vol = pd.Series(index=returns.index, dtype=float)
for i in range(window, len(returns)):
window_data = returns.iloc[i-window:i]
gm = arch_model(window_data, vol="Garch", p=1, q=1, dist="t")
res = gm.fit(disp="off", show_warning=False)
fc = res.forecast(horizon=1)
rolling_vol.iloc[i] = np.sqrt(fc.variance.values[-1, 0])
rolling_vol_annual = rolling_vol * np.sqrt(252)
The Trade Implication for Today
VIX at 27.29 on a -1.52% SPY day has a specific meaning through the GARCH lens. Using typical fitted SPY parameters (alpha 0.09, beta 0.88), the half-life calculation says this elevated vol persists for roughly three weeks. That is not a directional call. It is a statement about the distribution of returns you should plan around.
If you sell options, GARCH says you are in the zone where realized vol can easily exceed your implied vol assumption. If you run a vol-targeting strategy, GARCH says cut position size today, not after the drawdown deepens. If you trade momentum, GARCH says normalize your entry size by current vol.
The number that comes out of GARCH is not a prediction. It is a calibrated prior for tomorrow's return distribution. Using a better prior on risk is, by definition, a strategy.
The edge in volatility estimation is not dramatic. It does not generate 30% annual returns on its own. What it does is cut drawdowns in bad months, improve Sharpe ratios by roughly 0.2 to 0.4 in typical backtests, and stop you from sizing into a storm because your vol window has not yet caught up with what just happened. On a day where VIX spikes 12% before 9 AM, that gap between what you measure and what is actually happening is where money gets lost.
#trading #quant #algotrading #volatility
Tradescript Analyst retweeted
QM #14: Order Flow and Why Price Moves Before News
On March 12, 2026, SPY traded 68.4 million shares and barely moved, down 0.13% to 676.33, while VIX jumped 5.32% to 24.23. The tape looked quiet. The vol market did not agree. That gap between what price printed and what protection buyers were paying is exactly the kind of signal that order flow analysis is built to surface: who is pressing, how hard, and in which direction, before the price moves to confirm it.
Price does not move because news arrives. Price moves because someone traded on what they already knew, and the market maker had to reprice to stay solvent. The news explains the move after the fact. Order flow is the move itself, before it finishes.
What Order Flow Actually Measures
Every trade has two sides. In microstructure, what matters is not who bought and who sold -- it is who was aggressive and who was passive. The passive side posted a limit order and waited at the bid or ask. The aggressive side sent a market order and consumed that resting liquidity.
Aggressive buys hit the ask. Aggressive sells hit the bid. When buyers are consistently pressing the offer, market makers accumulate short inventory and must reprice their quotes higher to attract sellers and rebalance. Price rises before any news event, driven entirely by the mechanical need of dealers to manage exposure.
Order flow imbalance (OFI) quantifies this pressure as a scalar. For a window of N trades, it is the net signed volume:
OFI = sum(v_i * d_i for i in 1..N)
where v_i is trade size and d_i is +1 for buyer-initiated trades and -1 for seller-initiated. Trade direction is assigned via the Lee-Ready rule: trades above the bid-ask midpoint are buys, trades below are sells, trades exactly at the midpoint inherit the sign from the most recent price move.
The Math: OFI at the Limit Order Book Level
The 2014 Cont, Kukanov, and Stoikov paper extended OFI beyond individual trades to the full bid-ask event stream. Their formulation assigns a directional contribution to every change at the best bid and ask:
e_bid = +q_bid if P_bid_t >= P_bid_{t-1} (bid held or rose: buy pressure)
e_bid = -q_bid if P_bid_t < P_bid_{t-1} (bid dropped: sell pressure)
e_ask = -q_ask if P_ask_t <= P_ask_{t-1} (ask held or fell: buy pressure consuming offer)
e_ask = +q_ask if P_ask_t > P_ask_{t-1} (ask rose: dealers pulling offers, sell pressure)
OFI_t = e_bid_t - e_ask_t
This version captures pressure that exists before any trade executes. A bid that keeps refreshing at an elevated price with increasing quantity signals buy pressure even during quiet moments in the tape.
Kyle's Lambda: How Much Does Flow Move Price?
Albert Kyle's 1985 model described a market with one informed trader, many uninformed noise traders, and a competitive market maker who observes total order flow but cannot distinguish the two. The equilibrium produces a clean linear relationship:
delta_P = lambda * q
Lambda is the price impact coefficient. It measures how much price moves per unit of net order flow. A stock with high lambda is thinly traded. A stock with low lambda is deep and liquid. SPY, with 68.4 million shares traded today, has an extremely low lambda. A small-cap with 500,000 shares of daily volume sitting in a crowded short position might have a lambda ten times higher.
You estimate lambda empirically by regressing price changes on signed order flow:
delta_P_t = alpha + lambda * OFI_t + epsilon_t
Run this on 5-minute bars using a rolling 30-day window and you get a time-varying lambda that tracks how the market's capacity to absorb directional flow changes with regime. When lambda is rising on SPY or QQQ, the market is getting harder to move through.
Why Price Moves Before News
Informed traders know something the market maker does not. They act by placing aggressive orders. That flow creates OFI. The market maker, observing one-sided flow, adjusts quotes. Price moves. The mechanism requires no news to reach the terminal; it requires only that the market maker respond rationally to inventory pressure.
The market maker does not need to identify who is informed. They only need to see that flow is unusually one-sided and reprice before losses accumulate. By the time any public announcement arrives, the price has already traveled a significant portion of the distance to its new equilibrium.
Easley and O'Hara's PIN model (Probability of Informed Trading) formalizes this as a Poisson arrival process. Informed and uninformed order arrivals are modeled separately, and the posterior probability that a given order comes from an informed trader is backed out from the observed flow distribution. High-PIN stocks show rapid price adjustment to volume because dealers assign high probability to the flow being information-driven.
Earnings announcement studies show elevated OFI in the hours before the release -- sometimes six to eight hours before. M&A activity shows abnormal options flow days before any public announcement. The signal is not subtle. It is just rarely looked for by traders who treat price as the primary data source.
Today's tape makes this concrete. VIX is up 5.32% while SPY is down only 0.13% and QQQ is flat at -0.01%. Someone is buying protection aggressively in the options market without yet pressing spot price. That divergence -- options OFI leading spot price -- is one of the cleaner setups the framework can identify.
Python: Computing OFI and Kyle's Lambda
import pandas as pd
import numpy as np
from scipy import stats
def sign_trades_lee_ready(trades):
df = trades.copy()
midpoint = (df['bid'] + df['ask']) / 2.0
above_mid = df['price'] > midpoint
below_mid = df['price'] < midpoint
at_mid = df['price'] == midpoint
df['direction'] = np.where(above_mid, 1, np.where(below_mid, -1, 0))
price_diff = df['price'].diff()
tick_sign = np.sign(price_diff).replace(0, np.nan).ffill().fillna(1)
df.loc[at_mid, 'direction'] = tick_sign[at_mid]
return df
def compute_ofi(trades, freq='5min'):
trades = trades.copy()
trades['signed_vol'] = trades['size'] * trades['direction']
return trades['signed_vol'].resample(freq).sum()
def estimate_kyle_lambda(price_series, ofi_series):
delta_p = price_series.diff().dropna()
ofi_aligned = ofi_series.reindex(delta_p.index).dropna()
delta_p = delta_p.reindex(ofi_aligned.index)
mask = ofi_aligned != 0
x = ofi_aligned[mask].values
y = delta_p[mask].values
slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)
return {'lambda': slope, 'r_squared': r_value**2, 't_stat': slope/std_err}
def ofi_signal(trades, lookback=20, freq='5min'):
ofi = compute_ofi(trades, freq=freq)
rolling_mean = ofi.rolling(lookback).mean()
rolling_std = ofi.rolling(lookback).std()
return (ofi - rolling_mean) / rolling_std.where(rolling_std > 0)
You need Level 2 data with bid and ask at each trade timestamp. The normalization in ofi_signal is not optional -- raw OFI scales with volume, so a slow Friday afternoon and a volatile open are not comparable without it. A z-score above 2.0 on 5-minute OFI in a high-lambda name, combined with a price that has not yet moved proportionally, is your entry window.
What OFI Does Not Tell You
The predictive power of signed order flow decays fast. Half-life is measured in minutes at the intraday level. OFI is a timing tool. It tells you when pressure is building, not whether your directional thesis is right.
The signal also breaks down around mechanical liquidity events: index rebalances, options expiration, ETF creation/redemption. These generate large, one-sided order flow that looks informed but is driven by mandated activity. Today's VIX at 24.23 with QQQ at 60.1 million shares and essentially no price movement is the kind of session where a volatility filter on your OFI signal earns its keep.
def vol_adjusted_ofi_signal(ofi_z, price_series, vol_window=20, vol_lookback=30):
log_returns = np.log(price_series).diff()
realized_vol = log_returns.rolling(vol_window).std() * np.sqrt(252 * 78)
vol_mean = realized_vol.rolling(vol_lookback).mean()
vol_std = realized_vol.rolling(vol_lookback).std()
vol_z = (realized_vol - vol_mean) / vol_std.replace(0, np.nan)
scale = np.where(vol_z > 1.5, 0.5, 1.0)
return ofi_z * scale
Trade Implications
The cleanest use of OFI for most systematic traders is in execution, not in generating directional signals. If your model says buy and OFI is strongly negative, the market maker is actively shifting quotes lower. Waiting for OFI to neutralize before entering costs less than the adverse drift you pick up entering against active sell pressure.
For options traders, the natural analogue is put/call volume imbalance alongside spot OFI. When put volume on SPY is running elevated while spot OFI is neutral or slightly positive, it often means dealers are buying puts as hedges against the inventory they accumulated filling retail call flow. The vol move comes first; spot follows when the hedging demand is large enough to move underlying price through delta exposure.
Track Kyle's lambda on your primary instruments over time. A trending increase in lambda on SPY or QQQ means the same amount of order flow is moving price more than it used to. That is a regime signal: liquidity is thinning, the market maker is less willing to absorb directional pressure, and volatility shocks are more likely. VIX at 24.23 is consistent with exactly this dynamic.
Price is a noisy summary of every resting order and every canceled quote and every passive fill that happened in an interval. Flow strips that noise away and shows what the aggressive participants -- the ones willing to cross the spread to get done -- were actually doing. The market maker sees that signal in real time. You can too, if you are looking at the right data.
The news comes after. The flow was always first.
#trading #quant #algotrading #marketmicrostructure
Tradescript Analyst retweeted
QM #12: The Real Number of Bets in Your Portfolio
VIX closed at 24.77 today while SPY, QQQ, and IWM moved within 0.12% of each other, all hugging the flat line in near-perfect lockstep. Three tickers. One bet. That gap between what you think you own and what you actually own is not a quirk of a bad day. It is the default state of almost every equity portfolio, and most traders never measure it.
The standard pitch for diversification is that owning more things reduces risk. Add 10 stocks and you've cut your idiosyncratic exposure. Add 20 and you're nearly at "market risk only." The problem is that this logic assumes the new things you're adding are actually different bets. They're often not. When you buy SPY, QQQ, GLD, and HYG in the same account, you haven't made four bets. You've made somewhere between 1.5 and 2.5 bets depending on the regime. In a stress event, the only time diversification actually matters, that number compresses further.
PCA is the tool that tells you the truth. Principal Component Analysis, applied to your portfolio's covariance matrix, decomposes your holdings into orthogonal factors. Each factor is a real independent bet. The eigenvalues associated with those factors tell you how much of your total portfolio variance is driven by each one. From those eigenvalues, you can compute a single clean number: the effective number of independent bets in your book.
For N assets with equal volatilities and equal pairwise correlations rho, the portfolio's covariance matrix has one dominant eigenvalue and N-1 smaller ones. With 10 assets at 20% vol and 0.70 average correlation:
First eigenvalue captures 73% of total portfolio variance.
Ten assets. Three real bets.
The effective number N_eff comes from Shannon entropy applied to the normalized eigenvalue distribution:
N_eff = exp( -sum( p_i * log(p_i) ) )
When all eigenvalues are equal (true independence), N_eff = N. When one factor dominates, N_eff approaches 1.
Right now with VIX at 24.77, SPY at 677.18, HYG at 80.04 moving in lockstep with equities: your six-asset book has roughly 2.4 effective bets on a good day. In a stress event, that drops toward 1.5.
If you own SPY, QQQ, and IWM as separate positions in your account, you effectively own 1.2 positions.
The trade implications:
1. Position sizing. If N_eff = 2.4, you shouldn't size each of your 10 positions as if they were independent. Your true risk capital is deployed across 2.4 bets, not 10.
2. Hedge quality. A put on SPY hedges your first factor. It does not hedge your second-factor exposure. If your book has growth vs. defensive tilt, the SPY put is giving you less protection than you think.
3. Regime detection. Compute rolling 60-day N_eff weekly. When it drops below 2.0, you are running a single directional bet. When it rises above 3.5, diversification is actually working.
PCA strips away the story you tell yourself about your portfolio. You're not diversified across large cap, tech, and small cap. You're long risk appetite, slightly long the tech/growth spread, with fractional exposure to a liquidity factor. The eigenvalues tell you the size of each bet. The entropy of that distribution gives you the count.
Measure the real number of bets you're making. Probably stop there.
#quant #trading #algotrading #quantfinance
Tradescript Analyst retweeted
Most traders say they ran Monte Carlo.
They ran one. There are three and they give SPY a 3.1%, 14.1%, and 17.3% chance of a 20% drawdown in 90 days.
Same data. Three frameworks. Wildly different answers.
GBM to Regime-Switching to MCMC, built from scratch:
tradescript.substack.com/p/s…
Tradescript Analyst retweeted
MEGA Bullish! 😍 🚀
The next "Lord of the Rings" movie has the working title "The Lord of the Rings: The Hunt for Gollum."
The movie will be directed and star Andy Serkis. Peter Jackson is on board as producer. variety.com/2024/film/news/l…

















