"Basic Statistical Arbitrage: Understanding the Math Behind Pairs Trading" by Max Margenot

Поделиться
HTML-код
  • Опубликовано: 22 янв 2025

Комментарии • 140

  • @idugi
    @idugi 5 лет назад +140

    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!

    • @k.butler8740
      @k.butler8740 4 года назад +10

      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.

  • @pozloadescobar
    @pozloadescobar 2 года назад +15

    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

  • @PurohitAnkit
    @PurohitAnkit 2 года назад +6

    Hi Max. Thank you for providing us with your lecture. It is really insightful 🙂

  • @Gavinnnnnnnnnnnnnnn
    @Gavinnnnnnnnnnnnnnn 5 лет назад +269

    that guy in the front is on the first peak of the dunning-kruger effect

    • @TheCheukhin
      @TheCheukhin 5 лет назад +5

      yeh. how can he be hired?? Probably, he has a really good track record.

    • @Hahmzuh
      @Hahmzuh 4 года назад +9

      @Nora Wilson scam spammed across many places by fake account

    • @jeevajeeva2481
      @jeevajeeva2481 4 года назад +2

      @@Hahmzuh yes in every trading video they are commenting

    • @samuelhossain3267
      @samuelhossain3267 4 года назад +5

      aren't we all

    • @rahulchembakasseril5876
      @rahulchembakasseril5876 3 года назад

      Mount Stupid

  • @uwu1337
    @uwu1337 3 года назад +26

    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.

  • @mvterra6
    @mvterra6 2 года назад +6

    Hi! Around 36:10 you say that you would buy 1 unit for each stock, wouldn't it be 1:1.5?

  • @lucasplacides2007
    @lucasplacides2007 4 года назад +5

    Does someone know the models he cites at 44:43? Can't really get the names based on his speech.

    • @michaelmorrison3614
      @michaelmorrison3614 4 года назад +7

      He mentions Ornstein-Uhlenbeck processes and Kalman Filters

    • @lucasplacides2007
      @lucasplacides2007 4 года назад

      @@michaelmorrison3614 thanks man! but what it's the other thing he mentions? common felters? common filters? hahah

    • @michaelmorrison3614
      @michaelmorrison3614 4 года назад +4

      @@lucasplacides2007 No problem, I edited my reply and added the other one, which is a Kalman Filter.

    • @Eigus-BikeCo
      @Eigus-BikeCo 3 года назад

      @@michaelmorrison3614 Thanks man, was wondering the same

  • @selmagray61
    @selmagray61 4 года назад +31

    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.

    • @sjhughes0313
      @sjhughes0313 3 года назад +4

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

    • @selmagray61
      @selmagray61 3 года назад +2

      @@sjhughes0313 Samuel, sorry just saw your reply. Above my pay grade with the math. Hope all is well.

    • @fattiger5953
      @fattiger5953 3 года назад +1

      @@sjhughes0313 I agree, cointegration on log returns doesn't really make sense.

  • @babatundeakeredolu8187
    @babatundeakeredolu8187 2 года назад +3

    Please can we have access to the notebook used for this lecture?

  • @kevinkim1778
    @kevinkim1778 4 года назад +65

    16:20. BRUH you need to understand random variables before you come here...

    • @vitusstockholm4984
      @vitusstockholm4984 2 месяца назад

      its all explained in screen presentation as technical documentation in those statistical models, i came from hmm hidden markovs patterns and it solved big problems

    • @kirkstable
      @kirkstable 25 дней назад +1

      I’ve been doing this in my head for decades and don’t know a lot of these words.. 😂

  • @yousef-4334
    @yousef-4334 4 года назад +21

    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.

    • @bigclout0056
      @bigclout0056 3 месяца назад +1

      No you’re right. Pairs trading relies on the cointegration (I.e.: the long run relationship) between the prices of two assets, not their returns. It would be univestible if done on returns

  • @wisemintapp
    @wisemintapp 2 дня назад

    Been in the middle of arb trading for three decades. At the end of the day never forget the old adage - "The market can be irrational longer than you can remain solvent"

  • @Juanitoto
    @Juanitoto 4 года назад +8

    the dude in the front has cemented in his brain GBM GOVERNS stock prices instead of it being a model.

  • @amriksingh5003
    @amriksingh5003 2 года назад

    Hi what is that balance( Traju) symbol on trading view chart

  • @felipemiraflores2984
    @felipemiraflores2984 7 месяцев назад

    Amazing job Max, loved it!

  • @Vishwanthkandibanda
    @Vishwanthkandibanda Год назад +5

    it would be better if he share that Jupyter notes

  • @arnold-pdev
    @arnold-pdev 20 дней назад

    It was a good introductory lecture, but I didn't get all that much insight into the strategies of statistical arbitrage.

  • @jakobullmann7586
    @jakobullmann7586 5 лет назад +126

    Omg... don’t bother about quant trading if you don’t know what a p value is!

    • @hanst7218
      @hanst7218 4 года назад +1

      Haha

    • @zam2050
      @zam2050 Год назад +11

      Whats a p value

    • @AV24274
      @AV24274 9 месяцев назад

      @@zam2050mines 7 inches

    • @paulnyagini
      @paulnyagini 7 месяцев назад +12

      There is a difference of knowing and understanding.

    • @hkaniugu
      @hkaniugu 6 месяцев назад

      Lol😂

  • @joshuadawson4952
    @joshuadawson4952 6 лет назад +7

    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.

    • @Quantopianvideos
      @Quantopianvideos  6 лет назад +1

      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.

    • @joshuadawson4952
      @joshuadawson4952 6 лет назад +2

      @@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

    • @Quantopianvideos
      @Quantopianvideos  6 лет назад +2

      ​@@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: ruclips.net/video/fzzdhw7lm8A/видео.html.

    • @ck88777
      @ck88777 3 года назад +6

      dont code, stay away from trading, and get a normal job

    • @copicmarker1021
      @copicmarker1021 2 месяца назад

      @@ck88777 why?

  • @rahuljuliofernandes222
    @rahuljuliofernandes222 5 лет назад +3

    I'm starting writing my algos in 2019 does quantopian yet work?

    • @davidl.e5203
      @davidl.e5203 2 года назад +2

      They've closed in 2020. I believe their team now works for Robinhood

  • @Mrslykid1992
    @Mrslykid1992 5 лет назад +11

    Does Quantopian have any books that are recommend to learn quantitative finance field?

  • @carsondoesdata
    @carsondoesdata 25 дней назад

    Granger causality would be a great subject to incorporate into these lectures

  • @navketan1965
    @navketan1965 Год назад +1

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

    • @paulnyagini
      @paulnyagini 7 месяцев назад +4

      😂😂😂😂😂 stop making me laugh.

  • @xh3992
    @xh3992 5 лет назад +29

    please pick up basic stats concept before asking any questions

  • @stillbeatz
    @stillbeatz 24 дня назад

    As someone who has very limited statistics knowledge…
    To me, it looks like when you integrate from order 0 up until order “n”, it’s almost like moving from a 1 second chart, up the ladder until eventually max time chart 🧐

    • @adityagarg190
      @adityagarg190 7 дней назад +1

      Yeah thats actually a pretty clever way of looking at it. A daily return is just the cumulative sum of the movements during that particular day.

  • @carlosfierro3302
    @carlosfierro3302 Месяц назад

    Interest piqued, but how relevant is this still?

  • @nikolai228
    @nikolai228 3 года назад +16

    16:27 cringe

  • @satyrn6047
    @satyrn6047 3 года назад +2

    like non-stationary, just picture the probability density over time as a surface.

    • @satyrn6047
      @satyrn6047 3 года назад

      like you can just use MAP estimation of parametric density function. then just split it up by spectrum.

    • @jeremyjohnson7537
      @jeremyjohnson7537 Год назад

      Can ou explain this in a better way?

  • @jdavis85
    @jdavis85 3 года назад +16

    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.

  • @ceekay5262
    @ceekay5262 2 года назад +1

    Very informative. Thanks

  • @vansolo9794
    @vansolo9794 5 лет назад +30

    That guy in the front row sticks his hand up after every question!

    • @jinxy7869
      @jinxy7869 3 года назад

      Because he knows stuff? Not everyone in the crowd is dumb as a potato.

  • @bigclout0056
    @bigclout0056 3 месяца назад +1

    16:22 this is thinking about “randomness” in the wrong way. He’s thinking of “random”/“probabilistic” as a fixed point (i.e.: the uniform distribution) and “deterministic” as a spectrum. Anything that isn’t the uniform distribution, in this world view, is some degree of deterministic. In reality it’s the opposite. Entropy works the same way

  • @k.butler8740
    @k.butler8740 4 года назад +19

    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.

    • @whoislewys3546
      @whoislewys3546 3 года назад +14

      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

    • @testchannel4695
      @testchannel4695 3 года назад +2

      @@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

    • @wardm4
      @wardm4 2 года назад +6

      @@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%.

    • @adaelasm6467
      @adaelasm6467 2 года назад +2

      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.

    • @PowerALTube
      @PowerALTube Год назад +2

      @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...

  • @PotatoMan1491
    @PotatoMan1491 3 года назад +1

    I like your stuff, especially when I am not much of an expert in statistic

  • @kylemusser7720
    @kylemusser7720 5 лет назад +7

    11:34 its a t-stat not a p-value

    • @Donvito293
      @Donvito293 4 года назад +5

      www.statsmodels.org/dev/generated/statsmodels.tsa.stattools.adfuller.html not true

  • @cgu3677
    @cgu3677 2 месяца назад +1

    just a few short years after this video released, quantopian website and seemingly the whole company vanishes

  • @borhenbouaziz1879
    @borhenbouaziz1879 4 дня назад

    An academic example that is useful for understanding the key concept, but a bit misleading as too simplistic for any of that to work in real world.

  • @MaungRuelas
    @MaungRuelas 4 месяца назад

    You make wonderful videos! 👏 I wanted to ask something unrelated: 🤔 I found these words 😅. (behave today finger ski upon boy assault summer exhaust beauty stereo over). Not sure how to use them, would appreciate help. 🙏

  • @cusodha1
    @cusodha1 4 года назад +11

    I don't know why but I always found drinking something during the presentation a bit strange.

    • @FelipeRuedaH
      @FelipeRuedaH 4 года назад +7

      Throat can get really dry. But drinking coke?

    • @danielheckel2755
      @danielheckel2755 4 года назад +20

      Maybe he has a long position, just like Buffett.

  • @hanst7218
    @hanst7218 4 года назад +8

    39:05 Transaction costs will be huge.

  • @chandershekhar1076
    @chandershekhar1076 5 лет назад +1

    thank you

  • @GF86123
    @GF86123 Год назад

    This guy is genius.

  • @bmebri1
    @bmebri1 2 года назад +3

    There's always a guy near the front of a presentation that questions your knowledge.

  • @carlosdesantiago1356
    @carlosdesantiago1356 4 года назад +11

    17:35 - 17:45 *drops mic* *sips coke*

    • @xelhaku
      @xelhaku 2 года назад +1

      Someone lowered the volume, that's a shame it makes this video non stationary

  • @selmagray61
    @selmagray61 4 года назад +1

    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.

    • @k.butler8740
      @k.butler8740 4 года назад

      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.

    • @selmagray61
      @selmagray61 3 года назад

      @@k.butler8740 Kyle your a beast.

    • @k.butler8740
      @k.butler8740 3 года назад

      @@selmagray61 to a rollie pollie, so is the butterfly

    • @selmagray61
      @selmagray61 3 года назад

      @@k.butler8740 I take issue, am I the rollie pollie in this metaphor?

    • @k.butler8740
      @k.butler8740 3 года назад

      @@selmagray61 idk, but from most perspectives I'm not a beast ;)

  • @michaeljagdharry
    @michaeljagdharry 24 дня назад

    We as a society need to come up with a solution to academic hecklers

  • @petrovsimon
    @petrovsimon 5 лет назад +36

    "That was bait"... Zero laughs

  • @juliaalonzo5998
    @juliaalonzo5998 5 лет назад +10

    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!!!!

    • @k.butler8740
      @k.butler8740 4 года назад +2

      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

  • @soykanilhan8349
    @soykanilhan8349 2 года назад

    Can you add Turkish subtitles please

  • @johnvargas761
    @johnvargas761 24 дня назад

    I have no idea what this guy is saying

  • @TheFadime123
    @TheFadime123 5 лет назад +1

    a lot of inaccuracies with what he is saying.

  • @BV-pn5nd
    @BV-pn5nd 17 дней назад

    THIS IS THE DEFINITION OF MAKING TRADING IMPOSSIBLE AND DIFFICULT TO UNDERSTAND.😀😃

  • @christophercatchings162
    @christophercatchings162 4 года назад +1

    Slides, Beautiful Slides.

  • @lancemartin1836
    @lancemartin1836 3 года назад +1

    Great video, but the guy in the front row is so insufferable

  • @DrFractal123
    @DrFractal123 Месяц назад +1

    Quantopian has closed its doors a few years ago’

  • @watchizee7246
    @watchizee7246 11 месяцев назад

    He sounds exactly like Philip Gallagher.

  • @avinashdwivedi2015
    @avinashdwivedi2015 4 года назад

    Guy at the front have seen it all

  • @mihairusu6734
    @mihairusu6734 Месяц назад

    Market is driven by fear and greed, algos just follow the crowd, no algo made money consistently

  • @Ne3zyTV
    @Ne3zyTV 5 лет назад +10

    I understood about 20% lol interesting still

    • @gornostai4ik_lol
      @gornostai4ik_lol 5 лет назад +3

      really common for the first time.
      you will understand 100% of that after a few months watching that theme in non-stop :)

    • @ashleywatkins-clark1115
      @ashleywatkins-clark1115 5 лет назад +1

      me, 2% & best thing I watched all year.

    • @Cloxxki
      @Cloxxki 5 лет назад +1

      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.

  • @maddiehad
    @maddiehad Год назад +1

    lmao nothing is random. good talk btw.

  • @РодионЧаускин
    @РодионЧаускин 3 месяца назад

    Thomas Patricia Garcia Charles White Ronald

  • @jacobsb374
    @jacobsb374 3 года назад +1

    I didn't understand shit. I wish i was brighter.

    • @herikaniugu
      @herikaniugu Год назад

      Watch again and again, thats how we all do

    • @hbbhbhh
      @hbbhbhh Месяц назад

      Lol can you learn swimming by watch someone else swimming?

  • @MrMikomi
    @MrMikomi 24 дня назад

    This is all naive statistical mumbo jumbo. It's predicated on the idea that two instruments are related in a non changing way. But this is so naïve it's comical. If it were true the arbitrage opportunity would never exist in the first place.

    • @fiddlepants5947
      @fiddlepants5947 23 дня назад

      Damn right 😂 What do you reckon is the real scam then?

  • @jtm7776
    @jtm7776 3 года назад

    Dude was drinking the same coke the whole time

  • @caleb7799
    @caleb7799 Месяц назад

    and they say nobody will remember when you fucked up during your speech because they are more worried about themselves. haha bullhicky! just look at the comments!

  • @toaninh9120
    @toaninh9120 Год назад

    I'm sure this is pretty redundant rn but man Quantopian closing left a hole in my soul 🥲

  • @strawbryminiwheats
    @strawbryminiwheats Год назад

    thank you