Incredibly well said for a topic that can easily drown a laymen of statistics in its mathematical foundations. This will save many aspiring quants a lot of time in their algo developments , if they take the time to check their assumptions regarding stationarity. Oh what a world we now live in, where such information is offered free to the average investor. Thanks!
You need not only stationarity but also ergodicity for any sort of such forecasting. Max says that it's better to make many small denomination bets at a given set of odds (51% in this video) then one large denomination bet on the same set of odds. This is not true per se -- their outcomes have the same expected value because of the linearity of expectations. The reason why you want to make many small denom bets over the one large on the same odds is because of ergodicity: it is only the basket of pairs that you can make the ergodicity assumption about, not any single pair. What Max fails to note in this lecture is that it is the evolving basket of pairs or portfolio of pairs that themselves constitute a single emergent stationary and ergodic system.
Good job Max. That was a great intro to pairs trading, particularly for folks with a few stats and time series classes. Max has a good sense of what stuff is OK to skip
At first I thought this was a bunch of useless maths, but when I got to the actual trading part I was pretty amazed how clever all of this actually applied in practice.
I do not understand why he is admitting that he is making a mistake. because he is not making one. The pair trading requires the slope beta extracted from regression between the prices (NOT returns). The parameter beta used in CAPM, on the other hand, uses returns(NOT prices). Quantopian please correct me if I am wrong.
Max is a bright kid and no longer at Quantopian. Jump to 40:28 where he self-effacingly admits that example is flawed..and that enhancing/correcting the lecture is on his todo list. Still worthwhile at seeing whats 'canned' at Q. Good luck.
Hm, but I think he corrects himself with another conceptual mistake. He says he should take the returns of each stock, then take the log of those returns, then find the linear combination, etc.. But I think he wants to be using log of the prices, in order to benefit from the log returns (log returns being different from log of the returns). So for him to properly get log returns, he'd be working with log of the prices, since log returns = log(1 + returns) = log(price 1) - log(price 2). Which mean he should be looking for some linear combination of log(price of stock 1) and log(price of stock 2). The way he describes it, he'd be looking for some linear combination of log(returns of stock 1) and log(returns of stock 2), which is incorrect. I think anyway..
Sir, In forex pairs SPREAD TRADING do you recommend use of CCI (say on 4H chart--cci 7,cci 14, cci30,cci50 values & add all these values on each pairs to spread & compare overpriced/underpriced leg).The pairs got to have correlations of at least 90%(say aud/usd &nzd/usd--aud/jpy &nzd/jpy--eur/jpy & gbp/jpy--gbp/aud & gbp/nzd etc.).Sell the overpriced & buy underpriced. This would give trader starting edge, staying power, size choice & risk control. You would be comparing deflection of prices summed up on multiple time frames(added up/robust) for asset A & B. Your wisdom is appreciated..
I have been writing code in python for about 7 months. I am still struggling to write in the IDE, any suggestions on how to get better at this? Would working through the zipline documentation help with this? I cannot get Zipline to run in Jupyter bc of the RLock . Any suggestions on how to fix this. On a personal note you do an awesome job man.
Hi Joshua, Are you trying to use Zipline locally on your own computer? If so, it will be much easier to use Quantopian's online platform while learning the basics. Acquiring data, processing it into the right format, ingesting it, and getting useful output from your backtests is quite difficult. The best place to learn about the Quantopian platform is the tutorials. Specifically, the Getting Started and Pipeline Tutorials are designed to help people get started. They can be found at www.quantopian.com/tutorials.
@@Quantopianvideos Thank you for that suggestion and I will start doing that. I really wish there was more tutorials on the IDE itself, not being negative I freaking love quantopian!!! I wish I had found it sooner. Thank you for doing what you do over there
@@joshuadawson4952 Thank you for the suggestion. We are working on providing a tutorial for the IDE and can let you know when it's ready. In the meantime, we do have an "Understanding the Algorithm API Tutorial" video that might give you a better understanding of how to use the various features that can be found on Quantopian: czcams.com/video/fzzdhw7lm8A/video.html.
While most of his flubs are not worth correcting as he understands a lot that he fails to communicate, but I think it's valuable to point out Max's misunderstanding of ergodicity. You need not only stationarity but also ergodicity for any sort of such forecasting. Max says that it's better to make many small denomination bets at a given set of odds (51% in this video) then one large denomination bet on the same set of odds. This is not true per se -- their outcomes have the same expected value because of the linearity of expectations. The reason why you want to make many small denom bets over the one large on the same odds is because of ergodicity: it is only the basket of pairs that you can make the ergodicity assumption about, not any single pair. What Max fails to note in this lecture is that it is the evolving basket of pairs or portfolio of pairs that themselves constitute a single emergent stationary and ergodic system. Otherwise you're making the textbook gamblers fallacy lol. Also, a stationary distribution is noise, not white noise. White noise is sampling of a normal distribution and the others we call colored noise, the most common of which is pink noise. We call normal noise white because its uniform in the frequency domain.
I'd just like to say I found this comment 6 months when I started learning algo trading, understood 10% of it, decided you deeply know your shit, and that if I could understand what you said here I have a chance of making it in the markets Took a several month long break, been studying hard again past couple of weeks, and now fully understand this comment So thanks for the butterfly wing flap homie
@@whoislewys3546 I will do the same, I'm just starting out, but I will get back in 6 months to see if it makes more sense. For now, the comment just sounds cool
@@testchannel4695 I wouldn't bother. The comment is mostly nonsense. Max isn't making the Gambler's fallacy. It's exactly the opposite. Ergodicity isn't needed here (and it has very little to do with expected value). It's just the law of large numbers. If you truly have 51% odds, then you can only see this by taking 1000's of bets. The fewer bets you make, the more variance will play a role in seeing your realized value being off from that 51%.
I don't think his 51% comment is about ergodicity at all. It's just basic risk management. Expected value is not the only thing that matters when deciding on capital allocation.
@testchannel4695 yeah this comment is just utter dross masquerading as something more intelligent. Max's video is fine. Understanding that variance is additive for independent events is all that is required to decide that placing lots of small, independent bets is a good idea. No need to invoke all this ergodicity cringe...
The guy in front is so disruptive. Aggressively asking questions when he doesn't know what a p value is??? You'd think he'd have some sense of shame after that.
I'll all a bit theoretical and focusing on small bit to claw some profits from. Seems there are way easier ways to trade pairs and I've tested them to beabout as good as a leverage bet that you got right, long term. But without actual leveraged exposure, even without actual shorting. Just a partial re-distributing value after one asset has risen relative to the other. When you return to the mean, you are holding more units and thus more total portfolio value. It's hard to find volatile assets that cannot be easily exploited for this strategy. The hard part is to be into them only when they drop slower in value than you can milk them. With cryptos, the whole ride down to a fraction of peak values allowed to accumulate many X units. If they ever do run up ioin price somewhat, profits will be staggering. There are crazy efficient ways to exploit price fluctuations. I'm working on a strategy that get me off the job market.
I think I'm missing something here. I feel like he's speaking japanese. I need to learn basic statistics. I feel that speaker is very smart, but he doesn't know his audience!!!!
he miss-states basics on many things so you can't take him literally -- lol yeah you do need the basics to be able to wade through his miss-statements and get the gist
52:12 also seems very telling if you are trying to submit at minimum a pairs trades. If you don't use co-integration versus correlation or covariance in a time series...your assumptions are mute. Max makes a punishing point about the inferences drawn from correlation & covariance as oppose to co-integration. Only a propeller head can make a joke about Kalman filters "being a rich mans moving average", pretty humorous.
I, too, was a little offset by that at first, but you missed his point. All he's discussing regarding forecasting techniques is their utilization to synthesize stationary (and, via sublation, although this is beyond Max, ergodic) assets and then betting on the model having a smaller error term in the next few measurements then it is at a given measurement. In other words, we're betting on model error terms satisfying a limiting stationary distribution (which is kosher via CLT), that which we reductionistly call mean reversion, and therefore the model itself is only relevent inasmuch as it can synthesize a stationary and ergodic error distribution. You're much better off using some obscure and incorrect model as long as its error distribution converges to a stationary distribution as your pairs basket will be unique -- you can easily use a genetic algorithym to create a ton of examples and then back test them and loh and behold you'll get your own unique arb basis model. If you have the capital you take a bunch of these and use functional analysis/distribution theory to sublate your synthetic assets into a new even more forecastable asset.
Incredibly well said for a topic that can easily drown a laymen of statistics in its mathematical foundations. This will save many aspiring quants a lot of time in their algo developments , if they take the time to check their assumptions regarding stationarity. Oh what a world we now live in, where such information is offered free to the average investor. Thanks!
You need not only stationarity but also ergodicity for any sort of such forecasting. Max says that it's better to make many small denomination bets at a given set of odds (51% in this video) then one large denomination bet on the same set of odds. This is not true per se -- their outcomes have the same expected value because of the linearity of expectations. The reason why you want to make many small denom bets over the one large on the same odds is because of ergodicity: it is only the basket of pairs that you can make the ergodicity assumption about, not any single pair. What Max fails to note in this lecture is that it is the evolving basket of pairs or portfolio of pairs that themselves constitute a single emergent stationary and ergodic system.
that guy in the front is on the first peak of the dunning-kruger effect
yeh. how can he be hired?? Probably, he has a really good track record.
@Nora Wilson scam spammed across many places by fake account
@@Hahmzuh yes in every trading video they are commenting
aren't we all
Mount Stupid
16:20. BRUH you need to understand random variables before you come here...
Good job Max. That was a great intro to pairs trading, particularly for folks with a few stats and time series classes. Max has a good sense of what stuff is OK to skip
At first I thought this was a bunch of useless maths, but when I got to the actual trading part I was pretty amazed how clever all of this actually applied in practice.
I do not understand why he is admitting that he is making a mistake. because he is not making one. The pair trading requires the slope beta extracted from regression between the prices (NOT returns). The parameter beta used in CAPM, on the other hand, uses returns(NOT prices). Quantopian please correct me if I am wrong.
Hi Max. Thank you for providing us with your lecture. It is really insightful 🙂
the dude in the front has cemented in his brain GBM GOVERNS stock prices instead of it being a model.
Omg... don’t bother about quant trading if you don’t know what a p value is!
Haha
Whats a p value
@@zam2050mines 7 inches
There is a difference of knowing and understanding.
Lol😂
Max is a bright kid and no longer at Quantopian. Jump to 40:28 where he self-effacingly admits that example is flawed..and that enhancing/correcting the lecture is on his todo list.
Still worthwhile at seeing whats 'canned' at Q. Good luck.
Hm, but I think he corrects himself with another conceptual mistake. He says he should take the returns of each stock, then take the log of those returns, then find the linear combination, etc.. But I think he wants to be using log of the prices, in order to benefit from the log returns (log returns being different from log of the returns).
So for him to properly get log returns, he'd be working with log of the prices, since log returns = log(1 + returns) = log(price 1) - log(price 2).
Which mean he should be looking for some linear combination of log(price of stock 1) and log(price of stock 2). The way he describes it, he'd be looking for some linear combination of log(returns of stock 1) and log(returns of stock 2), which is incorrect.
I think anyway..
@@sjhughes0313 Samuel, sorry just saw your reply. Above my pay grade with the math. Hope all is well.
@@sjhughes0313 I agree, cointegration on log returns doesn't really make sense.
Amazing job Max, loved it!
Hi! Around 36:10 you say that you would buy 1 unit for each stock, wouldn't it be 1:1.5?
yes
Sir, In forex pairs SPREAD TRADING do you recommend use of CCI (say on 4H chart--cci 7,cci 14, cci30,cci50 values & add all these values on each pairs to spread & compare overpriced/underpriced leg).The pairs got to have correlations of at least 90%(say aud/usd &nzd/usd--aud/jpy &nzd/jpy--eur/jpy & gbp/jpy--gbp/aud & gbp/nzd etc.).Sell the overpriced & buy underpriced. This would give trader starting edge, staying power, size choice & risk control. You would be comparing deflection of prices summed up on multiple time frames(added up/robust) for asset A & B. Your wisdom is appreciated..
😂😂😂😂😂 stop making me laugh.
That guy in the front row sticks his hand up after every question!
Because he knows stuff? Not everyone in the crowd is dumb as a potato.
it would be better if he share that Jupyter notes
please pick up basic stats concept before asking any questions
Does someone know the models he cites at 44:43? Can't really get the names based on his speech.
He mentions Ornstein-Uhlenbeck processes and Kalman Filters
@@michaelmorrison3614 thanks man! but what it's the other thing he mentions? common felters? common filters? hahah
@@lucasplacides2007 No problem, I edited my reply and added the other one, which is a Kalman Filter.
@@michaelmorrison3614 Thanks man, was wondering the same
Please can we have access to the notebook used for this lecture?
Does Quantopian have any books that are recommend to learn quantitative finance field?
16:27 cringe
Very informative. Thanks
like non-stationary, just picture the probability density over time as a surface.
like you can just use MAP estimation of parametric density function. then just split it up by spectrum.
Can ou explain this in a better way?
Hi what is that balance( Traju) symbol on trading view chart
I'm starting writing my algos in 2019 does quantopian yet work?
They've closed in 2020. I believe their team now works for Robinhood
I have been writing code in python for about 7 months. I am still struggling to write in the IDE, any suggestions on how to get better at this? Would working through the zipline documentation help with this? I cannot get Zipline to run in Jupyter bc of the RLock . Any suggestions on how to fix this. On a personal note you do an awesome job man.
Hi Joshua,
Are you trying to use Zipline locally on your own computer? If so, it will be much easier to use Quantopian's online platform while learning the basics. Acquiring data, processing it into the right format, ingesting it, and getting useful output from your backtests is quite difficult.
The best place to learn about the Quantopian platform is the tutorials. Specifically, the Getting Started and Pipeline Tutorials are designed to help people get started. They can be found at www.quantopian.com/tutorials.
@@Quantopianvideos Thank you for that suggestion and I will start doing that. I really wish there was more tutorials on the IDE itself, not being negative I freaking love quantopian!!! I wish I had found it sooner. Thank you for doing what you do over there
@@joshuadawson4952 Thank you for the suggestion. We are working on providing a tutorial for the IDE and can let you know when it's ready. In the meantime, we do have an "Understanding the Algorithm API Tutorial" video that might give you a better understanding of how to use the various features that can be found on Quantopian: czcams.com/video/fzzdhw7lm8A/video.html.
dont code, stay away from trading, and get a normal job
I like your stuff, especially when I am not much of an expert in statistic
I don't know why but I always found drinking something during the presentation a bit strange.
Throat can get really dry. But drinking coke?
Maybe he has a long position, just like Buffett.
This guy is genius.
thank you
There's always a guy near the front of a presentation that questions your knowledge.
17:35 - 17:45 *drops mic* *sips coke*
Someone lowered the volume, that's a shame it makes this video non stationary
While most of his flubs are not worth correcting as he understands a lot that he fails to communicate, but I think it's valuable to point out Max's misunderstanding of ergodicity. You need not only stationarity but also ergodicity for any sort of such forecasting. Max says that it's better to make many small denomination bets at a given set of odds (51% in this video) then one large denomination bet on the same set of odds. This is not true per se -- their outcomes have the same expected value because of the linearity of expectations. The reason why you want to make many small denom bets over the one large on the same odds is because of ergodicity: it is only the basket of pairs that you can make the ergodicity assumption about, not any single pair. What Max fails to note in this lecture is that it is the evolving basket of pairs or portfolio of pairs that themselves constitute a single emergent stationary and ergodic system. Otherwise you're making the textbook gamblers fallacy lol. Also, a stationary distribution is noise, not white noise. White noise is sampling of a normal distribution and the others we call colored noise, the most common of which is pink noise. We call normal noise white because its uniform in the frequency domain.
I'd just like to say I found this comment 6 months when I started learning algo trading, understood 10% of it, decided you deeply know your shit, and that if I could understand what you said here I have a chance of making it in the markets
Took a several month long break, been studying hard again past couple of weeks, and now fully understand this comment
So thanks for the butterfly wing flap homie
@@whoislewys3546 I will do the same, I'm just starting out, but I will get back in 6 months to see if it makes more sense. For now, the comment just sounds cool
@@testchannel4695 I wouldn't bother. The comment is mostly nonsense. Max isn't making the Gambler's fallacy. It's exactly the opposite. Ergodicity isn't needed here (and it has very little to do with expected value). It's just the law of large numbers. If you truly have 51% odds, then you can only see this by taking 1000's of bets. The fewer bets you make, the more variance will play a role in seeing your realized value being off from that 51%.
I don't think his 51% comment is about ergodicity at all. It's just basic risk management. Expected value is not the only thing that matters when deciding on capital allocation.
@testchannel4695 yeah this comment is just utter dross masquerading as something more intelligent. Max's video is fine. Understanding that variance is additive for independent events is all that is required to decide that placing lots of small, independent bets is a good idea. No need to invoke all this ergodicity cringe...
39:05 Transaction costs will be huge.
The guy in front is so disruptive. Aggressively asking questions when he doesn't know what a p value is??? You'd think he'd have some sense of shame after that.
so true
Slides, Beautiful Slides.
Guy at the front have seen it all
He sounds exactly like Philip Gallagher.
"That was bait"... Zero laughs
11:34 its a t-stat not a p-value
www.statsmodels.org/dev/generated/statsmodels.tsa.stattools.adfuller.html not true
I understood about 20% lol interesting still
really common for the first time.
you will understand 100% of that after a few months watching that theme in non-stop :)
me, 2% & best thing I watched all year.
I'll all a bit theoretical and focusing on small bit to claw some profits from. Seems there are way easier ways to trade pairs and I've tested them to beabout as good as a leverage bet that you got right, long term. But without actual leveraged exposure, even without actual shorting. Just a partial re-distributing value after one asset has risen relative to the other. When you return to the mean, you are holding more units and thus more total portfolio value. It's hard to find volatile assets that cannot be easily exploited for this strategy. The hard part is to be into them only when they drop slower in value than you can milk them. With cryptos, the whole ride down to a fraction of peak values allowed to accumulate many X units. If they ever do run up ioin price somewhat, profits will be staggering. There are crazy efficient ways to exploit price fluctuations. I'm working on a strategy that get me off the job market.
Can you add Turkish subtitles please
lmao nothing is random. good talk btw.
Great video, but the guy in the front row is so insufferable
a lot of inaccuracies with what he is saying.
I didn't understand shit. I wish i was brighter.
Watch again and again, thats how we all do
I think I'm missing something here. I feel like he's speaking japanese. I need to learn basic statistics. I feel that speaker is very smart, but he doesn't know his audience!!!!
he miss-states basics on many things so you can't take him literally -- lol yeah you do need the basics to be able to wade through his miss-statements and get the gist
Dude was drinking the same coke the whole time
52:12 also seems very telling if you are trying to submit at minimum a pairs trades.
If you don't use co-integration versus correlation or covariance in a time series...your assumptions are mute.
Max makes a punishing point about the inferences drawn from correlation & covariance as oppose to co-integration.
Only a propeller head can make a joke about Kalman filters "being a rich mans moving average", pretty humorous.
I, too, was a little offset by that at first, but you missed his point. All he's discussing regarding forecasting techniques is their utilization to synthesize stationary (and, via sublation, although this is beyond Max, ergodic) assets and then betting on the model having a smaller error term in the next few measurements then it is at a given measurement. In other words, we're betting on model error terms satisfying a limiting stationary distribution (which is kosher via CLT), that which we reductionistly call mean reversion, and therefore the model itself is only relevent inasmuch as it can synthesize a stationary and ergodic error distribution. You're much better off using some obscure and incorrect model as long as its error distribution converges to a stationary distribution as your pairs basket will be unique -- you can easily use a genetic algorithym to create a ton of examples and then back test them and loh and behold you'll get your own unique arb basis model. If you have the capital you take a bunch of these and use functional analysis/distribution theory to sublate your synthetic assets into a new even more forecastable asset.
@@k.butler8740 Kyle your a beast.
@@selmagray61 to a rollie pollie, so is the butterfly
@@k.butler8740 I take issue, am I the rollie pollie in this metaphor?
@@selmagray61 idk, but from most perspectives I'm not a beast ;)
I'm sure this is pretty redundant rn but man Quantopian closing left a hole in my soul 🥲
thank you