QuantFinanceToGo's banner
QuantFinanceToGo's profile picture

QuantFinanceToGo

@quantfinancetogo • 33,500 subscribers

Videos

quantfinancetogo's profile picture

➡️ Quantitative Finance from Scratch, part 45: Statistical Arbitrage. The arbitrage from the last part was a profit without any risk. Statistical arbitrage is the practical version: many small bets that can each lose, but win on average. One of the best known and simplest forms is pairs trading: two stocks in the same business that move together. The gap between them, the spread = P_A − β · P_B (P_A price of stock A, P_B price of stock B, β the hedge ratio), keeps coming back to its average. That is the edge: the trade treats this return almost like a law, so the further the spread moves away, the more it should come back, and that way back is the profit. The rule: z = (spread − average) / standard deviation. When z reaches +2 or −2, you sell the expensive stock, buy the cheap one, and close both when the gap is back at its average. Because one stock is long and the other short, a move of the whole market mostly cancels out. News about one company can still hit a single pair, so funds make many such trades at once, and the surprises average out. The big risks: the link between two stocks can break for good, for example after a merger, and when many funds hold the same trades, they can all lose at once. The code (statarb_reel.py, 16 lines of plain Python without packages) is general on purpose: the spread from two prices and the hedge ratio, the z score, and the signal that sells the expensive stock and buys the cheap one at two standard deviations and closes at the average. If you want to go deeper, the link to my website is in my bio. #quantfinance #statisticalarbitrage #pairstrading #meanreversion #python Education only, not financial advice.

QuantFinanceToGo

35,900 просмотров • 1 день назад

quantfinancetogo's profile picture

➡️ Quantitative Finance from Scratch, part 39: GARCH. Markets show a clear pattern: calm weeks follow calm weeks, and high volatility days arrive in groups. This is called volatility clustering. Robert Engle introduced the idea in 1982 with the ARCH model (Econometrica), Tim Bollerslev extended it to GARCH in 1986 (Journal of Econometrics), and Engle received the 2003 Nobel Prize in economics for methods of analyzing time series with time-varying volatility. GARCH(1,1) builds tomorrow's variance, the square of volatility, from three parts: a small constant omega that pulls the forecast back toward a normal level, today's move squared times a weight alpha, so a big surprise raises tomorrow's forecast right away, and today's variance times a weight beta, the memory that keeps a high forecast high for a while. The code (garch_reel.py, 16 lines of Python with numpy) uses typical values omega 0.05, alpha 0.10 and beta 0.85, in percent squared per day. The normal level is a volatility of 1 % a day. After a drop of 4 % on a calm day, tomorrow's variance is 0.05 + 0.10 x 16 + 0.85 x 1 = 2.50, so the forecast volatility jumps to 1.58 %. The extra variance then halves every 13.5 trading days: the forecast for day 5 is 1.49 %, for day 10 1.39 % and for day 30 1.16 %. In 1,000,000 simulated days of the same model, a move above 2.5 % happens on 1.75 % of all days, but on 10.97 % of the days right after such a move, about 6.3 times as often. Risk managers use GARCH forecasts to update value at risk, and some funds scale their positions down when the forecast volatility rises. If you want the full picture, there is a longer GARCH video on the YouTube channel. Honest notes: all data in the video is simulated with the GARCH model itself, so the clustering is built in by design; in real markets volatility usually reacts more strongly to falls than to rises, which this simple symmetric model leaves out. The 3D landscape of columns (20 simulated stocks sharing one GARCH volatility) is an illustration with compressed heights, not to scale. The value at risk line uses 1.65 times the forecast volatility, a normal approximation for one day at 95 %. #quantfinance #garch #volatility #riskmanagement #finance Education only, not financial advice.

QuantFinanceToGo

71,800 просмотров • 9 дней назад

quantfinancetogo's profile picture

➡️ Quantitative Finance from Scratch, part 35: how market makers make money. The first source is the spread. Like an exchange booth, a market maker buys a little below the fair price at the bid and sells a little above it at the ask, so every trade earns half the gap whatever the stock does next. After selling a call, it buys delta shares, so small moves no longer matter. The second source comes from the other Greeks: theta is the income, because the call it owes loses value every day, and gamma is the cost, because after every big move it must buy shares high and sell them low to keep the hedge. If the stock moves exactly as much as the implied volatility in the price, income and cost cancel. If it stays calmer, the market maker earns, and if it moves more, it loses. Vega is the risk to this income, because a jump in implied volatility makes the call it owes more expensive. If a customer sells it the call instead, everything flips. The code (marketmaker.py, 16 lines) sells our call from part 33 at the ask (fair $10.45, ask $10.55, bid $10.35) and hedges it every day on 2,000 simulated years with an implied volatility of 20 %. With a real volatility of 16 % it earns $1.59 per call on average and every path ends in profit; at 20 % it earns $0.10, about the spread; at 24 % it loses $1.41 and only 0.3 % of paths end in profit. Honest notes: a simplified model with one option, daily hedging, Black Scholes prices, constant volatility, no trading costs, no dividends and no other customers. Real market makers manage many options at once and also face fees, inventory limits and jumps. #quantfinance #options #marketmaking #greeks #finance

QuantFinanceToGo

91,600 просмотров • 13 дней назад

quantfinancetogo's profile picture

➡️ Quantitative Finance from scratch part 12 closes season 1. Every part was one step in a single story about a bet with an edge, and every number below comes from that part's own run. Part 1, expected value: a $1 bet on red wins 18 times out of 37, so it loses 2.7 cents on average, and over a million bets the casino made $27,288. Part 2, the random walk: coin flips add up to something that looks like a stock chart, and the same edge becomes a drift of 2.7 cents per step. Part 3, the square root rule: after 100 random steps the typical distance is about 10, because randomness grows with the square root of time. Part 4, the bell curve: many small random steps build it, with 68 % of results within one standard deviation. Part 5, returns: percent moves multiply, so after -50 % you need +100 % to get back. Part 6, present value: at 5 % interest, $100 paid in ten years is worth $61.39 today. Part 7, volatility: two investments with the same average swing about 4 % and 32 % a year. Part 8, the Sharpe ratio (William F. Sharpe, 1966): extra return per unit of risk, 0.36 for the wild investment and 0.99 for the calm one. Part 9, volatility drag: +50 % and then -50 % leaves you 25 % down. Part 10, correlation: the less two assets move together, the less a 50/50 mix swings, from 19 % down to 10 %. Part 11, diversification: ten assets cut the risk from 20 % to 12.2 %, above a floor of 11 % that the shared market sets (Markowitz, "Portfolio Selection", Journal of Finance, 1952). The big picture: how big the edge is, how much it swings, and how much of that swing you can spread away. Season 2 brings portfolios, bets and evidence. This video is for education only, and nothing in it is financial advice. #quantfinance #finance #riskmanagement #portfolio #probability

QuantFinanceToGo

109,400 просмотров • 1 месяц назад

quantfinancetogo's profile picture

➡️ Quantitative Finance From Scratch, Part 23: Mean Reversion. Mean reversion means that a quantity which moves far from its long run average tends to drift back toward it. A single stock price behaves much like a random walk, but spreads, ratios and rates (the gap between two related stocks, interest rates, volatility) often show a pull back. The simplest model: every day the distance from the average shrinks by a fixed share, plus a random shock. The half life is the time it takes for half of that distance to disappear, so a short half life means a strong pull back. To test for the pull, you regress today's change on yesterday's distance from the average. A negative slope means a pull back. But even pure chance often looks like a pull here: in our test, 34% of pure random walks passed the usual limit of -2. So quants use a stricter limit for the t statistic of about -3 (the Dickey-Fuller limit, about -2.9). In this video we simulate one spread with a built-in half life of 10 days for four years. The regression finds a slope of -0.070, a t statistic of -6.05 and a half life of 9.5 days, far beyond that limit. The z score measures how many standard deviations the spread is from its average. Is it profitable? Only if the pull is real, strong enough to beat trading costs and still there in data you did not use for testing. A 2016 study of 97 published return signals found that their returns were on average 58% lower after publication. The average can shift, the pull can vanish, and a spread can keep widening before it comes back. Short samples can even make a pure random walk look mean reverting: in our test, three months of a pure random walk typically showed a half life of about 10 days. Education only, not financial advice. #quantitativefinance #trading #meanreversion #statisticalarbitrage #finance

QuantFinanceToGo

23,000 просмотров • 28 дней назад

quantfinancetogo's profile picture

➡️ Part 27 of Quantitative Finance From Scratch: the Fama-French three factor model. The market beta alone (parts 14 and 15) explains stock returns only in part, so Fama and French added two more factors, size (part 26) and value (part 25). They introduced the model in 1993 in the Journal of Financial Economics ("Common risk factors in the returns on stocks and bonds"). A factor is the return of one portfolio minus another: small minus big (SMB) and high minus low (HML, cheap minus expensive). In the regression, a stock's return above the risk-free rate equals alpha, plus a beta times each factor's return, plus an error term for the stock's own swings. Alpha is what the three factors cannot explain. In our simulation (nine portfolios, three simulated factors, 50 years of monthly returns, assumed numbers, true alpha zero), the market alone leaves the small value portfolio with an alpha of 7.9 % a year and explains only 46 % of its ups and downs. With all three factors, its alpha drops to -0.9 % a year, close to the built-in zero, the model explains 90 %, and the regression finds betas of 1.00, 1.00 and 0.96. The structure is built into the model, so it shows how the method works and makes no claim about real markets. In real data, the three factors explain much of the differences in average returns, though not all: in their 1996 tests, the continuation of short-term returns (momentum) stayed unexplained, and Fama and French later added two more factors. Eugene Fama shared the 2013 Nobel Memorial Prize in Economic Sciences with Lars Peter Hansen and Robert Shiller "for their empirical analysis of asset prices". Education only, not financial advice. #quantfinance #famafrench #factorinvesting #python #finance

QuantFinanceToGo

19,300 просмотров • 24 дней назад

Больше нет контента для загрузки