Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

➡️ Quantitative Finance from Scratch, part 33: delta and delta hedging. Delta is how much the price of an option moves when the stock moves by one dollar. For a call it lies between zero and one, and in Black Scholes it is N(d1), the same term as in...

90,400 görüntüleme • 19 gün önce •via TikTok

0 Yorum

Yorum bulunmuyor

Orijinal gönderinin yorumları burada görünecek

Benzer Videolar

➡️ 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 görüntüleme • 15 gün önce

➡️ 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 görüntüleme • 23 gün önce

➡️ 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 call with strike $100 pays $22.14 or nothing. To get one price today, we average the two payoffs with weights that price the stock correctly: on average it must grow like money in the bank at 5 %, which gives 58 % for up and 42 % for down. These weights are the risk neutral probability. They also price the option, because a mix of stock and cash can copy it exactly. 58 % of $22.14, discounted at 5 %, gives $12.16. With many small steps the branches join again, and walking backwards through the tree gives the price, which zigzags toward the Black-Scholes value of $10.45. The code (binomial.py, 16 lines) builds the Cox-Ross-Rubinstein tree for S = K = 100, r = 5 %, volatility 20 %, one year: $12.16 with one step, $9.54 with two, $11.04 with three, $10.25 with ten and $10.45 with 1,000 steps, against Black-Scholes $10.45. With the same numbers, a put is worth $5.57 as a European option and $6.09 as an American option that can be exercised early (1,000 steps). Source: Cox, Ross and Rubinstein, "Option pricing: A simplified approach", Journal of Financial Economics, 1979. Honest notes: the model assumes a constant volatility and interest rate, no fees and trading at every step; real prices do not move in fixed steps. #quantfinance #options #trading #blackscholes #finance Education only, not financial advice.

QuantFinanceToGo

26,700 görüntüleme • 13 gün önce

➡️ 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 görüntüleme • 21 gün önce

➡️ 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 görüntüleme • 2 gün önce

➡️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 görüntüleme • 11 gün önce

➡️ 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 görüntüleme • 1 ay önce

➡️ 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 görüntüleme • 4 gün önce

➡️ 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 görüntüleme • 6 gün önce

➡️ 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 görüntüleme • 10 gün önce

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

112,700 görüntüleme • 1 ay önce

➡️ 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 görüntüleme • 24 gün önce

➡️ Quantitative Finance From Scratch, Part 24: Momentum. Momentum means that assets which rose the most over the past months tend to keep rising a little longer, and the biggest losers tend to keep falling. It is the opposite of mean reversion from part 23. Quants usually measure it as the return over the past 12 months, leaving out the most recent month, because very short moves tend to reverse. In research, a classic momentum portfolio ranks many stocks by this past return, buys the top group, sells the bottom group and repeats this every month. In practice there are two common versions: long only (you only hold the top ranked stocks, for example through a momentum fund) and long short (winners minus losers, so the ups and downs of the whole market largely cancel out). In this video we simulate 500 stocks for 30 years with a small built-in continuation: expected returns that drift slowly. The long short version earns 5.9% a year with a t statistic of 6.00 and a beta of -0.01 to the market. The long only version earns 13.7% a year, but with a beta of 0.99 it moves almost one for one with the market, which itself earned 10.5% a year in this simulated path. Momentum has been found in stocks, bonds, currencies and commodities, and in more than 200 years of stock data. It also has a dangerous side: after a market fall, a sharp rebound can lift the past losers fast, and momentum portfolios have had sudden, very large losses, for example in spring 2009. Some studies find it weaker and more volatile in recent decades, and trading costs eat a part of it, but it has not disappeared. All numbers come from one simulated run with assumed numbers (seed 24). No real market data, no strategy recommendation. Education only, not financial advice. #quantitativefinance #quant #momentum #factorinvesting #finance

QuantFinanceToGo

54,000 görüntüleme • 1 ay önce

➡️ Quantitative Finance From Scratch, Part 22: Hypothesis Testing. You start with the null hypothesis: the strategy's true average return is zero, so there is no edge. Then you ask how often pure luck would produce a result at least as extreme as yours if that were true. The t statistic divides the average return by its standard error (the typical size of the random error in an average). The p value is the probability of a t statistic at least this far from zero when there is really no edge. At the 95% confidence level, a result counts as significant when the p value is below 5%, and that matches a 95% confidence interval that does not include zero. In this video we simulate a strategy with a small real edge built in (a true Sharpe ratio of 1, daily swings of 1%) for five years. It reaches a t statistic of 1.50 and a two-sided p value of 13.3%. The 95% interval for the average daily return goes from -0.013% to +0.096%, so it includes zero and the result is not significant at the 5% level, even though the edge is real. By chance, the run only showed a Sharpe ratio of 0.67 instead of 1, and five years of data were not enough this time. A useful rule: the t statistic is about the yearly Sharpe ratio times the square root of the number of years. With a Sharpe ratio of 1, you need about four years to reach a t statistic of 2. The biggest trap is testing many rules. Test 100 strategies with no edge at all, and about 5 will still pass at the 5% level by luck. In our run, 7 did. A p value is not the probability that your strategy works. The test assumes independent returns and a market that stays the same, and a real edge can still be too small to survive trading costs. All numbers come from one simulated run with assumed numbers (seed 22). No real market data, no strategy recommendation. Education only, not financial advice. #quantitativefinance #quant #hypothesistesting #trading #statistics

QuantFinanceToGo

101,200 görüntüleme • 1 ay önce

➡️ Quantitative Finance From Scratch, Part 20: Backtesting. A backtest tests a trading strategy on historical data, as if you had used it back then, to see whether it would have made money and how much risk it took along the way. Portfolio managers, analysts and quant researchers run backtests before real money goes into an idea. The key idea: split the past in two. You build the rule on the first part (in sample) and then test it on later data it has never seen (out of sample). The out of sample result is the fairer check. Why it matters: if you search the past hard enough, you will find patterns, even in pure noise. Trying rule after rule until one looks good is called data mining, and many of those patterns are just statistical chance. In this video we test 498 simple rules (hold after the price rose or fell over 2 to 250 days) on 10 simulated years of a market with no edge at all. The best rule in the first five years makes +11% in sample. On the next five years, data it has never seen, the same rule loses 28% and drops to rank 460 of 498. The ten best rules in sample lose 18.5% on average out of sample. Even a properly backtested result only describes the past. Markets change, and a pattern that worked for years can stop working. Classic mistakes: look-ahead bias (using information you could not have known at that time), survivorship bias (testing only companies that still exist today) and leaving out trading costs. All numbers come from one simulated run with assumed numbers (seed 20, daily returns with zero average and a 1% daily swing). No real market data, no strategy recommendation. Education only, not financial advice. #quantitativefinance #quant #backtesting #finance #trading

QuantFinanceToGo

35,300 görüntüleme • 1 ay önce