正在加载视频...

视频加载失败

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

0 条评论

暂无评论

原始帖子的评论将显示在这里

相关视频

➡️ Quantitative Finance from Scratch, part 47: What does a market maker actually do? A market maker is a trading firm that always provides two prices for a stock: the ask (higher, what you pay when you buy) and the bid (lower, what you get when you sell). When you trade as a retail investor, the other side is usually a market maker. It stands in the middle, so someone is always there to trade with you. This is called providing liquidity. In return, it earns the spread (spread = ask − bid). Buy at 99.98 dollars, sell at 100.02 dollars, and it earns four cents per share. That sounds tiny, but it repeats all day across many stocks. The job comes with two big risks. Inventory: when many people sell at once, the market maker ends up holding a lot of stock, and if the price then falls, it loses money (P&L = cash + inventory × fair price). Informed traders: someone who hears news first sells to the market maker right before the price drops. A good market maker adjusts its two prices all day, moving them with its inventory and widening the gap when the risk grows. On many exchanges, official market makers promise to quote within a maximum spread and pay lower fees in return. The code (mm_reel.py, 16 lines of plain Python without packages) is general on purpose: two quotes around a mid price, what happens when a customer buys or sells, the profit and loss, and a quote shifted with the inventory. If you want to go deeper, check out the full course I built: quantfinancetogo.com #quantfinance #marketmaking #marketmaker #finance #python Education only, not financial advice.

QuantFinanceToGo

32,200 次观看 • 4 天前

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

14,400 次观看 • 3 天前

➡️ 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,400 次观看 • 1 个月前

➡️ 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 次观看 • 7 天前

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

107,800 次观看 • 17 天前

➡️ 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 次观看 • 1 个月前

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

113,800 次观看 • 1 个月前

➡️ 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 次观看 • 15 天前

➡️ 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 次观看 • 1 个月前

➡️ 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 次观看 • 1 个月前

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

75,100 次观看 • 1 个月前

In 1991 a Stanford professor turned $120,000 into $7 million off two stocks that went nowhere, using nothing but their swings. Nobody on Wall Street wanted this getting out, and the math sat buried for 35 years. His name was Tom Cover, and in information theory he was royalty, he wrote the textbook the whole field still learns from. Then he did something no one asked for. He pointed Claude Shannon's math at the stock market. He took two forgettable stocks. On their own, over 20 years, one rose 4x and the other 8x, nothing special. But they jumped around hard, and out of sync. So he rebalanced them daily: trim the one that popped, add to the one that dropped. That pair returned over 70x. The gain never came from the companies. It came from the shaking. The rule behind it is one line: W* = max E[log bᵀX] Maximize the expected log of your wealth, not the average return. Average return says dump everything into the top stock. Log says spread and rebalance, because compounding runs on the geometric mean, and volatility becomes fuel instead of risk. Then Cover went further. He built a portfolio that keeps pace with the best rebalancing you could have picked with a year of hindsight, no forecasts, no model. It held through the crashes of 1929 and 1987. And the same constant that runs it shows up in file compression. To Cover, beating the market and zipping a song were the same problem. He never found a better stock. He found the money hiding in the fact that stocks move at all. Watch this 57-min lecture, the answer is in this video. Worth watching right now.

MindArch

62,963 次观看 • 2 个月前

➡️ 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 次观看 • 24 天前