正在加载视频...

视频加载失败

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

0 条评论

暂无评论

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

相关视频

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

➡️ 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 个月前

➡️ 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 个月前

➡️ Part 9 of learning ML code from scratch Six weights, one wrong answer, and not one of them knows it was at fault. Backpropagation is how they find out. Two questions guide the video: what even is backpropagation, and why do models need it? Step 1, the forward pass. Two numbers go into a tiny network, run through a hidden layer, and one number comes out. Ours says 0.700. We wanted 1.0, so square the difference and the loss is 0.09. That single number is how wrong the model is. Step 2, the question. Six weights produced that answer together. Which of them is to blame, and by how much? Step 3, the one idea. Change a single weight by a tiny amount and watch the error move. How much the error changes per unit of weight is the gradient of that weight. In the video you can see it happen: the weight wobbles and the error bar answers. Step 4, the shortcut. Every weight running into the same neuron starts from one shared number, the blame of that neuron. Multiply that blame by the value each weight carried and you have its gradient. One blame, computed once, and every weight into that neuron gets its own gradient from it. That is why backpropagation is fast enough to train anything at all. Step 5, backwards. The blame starts at the output and every layer hands its share to the layer in front of it, back through the same network the data came forward through. It goes layer by layer, and inside one layer every neuron is done together. Step 6, the update. The optimizer moves every weight against its own gradient, the whole weight matrix in one go, so no weight waits for its turn. All six gradients here are negative, so all six weights go up. After one step the answer reads 0.769. After sixty it reads 0.968 and the error is down to 0.001. The honest part: every gradient in the video was checked against the measured change of the error. Move that one weight, see what the error does, divide. Backprop and the measurement agree to nine decimal places, otherwise nothing would have rendered. #machinelearning #backpropagation #neuralnetworks #python #coding

MachineLearningToGo

210,600 次观看 • 1 个月前

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

Wall Street doesn't predict prices - it prices the randomness in them. That is where the billions are, and it runs on one equation. The model trading desks actually use is Geometric Brownian Motion: dS = μS·dt + σS·dW μ (drift) is the slow expected trend. σ·dW is the random shock - a coin flip scaled by volatility. It is the engine under Black-Scholes, the formula that prices trillions in options. The idea is 125 years old. Louis Bachelier modeled prices as a random walk in 1900 - five years before Einstein used the same math for particles. His verdict: "the mathematical expectation of the speculator is zero." Sixty years later Eugene Fama won a Nobel for the same finding: prices are "no more predictable than the path of a series of cumulated random numbers." And the math is brutal. Drift grows with time (t); noise grows only with its square root (√t). Over one day the shock buries the trend - so daily direction is a coin flip, and traders invent reasons after the candle prints. The trap hides in one assumption: that returns are "normal." Real markets have fat tails. Black Monday 1987 (-22.6% in a day) was a 20-sigma event under the bell curve - impossible in billions of years. Nassim Taleb calls that bell curve "the great intellectual fraud." The equation that prices everything is blind to the one day it matters most. the edge was never the trend inside the wiggle. it is knowing how much of the wiggle is nothing. the full quant build is in the article below.

Di Krass

256,741 次观看 • 2 个月前

➡️ 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 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 个月前

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

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

➡️ Machine Learning from Scratch, part 15: a recommender, the kind of algorithm that picks what your feed shows you. Our app is simulated: 300 people and 60 videos. Every person has a hidden taste, every video has a hidden style, and each person has watched only about 12 of the 60 videos. All the algorithm ever sees is who liked which of the videos they watched. How it learns: every person gets two numbers, and every video gets two numbers. Think of them as arrows on a map. For every video a person has seen, the two arrows turn into a chance of a like with the sigmoid from part 2. The algorithm compares that chance with what really happened and nudges both arrows a little. That is gradient descent from part 8, and the whole method is called matrix factorisation. The results, all measured on the videos nobody showed it: After 25 rounds it guesses 85.0% of the hidden likes right. After 3000 rounds it gets 87.8% right. The best any method could do here is 91.1%, because some likes are just random. For every person it recommends the three unseen videos with the strongest match, and 98% of them are videos the person really likes. A random unseen video gets a like 51% of the time. The first person on the list watched only 5 videos. From those five it guessed the other 55 and got 51 of them right. We ran the same program on 20 different simulated apps, and it always landed between 84 and 88%. Real apps use hundreds of numbers for every person and every video, plus signals like watch time and skips. The core idea stays the same: learn numbers for people and for videos, and match them. #machinelearning #ai #recommendersystem #python #coding

MachineLearningToGo

88,400 次观看 • 1 个月前

➡️ Machine Learning from Scratch, part 47: the Hopfield network. In 1982 the physicist John Hopfield described a network that works as a memory, and 42 years later this work was part of the Nobel Prize in Physics. Each neuron is one pixel that is either on or off, and every neuron is connected to every other neuron, so 100 pixels need 4,950 connections. There are no layers: signals go back and forth until the network settles. Each neuron takes a weighted sum of its inputs and switches on if the sum is positive, off if it is negative. Storing a picture is simple: for every pair of pixels with the same colour the connection gets stronger, otherwise weaker. Every stored picture becomes a valley in the energy landscape, and no switch can ever raise the energy, so a noisy picture rolls downhill into the nearest stored memory. The code (hopfield.py, 16 lines of numpy, pictures in pics.txt) stores three 10 x 10 pictures, a heart, a house and a smiley, and flips 30 of the 100 pixels in each. After a single pass over all neurons all three come back exactly; the energy of the heart falls from -6.90 to -48.90, the energy of the stored heart. With 100 neurons and random patterns (10 flipped pixels, 20 runs) it recalls 5 patterns every time, 10 patterns in 94.5 % of the cases, 14 in 68 %, 20 in about one in four (24 %) and 30 in 1 %. Honest notes: the weights are kept as whole numbers (100 times the Hebb weight), so a sum of exactly zero switches the neuron on, as the rule says. The landscape in the video is a picture of the idea; the valley floors and the height of the rolling ball are the real energies from the run. #machinelearning #ai #coding #neuralnetworks #nobelprize

MachineLearningToGo

12,000 次观看 • 14 天前