[1/3] Coding a multi-order type orderbook in C++ from scratch

Поділитися
Вставка
  • Опубліковано 29 чер 2024
  • Hey you. In part 1 of this 3 part series I code a multi-order type orderbook in C++ from scratch. I walk you through the code and explain my decisions and choices Hopefully you can learn a lot in these short 50 minutes. We'll test it and I'll answer questions live for you next week.
    Instagram: / thecodingjesus
    Calendly: calendly.com/coding-jesus
    Patreon: / codingjesus
    github.com/Tzadiko/Orderbook/...
    Keyboard: amzn.to/498f316
  • Наука та технологія

КОМЕНТАРІ • 83

  • @CodingJesus
    @CodingJesus  3 місяці тому +12

    1. Completed code available here: github.com/Tzadiko/Orderbook/blob/master/
    2. Remove the ampersand in auto& bid = bids.front(); in MatchTrades and the corresponding line below it. We will go over testing in the livestream.
    3. As an exercise, try and add a FillOrKill and GoodForDay ordertypes yourself. If the order can't be fully filled, you do nothing with it for FillOrKill. For GoodForDay pick an end-day time and prune all orders after that time that are marked GoodForDay. Will go over it in the livestream.

  • @s1nGh-
    @s1nGh- 3 місяці тому +55

    now this is what we need. thank you Mewing Jesus

    • @rightq3111
      @rightq3111 3 місяці тому +7

      😂🤣 bro is slowly morphing into a Based CS Chad

  • @Alpharabius99
    @Alpharabius99 3 місяці тому +27

    dude is a savage coding without dark mode

    • @tedchirvasiu
      @tedchirvasiu 3 місяці тому +13

      He is Jesus, he brings the Light.

    • @svenvanwier7196
      @svenvanwier7196 3 місяці тому

      @@tedchirvasiu I doubt he would call Jesus the 'messiah'

  • @tedchirvasiu
    @tedchirvasiu 3 місяці тому +10

    2:44 - that feeling when you pop your ears and all of a sudden you have super hearing

  • @tronaitor0
    @tronaitor0 3 місяці тому +1

    So happy to see you back! Outstanding content!!

  • @recursion.
    @recursion. 3 місяці тому +4

    Great setup Tomer. The keystroke and keyboard cam is greatly appreciated. Looking forward to your next upload.

  • @complextheory9529
    @complextheory9529 3 місяці тому

    Welcome back man! Stoked for the content!

  • @luizgarciaaa
    @luizgarciaaa 3 місяці тому

    Very nice you are back! Loved this video.

  • @orion42
    @orion42 3 місяці тому +5

    I am impressed, and I've never met anything like this organized fast typing coder.

  • @Mohammad-tw7cq
    @Mohammad-tw7cq 3 місяці тому

    Glad to see you are making videos again!

  • @discontinuity7526
    @discontinuity7526 3 місяці тому +2

    Invaluable series man can't wait for the rest

    • @CodingJesus
      @CodingJesus  3 місяці тому +3

      2/3 came out today. It was live-streamed. You can watch the replay of the stream on my channel or in the C++ Orderbook playlist.

  • @oric4281
    @oric4281 3 місяці тому

    yes finally continuing this series!!

  • @Golipillas
    @Golipillas 3 місяці тому +1

    Absolute magic man, thank you so much

  • @tristanjones2923
    @tristanjones2923 3 місяці тому +3

    Bro didn't touch his mouse once. King

  • @Coding_Mohammed
    @Coding_Mohammed 3 місяці тому

    Thank you for the content my brother

  • @HammadAli-uw9so
    @HammadAli-uw9so 3 місяці тому +1

    hey. it's nice to see you again.

  • @henryomarm
    @henryomarm 3 місяці тому +1

    i love the content super informative you earn your self a sub sir

  • @altricad5358
    @altricad5358 2 місяці тому

    Thank you so much for this!!!

  • @alinagy
    @alinagy 3 місяці тому +7

    I have never seen this combination in one person before, using vim in vs with white theme coding C++, this is optimum male performance

  • @oliverpotter4174
    @oliverpotter4174 3 місяці тому

    Can you see any too traders PNL? Do you know any top traders? Do you still think TA is garbage? Do you know any developers working on trading strategies?
    An updated video on the trading space would be very interesting bro.
    Glad to have you back!

  • @jakeg5288
    @jakeg5288 3 місяці тому +3

    Me: “Oh my god. I have to have that keyboard”
    *checks price*
    Me: 😖

  • @Ishvires
    @Ishvires 3 місяці тому

    Respect man, respect!

  • @MananBhardwajjj
    @MananBhardwajjj 3 місяці тому

    What you are offering is literally helping in real life. I would be delighted if we could collab and i could make you the face of a dating series i am designing. (Ps - it will be paid offc)

  • @harrybellingham98
    @harrybellingham98 3 місяці тому +6

    finally.. this has taken years to come lol

  • @fed3919
    @fed3919 3 місяці тому +2

    Hi CJ,
    First of all thanks,
    I'm following along with the coding video, but I think it would've been useful to start with a quick explanation of the main classes involved and how they work together. I don't mean a whole diagram or anything, just a couple sentences about what we're building and how the different pieces fit together.
    I am new to orderboooks and whenever a new class was created I could follow but at half of the video I had to stop and think about what I was doing, since I noticed I didn't have it clear in my mind.
    Thanks.

    • @CodingJesus
      @CodingJesus  3 місяці тому +3

      Good idea. Will do in the next video.

  • @yjc149
    @yjc149 2 місяці тому

    great video

  • @pserra94
    @pserra94 3 місяці тому

    Great content! Why dont you make a course or book about HFT's implementation using C++ ? I would buy it!

  • @lucas4019
    @lucas4019 3 місяці тому +3

    never trust devs without dark mode

  • @user-qm6up7kz4n
    @user-qm6up7kz4n 2 місяці тому

    Thank you! Is orderbook something which only exchanges implement? Or would trading desks/traders ever implement their own order books?

  • @tinska12
    @tinska12 3 місяці тому

    Do you have any pointers for MM invetory management? Or pointers how to think about invetory management and risk management? I want to believe that there exists MM inveotry management methods that minimizes / neutralizes delta even with geometric brownian motion...

  • @piphunter
    @piphunter 3 місяці тому +1

    Coding Jesus ~ I'm a discretionary trader wanting to learn how to code my own stuff. Would you be able to highlight books you would recommend for learning C++ and maybe some online resources as well? I'm looking forward to watching an orderbook being built.

    • @daveczerepak
      @daveczerepak 3 місяці тому

      I would start with a book or course on just basic c++. There are tons, and plenty of Udemy courses. Then you can dive into time series, financial analysis and mathematics in c++, algo trading in c++. You’ll also learn that there is a lot of ML in the quantdev world, c++ does work with TensorFlow but it’s not the best technology for it. Start with an intro to C++ course or book with great reviews and then move onto data structures. After that you can start applying the financial stuff slowly.

    • @AMX0013
      @AMX0013 2 місяці тому +1

      I highly recommend Effective C++ book, latest edition. and reading up on topics suc as templates, concepts, traits. This was something i yoinked from a job requirement
      • variadic templates & parameter packs
      • move semantics / forwarding; concepts;
      • CRTP;
      • traits, policies, and tag-types;
      • tuples/variants visit/apply etc.;
      • the pImpl idiom;
      • lambdas;
      • custom streaming operators;
      • constexpr;
      • auto;
      lambdas, and macro hackery.

  • @_________________404
    @_________________404 3 місяці тому +3

    Yes. I know what C++ is. I have no idea what an orderbook is though.

    • @daveczerepak
      @daveczerepak 3 місяці тому +1

      He will probably make orders into structures and the order book a class with functions and variables, like a switch statement with different order types like stop, limit, market, etc. a function to return the final order that would have a ticker, price, quantity, etc. an order book is an electronic list (best ones in real time) that show you all the buy and sell orders. Usually you connect to an exchange API or third party market data supplier to get data. Hope that helps connect c++ to an order book

    • @_________________404
      @_________________404 3 місяці тому

      @@daveczerepak Yeah I'm a programmer but I have no idea about the finance terms he uses.

  • @heoheobu0012
    @heoheobu0012 2 місяці тому

    God! You are back to save me from this savage land. Amen!

  • @naveedh27
    @naveedh27 3 місяці тому

    Is it necessary to use c++ for quant development? Can java also be used?

  • @chidalunwaimo876
    @chidalunwaimo876 2 місяці тому

    Final he shows us the way - Lisan Al Ghaib

  • @catlover1732
    @catlover1732 3 місяці тому

    Hey coding jesus, just wondering if there's a reason why you add the order to the book first, then run a matching algorithm - since your order add will be log(n), and you will have to pay the cost of removing the order pretty much immediately. If we match before insertion, it should be an O(1) check and it will be much cheaper. Or is it just for ease of coding, because the logic does look easier. thanks :)

    • @CodingJesus
      @CodingJesus  3 місяці тому +1

      Easier for people to understand and potentially easier for other order types. You can do it your way too, valid point.

  • @AB608052
    @AB608052 3 місяці тому

    There's all kinds of trading strategies to try.... but the day traders say that the HFT killed day trading.. is that actually true

  • @fed3919
    @fed3919 3 місяці тому

    1) At 15:30, Why do we need a OrderModify? Couldn't we just add a Modify() function as the Fill() function in the Order class?

    • @CodingJesus
      @CodingJesus  3 місяці тому +4

      1. When you modify, you're supposed to lose queue position. Modifying an order in place maintains queue position.
      2. Your suggestion would break if someone modifies price or side.

  • @jinxscript
    @jinxscript 3 місяці тому

    Can't you make one in metatrader 5 ??

  • @rajat346
    @rajat346 2 місяці тому

    what documentation he talking about at @1:50 timestamp

  • @user-cp5xk6ov8u
    @user-cp5xk6ov8u 8 днів тому

    can u provide me link for c++ book for quant developer

  • @user-ts6ft1sc2n
    @user-ts6ft1sc2n 3 місяці тому

    Please share your view on Devin AI

  • @santosreckz7203
    @santosreckz7203 3 місяці тому +2

    What keyboard are you using?

  • @Alpharabius99
    @Alpharabius99 3 місяці тому

    c++ is pure pain after years of c# its so fucking hard

  • @wedeyforyou
    @wedeyforyou 2 місяці тому

    someone please explain to me what all those include files do?

    • @CodingJesus
      @CodingJesus  2 місяці тому +2

      See part 2, or just click the GitHub link. I put it all in main just for part 1 so people don’t get confused as I jump around. I refactored into proper header files on GitHub.

  • @Comonad
    @Comonad 2 місяці тому

    All those rings they should be calling you sonic, not Jesus

  • @Oliver-nt8pw
    @Oliver-nt8pw Місяць тому

    I tried typing in everything with you to folow, but there are so many compile problems omg. If anyone else is trying to do the same, just dont :D

  • @rithikprasad7760
    @rithikprasad7760 3 місяці тому +1

    Coding Jesus, as someone who does not know how to code at all , is it a good idea to replicate this task to learn ? Thanks.

    • @recursion.
      @recursion. 3 місяці тому +7

      ofc man, all you need is 3 months of dedication and you're set to that 200k paycheck.

    • @FarzanHashmi
      @FarzanHashmi 3 місяці тому +2

      Likely not

    • @chiomaobunadike3313
      @chiomaobunadike3313 3 місяці тому +1

      @@recursion.ha ha ha. Where’s your paycheck ?

    • @_________________404
      @_________________404 3 місяці тому +4

      @@recursion.💀💀💀 I hope you’re joking.

    • @daveczerepak
      @daveczerepak 3 місяці тому +2

      Replicate sure, but make sure you can read and know what’s going on

  • @yogendrasingh6865
    @yogendrasingh6865 3 місяці тому

    Do you know someone who can code me a MEMPOOL SNIPER (Blockchain)?

  • @daveczerepak
    @daveczerepak 3 місяці тому +1

    Are you going to use Devin , Claude 3, or chatGPT ? Or no AI ? I’d like to see no AI. Won’t complain if you use em. But if you don’t, more props to you.

    • @CodingJesus
      @CodingJesus  3 місяці тому +10

      AI uses me.

    • @_________________404
      @_________________404 3 місяці тому

      Chatgpt is awful with C++ anyway. Probably had way less training data with C++ than other more “mainstream” languages.

    • @shaikhmubin02
      @shaikhmubin02 3 місяці тому +2

      🗿🗿...​@@CodingJesus

    • @fed3919
      @fed3919 3 місяці тому +1

      Why no AI? Would you say the same if he was doing calculations via a calculator instead of by hand?
      If it can simplify boring tasks then it should be used, imo.

    • @_________________404
      @_________________404 3 місяці тому +3

      @@fed3919 AI doesn’t even help that much in most cases. It’s not comparable to a calculator.

  • @gameacc6079
    @gameacc6079 3 місяці тому +1

    the fact u are not use vim/emacs says everything.. not a tier 1 prop firm u are at sir

    • @Bayo106
      @Bayo106 3 місяці тому

      you're deaf or stupid

  • @JK-xw5rn
    @JK-xw5rn 3 місяці тому

    yuffmoney says thank you

  • @eaccer
    @eaccer 3 місяці тому +1

    I know this is a weird comment, and I do want to mention that I also code on a white background myself BUT you might literally be losing followers/viewership just because of that fact.

  • @AB608052
    @AB608052 3 місяці тому

    alright. You say technical analysis is useless.. It's not.. I don't know if your company uses it. You want to make some money? I'd say it's a secret, but plenty of books have this drawing that goes rally: investors -> suckers. Wave theory, the one your probably talking about.. there is the pattern of a rally, three humps up and the fourth below the third. They call it 1-2-3-4-5-a-b-c, as in like 8 vectors joined together. OK, so, go to a rallying asset, knowing this pattern, can you tell if the rally is over?