{"id":155,"date":"2019-12-09T06:23:42","date_gmt":"2019-12-09T11:23:42","guid":{"rendered":"https:\/\/www.jmjatlanta.com\/?p=155"},"modified":"2021-03-16T12:31:01","modified_gmt":"2021-03-16T17:31:01","slug":"matching-engine-requirements","status":"publish","type":"post","link":"https:\/\/www.jmjatlanta.com\/index.php\/2019\/12\/09\/matching-engine-requirements\/","title":{"rendered":"Matching Engine Requirements"},"content":{"rendered":"\n<p>As an academic exercise, I wanted to take on building a matching engine in C++. The purpose here is to iterate through the process of measuring and improving performance.<\/p>\n\n\n\n<p>I imagine the initial requirements as naive, with later iterations including removal of floating point calculations, variable precision, 128-bit integers, &#8220;dust&#8221; handling (may be more of an implementation question than a performance one).<\/p>\n\n\n\n<p>This engine will be strictly single-threaded and purposeful. It is hoped that the input will be clean and optimized (which could be offloaded) to improve throughput.<\/p>\n\n\n\n<p>Tooling will be sparse, on purpose. The idea here is not a discussion of the intricacies of the tools, but how tweaks to code affects speed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Idea<\/h2>\n\n\n\n<p>The engine will receive limit orders that specify the asset held, the asset to be bought, and the desired price. It will include a sequential id, externally guaranteed to be unique (such a key could be analyzed later&#8230; we&#8217;ll see&#8230;).<\/p>\n\n\n\n<p>Once received, the order is processed and if not immediately filled, what is left over is placed on the order book.<\/p>\n\n\n\n<p>Simple, right? There are many details yet to be sorted out. So we will get started! I will edit this post with links to my future posts on the subject. Stay tuned!<\/p>\n\n\n\n<p>For the first cut of the order book, <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/github.com\/jmjatlanta\/matching-engine\/commit\/2403936310cfb48cfd22935a8aaf5b319335cd6f\" target=\"_blank\">see this GitHub commit.<\/a><\/p>\n\n\n\n<p>To see what I tackled next, see <a href=\"https:\/\/www.jmjatlanta.com\/index.php\/2019\/12\/09\/order-matching-and-container-types\/\">part two.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As an academic exercise, I wanted to take on building a matching engine in C++. The purpose here is to iterate through the process of measuring and improving performance. I imagine the initial requirements as naive, with later iterations including removal of floating point calculations, variable precision, 128-bit integers, &#8220;dust&#8221; handling (may be more of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[15],"class_list":["post-155","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-system-trading"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/posts\/155","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/comments?post=155"}],"version-history":[{"count":3,"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/posts\/155\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/posts\/155\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/media?parent=155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/categories?post=155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jmjatlanta.com\/index.php\/wp-json\/wp\/v2\/tags?post=155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}