Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

➡️ Quantitative Finance from Scratch, part 37: Binomial model option pricing The stock moves in steps, and each step goes up or down by a fixed factor that comes from the volatility. In one step of one year, a stock at $100 goes to $122.14 or $81.87, and a...

26,700 Aufrufe • vor 13 Tagen •via TikTok

0 Kommentare

Keine Kommentare verfügbar

Kommentare vom Original-Post werden hier angezeigt

Ähnliche Videos

➡️ Part 30 of Quantitative Finance From Scratch: the Black-Scholes formula. A call option is the right to buy a stock at a fixed price (the strike) on a fixed date. Fischer Black and Myron Scholes published the formula in 1973 (Journal of Political Economy), Robert Merton derived it another way, and in 1997 Scholes and Merton received the Nobel Memorial Prize in Economic Sciences. Black had died in 1995. C = S N(d1) - K e^(-rt) N(d2), with d1 = [ln(S/K) + (r + σ²/2) t] / (σ √t) and d2 = d1 - σ √t. S is today's stock price, K the strike, r the risk free rate, t the time to expiry in years, σ the volatility, and N the cumulative standard normal distribution. The stock's expected return does not appear, because stock and cash can copy the option. Our test run (blackscholes.py, 16 lines of numpy, seed 30): stock 100, strike 100, 1 year, rate 4 %, volatility 20 %. Then d1 = 0.3, d2 = 0.1, N(d1) = 0.618, N(d2) = 0.540, and the price is 61.79 - 51.87 = 9.93. One million risk neutral Monte Carlo prices give an average discounted payoff of 9.92 (standard error 0.014). With the stock at 100 the same option costs 4.49 with 3 months left and 15.08 with 2 years left. Honest notes: the model assumes a constant volatility and price paths without jumps. If you solve the formula backwards from real option prices, the volatility changes with the strike (the smile), so in practice each option gets its own implied volatility for the stock. #quantfinance #blackscholes #options #finance #python

QuantFinanceToGo

24,700 Aufrufe • vor 23 Tagen

➡️ 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

102,600 Aufrufe • vor 15 Tagen

➡️ Part 31 of Quantitative Finance From Scratch: implied volatility. The Black-Scholes formula from part 30 needs five inputs. Four of them you can look up (stock price, strike, rate and time), but the fifth, the volatility over the life of the option, lies in the future. Traders form their own views, buy and sell options, and supply and demand set the price. Put that market price into the formula and solve it backwards for the volatility, and you get the implied volatility. Our test run (impliedvol.py, 16 lines of plain Python): stock 100, strike 100, rate 5 %, 1 year, and a call that costs 12 dollars on the market. The volatility sits in several places of the formula, so there is no way to solve for it by hand, but the price always rises with the volatility. A bisection search tries the middle of the range (50 %, 25 %, 12.5 % and so on) and halves the range each time. After 10 steps the price fits to half a cent, and the implied volatility is 24.1 %. Every strike and every expiry date has its own implied volatility. Together all these values form the implied volatility surface. Historical volatility, measured from past returns, serves as a comparison, and as the estimate when no options trade. Honest notes: the smile, the expiry curve and the 3D surface in the video are an illustration in the typical shape for index options, anchored at our test run, and contain no market data. The price paths and the past returns are simulated. Implied volatility shows how the market prices the expected swing, and the real swing can turn out larger or smaller. #quantfinance #impliedvolatility #options #blackscholes #finance

QuantFinanceToGo

51,900 Aufrufe • vor 21 Tagen

➡️ Quant Finance from scratch part 15: the CAPM (Capital asset pricing model) There is a lot of discussion in science ongoing whether it is still a good estimate for expected returns or too simple with just 1 factor (market). Still its crucial to understand the concept itsself. Step 1, a simulated market with assumed numbers, not forecasts: a risk-free asset pays 3 % a year, and the market pays 5 % more on average, with swings of 15.9 % a year. Step 2, eight stocks with betas from 0 to 1.4. Each also has swings of its own, unrelated to the market. Step 3, two of them: one with beta 0.4 and big swings of its own (20 %), one with beta 1.2 and small ones (9 %). Both swing about 21 % a year in total, yet they earned 5.3 % and 9.3 % on average. Step 4, mixing: a mix of 100 stocks like the first still earns 5.1 % but swings only 6.7 %. As in Part 11, a stock's own swings average out in a mix, while the market's swing stays. Beta measures the assets sensitivity to the market movements. Step 5, the line: the eight average returns lie on a straight line against beta, 3.1 % + 5.1 % for every step of 1 in beta. That is the CAPM equation, which gives the expected return of any single stock from its beta: expected return = risk-free rate + beta x (market's expected return - risk-free rate). For beta 1.2 it gives 3 % + 1.2 x 5 % = 9 %, close to the 9.3 % measured. Sharpe shared the 1990 Nobel Memorial Prize in Economic Sciences with Harry Markowitz and Merton Miller, his part for the theory of how assets are priced, the CAPM. The committee notes that several researchers developed it independently in the mid 1960s and names his essay "Capital Asset Prices: A Theory of Market Equilibrium under Conditions of Risk" (Journal of Finance, 1964) as his pioneering achievement. This video is for education only, and nothing in it is financial advice. #quantfinance #capm #beta #finance #python

QuantFinanceToGo

58,900 Aufrufe • vor 1 Monat

➡️ Quantitative Finance from Scratch, part 48: Inventory Risk. A market maker always quotes a price you can buy at (ask) and a price you can sell at (bid) and earns the gap. Its inventory is the stock it holds right now: when you sell to it, the inventory grows, when you buy from it, the inventory shrinks. In a calm market, buyers and sellers arrive about equally often, so the inventory stays near zero. Orders often come in waves. When many people sell at once, the market maker keeps buying and the shares pile up. Then every move in the price hits the whole position. Example: with 5,000 shares, a drop of 10 cents costs $500, as much as the spread earns on 12,500 shares at 4 cents each (P&L = cash + inventory × fair price). So it fights back with its prices. With too much stock, it lowers both its bid and its ask: the cheaper ask attracts buyers, the lower bid brings in fewer sellers, and the inventory shrinks again. With too little stock, it raises both prices. This is called skewing the quotes. When prices move fast, it also widens the spread, and if the position still grows too large, it hedges it or sells part of it. Avellaneda and Stoikov (2008, Quantitative Finance 8(3)) turned this into a formula, the reservation price r = s − q·γ·σ²·(T − t): s fair price, q inventory, γ risk aversion, σ volatility, T − t time left. The more inventory, risk aversion and volatility, the further the quotes move away from the fair price. The code (inv_reel.py, 15 lines of plain Python without packages) is general on purpose: booking a fill, the profit and loss, a half spread that grows with volatility, and quotes around the reservation price. Part 49 looks at the second risk, trading with someone who knows more. If you want to go deeper, check out the full course I built: quantfinancetogo.com #quantfinance #marketmaking #inventoryrisk #finance #python Education only, not financial advice.

QuantFinanceToGo

13,600 Aufrufe • vor 2 Tagen

➡️ Quant Finance from scratch Part 4: why many small random steps always build the same shape Two questions guide the video: why do random steps always build this same shape, and what does it let quants say about how far a stock can move? Step 1, the board. 1,000 balls fall through 12 rows of pins and bounce right or left like a coin flip. Every ball is a random walk from part 2, and the bin where it lands counts how often it went right. Step 2, why the middle. All 4,096 paths are equally likely. Only one goes right every time, while 924 go right exactly six times and end in the middle, so most balls land there: 613 of 1,000 in the middle three bins. Step 3, part 3 again. The 1,000 walks from part 3 build the same bell after 400 steps, only wider: their spread is 19.9, the square root rule's √400 = 20. Step 4, any step shape. Add up a hundred random amounts, each anywhere between -1 and +1, and the bell appears again. That is the central limit theorem. Step 5, the rule. The bell is the normal distribution: about 68 % of results land within one standard deviation, 95 % within two and 99.7 % within three. Our 100,000 sums gave 68.2, 95.5 and 99.7 %. Step 6, a stock. A year is the sum of many daily moves, so quants model returns with the bell. With 1 % a day the yearly swing is 1 % × √252 = 15.9 %: about two years in three end within 16 % up or down, nineteen in twenty within 32 %, and the bell says a move beyond 48 % comes once in about 370 years. The honest part: real returns have fat tails. In a simulated market with fat tails and the same average swing, days beyond four standard deviations came 65 times in 40 years, where the bell expects less than one. The bell is a first model, and a later part covers the tails. This video is for education only, and nothing in it is financial advice. #quantfinance #bellcurve #normaldistribution #centrallimittheorem #python

QuantFinanceToGo

74,400 Aufrufe • vor 1 Monat

➡️ Quantitative Finance from Scratch, part 44: Arbitrage Pricing Theory (APT). Stephen Ross published it in 1976 as an alternative to the CAPM. The CAPM explains expected returns with one risk, the market. The APT allows several risks, called factors, for example surprises in economic growth, inflation or interest rates. Every stock gets its own beta for each factor, plus swings of its own that have nothing to do with any factor. A factor model describes how a return moves when a factor changes. The APT asks a different question: what return should an investor expect for carrying that risk? In a factor model each stock can have its own alpha. The APT says this alpha should be zero, because two stocks with the same exposures carry the same risk and should earn the same expected return. The formula: E[R_i] = r_f + β_i1 λ_1 + β_i2 λ_2 + ... + β_iK λ_K, with r_f the risk free rate, β the exposure of the stock to one factor and λ the premium the market pays per unit of that factor's risk. If two stocks have the same exposures and one is expected to earn more, you buy that one and sell the other. Every factor cancels out, and with many such pairs their own swings average away. Traders who exploit such gaps push prices back, so expected returns line up on the formula, at least approximately. The theory leaves open which factors to use; researchers pick them from data, like Chen, Roll and Ross (1986) with economic factors, and the Fama-French model follows the same logic. The code (apt_reel.py, 15 lines of plain Python without packages) is general on purpose: the expected return from the risk free rate, the betas and the premiums, the alpha as the part the betas leave unexplained, and the arbitrage rule for two stocks with the same betas. Honest notes: the plane, the stocks and the long-short pairs in the video come from a simulation (seed 44), not from market data. Assumed: 100 stocks, two factors, betas between 0 and 1.5, risk free rate 2 %, premiums 4 % and 2 % per year, one stock with an alpha of 3 %, monthly factor surprises with 4.5 % and 3 % volatility, own swings 6 % per month, 64 pairs over 120 months. In the simulation the hedged position has exactly zero factor exposure and zero net cost, and the leftover swings shrink roughly with the square root of the number of pairs. Real arbitrage has costs, limits and estimation error in the betas. Sources: Ross, S. A. (1976), The Arbitrage Theory of Capital Asset Pricing, Journal of Economic Theory 13(3), 341-360. Chen, N.-F., Roll, R. and Ross, S. A. (1986), Economic Forces and the Stock Market, Journal of Business 59(3), 383-403. #quantfinance #apt #arbitragepricingtheory #factormodels #capm Education only, not financial advice.

QuantFinanceToGo

51,000 Aufrufe • vor 6 Tagen

➡️ 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

41,100 Aufrufe • vor 4 Tagen

➡️ Quantitative Finance From Scratch, Part 21: Linear Regression in finance Linear regression finds the straight line that best describes how one quantity moves with another. In finance, that is often a stock's daily return against the market's daily return. Least squares: for every day, you measure how far the real return lies from the line, square that distance and add everything up. The best line makes this sum as small as possible. The line has two numbers. The slope is the beta from Part 14: how strongly the stock follows the market. The intercept is alpha: what the stock earns on average on a day when the market does not move. What the line cannot explain is the residual, and R² tells you which share of the swings (the variance) the line explains, from 0 for nothing to 1 for everything. In this video we simulate two years (504 trading days) of a market and a stock with a built-in beta of 1.2, a second factor with a beta of 0.6 and no alpha. The line finds a beta of 1.26 (the 1.2 lies within the range of chance for two years of data), an alpha of +0.05% a day and an R² of 52%. With two inputs, the line becomes a plane: betas 1.27 and 0.60, R² 63%. Quants use regression to estimate betas, to size hedges, to test whether a strategy earns more than its risk, and to check whether two assets really move together. The limits: a regression only finds a relationship in the data you give it. It does not prove that one thing causes the other, a few extreme days can pull the line (three invented extreme days move our slope from 1.26 to 1.10), and a relationship from the past can change. Education only, not financial advice. #quantitativefinance #quant #finance #regression #beta

QuantFinanceToGo

59,100 Aufrufe • vor 1 Monat

➡️ Quantitative Finance from Scratch, part 41: Volatility Targeting. In quant finance, risk is usually measured as volatility, how strongly a price swings up and down. Volatility comes in clusters, so stormy days tend to follow stormy days, and that makes it possible to forecast it to some extent. GARCH from parts 39 and 40 is one way to do that; rolling averages and exponentially weighted averages are others. Volatility targeting takes that forecast and compares it with a risk target you choose yourself. If your target is 10 % a year and the forecast for the market is 20 %, the market is twice as wild as you want, so you hold 10 / 20 = 50 % of your money in the market, and your risk stays at 10 %. In general: exposure = target volatility / forecast volatility. When the forecast is above your target, you hold less than all of your money. When it is below, the rule asks for more than 100 %, which means borrowing, so the exposure usually gets a cap. One limit remains: every forecast looks back. A sudden crash after a calm stretch still hits a full position, and only afterwards does the forecast jump and the position shrink. The code (vt_reel.py, 15 lines of Python with numpy) is general on purpose: a GARCH forecast for tomorrow from today's move and today's forecast (omega 0.05, alpha 0.10, beta 0.85 in percent squared per day, as in part 39), the rule exposure = target / forecast with a cap, and a daily loop over the returns that sets the exposure before each day and updates the forecast after it. #quantfinance #volatility #riskmanagement #finance #portfoliomanagement Education only, not financial advice.

QuantFinanceToGo

10,300 Aufrufe • vor 10 Tagen

➡️Quantitative Finance from Scratch, part 40: GJR GARCH. The goal is simple: forecast how big tomorrow's moves will be. Volatility comes in clusters, and plain GARCH uses that by building tomorrow's forecast from today's move squared and today's forecast. Squaring wipes out the sign, though, so a 4 % drop and a 4 % rise raise tomorrow's forecast by exactly the same amount. In real stock markets a drop raises volatility much more than a rise of the same size. One reason is leverage: when the price falls, the company's debt weighs more relative to its stock, so the stock itself becomes riskier. Glosten, Jagannathan and Runkle captured this in 1993 with one extra weight, gamma, that only switches on after a down day. The model is now known as GJR GARCH: tomorrow's variance = omega + (alpha + gamma x I) x today's move squared + beta x today's variance, where I is 1 after a down day and 0 otherwise. The code (gjr_reel.py, 16 lines of Python with numpy) uses typical values omega 0.02, alpha 0.02, gamma 0.12 and beta 0.90, in percent squared per day, so the normal level is a volatility of 1 % a day. After a 4 % rise: 0.02 + 0.02 x 16 + 0.90 x 1 = 1.24, a forecast of 1.11 %. After a 4 % drop: 0.02 + 0.14 x 16 + 0.90 x 1 = 3.16, a forecast of 1.78 %. The extra volatility is 0.11 against 0.78 percentage points, about seven times as much (6.8). Plain GARCH with the values from part 39 gives 1.58 % in both cases, so right after a sell off it underestimates the risk. Source: Glosten, L. R., Jagannathan, R. and Runkle, D. E. (1993), On the Relation between the Expected Value and the Volatility of the Nominal Excess Return on Stocks, Journal of Finance 48(5), 1779 to 1801. Honest notes: the parameter values are typical textbook sizes, not estimates from real data. All market data in the video is simulated. #quantfinance #finance #volatility #riskmanagement #timeseries Education only, not financial advice.

QuantFinanceToGo

12,200 Aufrufe • vor 11 Tagen

➡️ Quantitative Finance from Scratch, part 43: Black-Litterman. Fischer Black and Robert Litterman published it in 1992 as an improvement on the Markowitz optimizer. Markowitz needs each asset's expected return and volatility. Volatility is fairly easy to estimate, expected returns are very hard, and small errors in them push the weights to extremes. Black-Litterman starts from the market portfolio instead: all the money invested in a market, with each asset's weight equal to its share of the total. As in the CAPM part, this portfolio is optimal in equilibrium, so the model works backwards and asks which returns would make it optimal. The answer is π = δΣw: the market weights w, the covariance matrix Σ (how strongly the assets swing and move together) and the risk aversion δ (extra return demanded per unit of risk) give the implied returns π. Example with 60 % stocks and 40 % bonds, assuming 15 % volatility for stocks, 5 % for bonds, a correlation of 0.2 and δ = 2.5: stocks imply about 3.5 % above the risk free rate (3.525 %), bonds 0.475 %. Then you add your own view, for example stocks earn 6 %, and say how sure you are. The model mixes market and view like a weighted average. If you are as sure as the market (view uncertainty Ω = τσ² with τ = 0.05), stocks land at about 4.8 % (4.7625 %), exactly halfway. Without any view you get back the market portfolio. The code (bl_reel.py, 13 lines of plain Python without packages) is general on purpose: implied returns from risk aversion, covariance and weights, how much of your trust goes to your view, and the weighted average of market and view. For a single view on one asset this is exactly the full Black-Litterman formula. Source: Black, F. and Litterman, R. (1992), Global Portfolio Optimization, Financial Analysts Journal 48(5), 28-43. #quantfinance #finance #portfoliooptimization #markowitz #assetallocation Education only, not financial advice.

QuantFinanceToGo

20,000 Aufrufe • vor 7 Tagen

➡️ Part 29 of Quantitative Finance From Scratch: the Carhart four-factor model. The CAPM explains a stock's return with its beta, its exposure to market risk. Eugene Fama and Kenneth French (1993) added size and value, and Mark Carhart (Journal of Finance, 1997) added momentum, the tendency of last year's winners to keep winning for a while. In his model every beta is an exposure: to the market, to size, to value and to momentum. In his study of mutual funds, these four factors and fund costs almost completely explained why some funds seemed to keep winning. Our test run (assumed numbers, a teaching example: 50 years of monthly returns, four independent factors with assumed premiums, five stocks that all have a market beta of 1 and a true alpha of zero): the stock with market exposure only earns 9.6 % a year above cash, the size stock 10.7 %, the value stock 13.3 %, the momentum stock 12.8 % and the stock with all three exposures 19.7 %. For that last stock the market alone explains 40 % of its swings, three factors 69 % and all four 94 %. Real single stocks swing far more on their own, so real fits are lower, and luck still left one simulated stock with an alpha of about -3 % a year. Since then researchers have proposed many more factors. John Cochrane (2011) spoke of a "zoo of new factors", and Harvey, Liu and Zhu (2016) counted hundreds of proposed factors and warned that many are likely false discoveries. Education only, not financial advice. #quantfinance #factorinvesting #carhart #finance #python

QuantFinanceToGo

23,600 Aufrufe • vor 24 Tagen

➡️ 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

73,300 Aufrufe • vor 12 Tagen