{
    "componentChunkName": "component---src-templates-post-page-js",
    "path": "/2018/cryptomate/modules",
    "result": {"data":{"site":{"siteMetadata":{"title":"Solid Abstractions","siteUrl":"https://solidabstractions.com","twitterId":291334023,"author":{"fullName":"Julien Hartmann","profileHtml":"I am an open-source de­vel­op­er, for­mer IT con­sul­tant with a pas­sion for new tech­nol­o­gies. I be­lieve the role of an en­gi­neer is to em­pow­er peo­ple, by as­sem­bling sim­ple, re­fined de­signs.\n","links":[{"url":"https://github.com/spectras/","name":"github","title":"GitHub"},{"url":"https://stackoverflow.com/users/3212865/spectras","name":"stackoverflow","title":"StackOverflow"},{"url":"https://www.linkedin.com/in/julienhartmann/","name":"linkedin","title":"LinkedIn"}],"profilePicNode":{"original":{"src":"/static/profile-pic-301a9cbe7b572c3e7910c9717d2b3bcd.jpg"}},"url":"https://etherdream.org/about"}}},"markdownRemark":{"id":"e3cbc79a-204d-56e9-bce6-69fbc674951a","excerpt":"We understand the problem and can start building our high-level architecture. We will start\nwith mapping the requirements to project elements.","html":"<p>We understand the problem and can start building our high-level architecture. We will start\nwith mapping the requirements to project elements.</p>\n<p>--- excerpt ---</p>\n<p>Our architecturally significant <a href=\"requirements\" class=\"internal\">requirements</a> workbook in hand, we are confident\nwe have clear enough understanding of the problem to start building our high-level\narchitecture.</p>\n<p>Our goal now will be to map requirements to modules and components,\nexplore possible architecture patterns and\ndescend into details on critical points.</p>\n<p>This is a long step, as we will build the bulk of the design, so I decided to split this step\ninto multiple posts:</p>\n<blockquote>\n<ol>\n<li>Modules and components <em>(this post)</em>.</li>\n<li><a href=\"exploring-patterns\" class=\"internal\">Exploring patterns</a>.</li>\n<li><a href=\"critical-points\" class=\"internal\">Critical points</a>.</li>\n</ol>\n</blockquote>\n<h2 id=\"modularizing-the-requirements\">Modularizing the requirements</h2>\n<h3 id=\"modules-overview\">Modules overview</h3>\n<p>We will start with arranging our requirements as a set of modules. Each modules shall be\nresponsible for one requirement, or one group of requirements. For instance, Cryptomate\nshall be able to open, cancel and monitor orders on trading platforms: a trading element\nwould be in order.</p>\n<p>Here are the modules I have identified:</p>\n<div class=\"figure-wrapper\"><figure id=\"fig-1\"><img src=\"/files/elements-58f08f8032f8aefb45ade0cc16e8a3a1.png\" alt=\"Cryptomate module diagram\" srcset=\"/files/elements-1.5x-776e24299ff88265ed9eb3147a739521.png 1.5x, /files/elements-2x-24c925ef80f63db92ede62aea0dceb27.png 2x\"><figcaption><div class=\"figcaption-wrapper\">Module Diagram</div></figcaption></figure></div>\n<div class=\"figure-wrapper\"><figure id=\"fig-2\"><table>\n<thead>\n<tr>\n<th>Module</th>\n<th>Responsibility</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Auditing</td>\n<td>Writes down auditing trails.</td>\n</tr>\n<tr>\n<td>Control endpoint</td>\n<td>Authenticates and authorizes user requests. Manages strategies according to user directives.</td>\n</tr>\n<tr>\n<td>Market history</td>\n<td>Provides random-access to past market events.</td>\n</tr>\n<tr>\n<td>Notification</td>\n<td>Sends notifications based on user-defined rules.</td>\n</tr>\n<tr>\n<td>Real-time market</td>\n<td>Provides access to real-time market events.</td>\n</tr>\n<tr>\n<td>Strategy evaluator</td>\n<td>Runs user-defined business logic.</td>\n</tr>\n<tr>\n<td>Strategy persistence</td>\n<td>Persists strategy state so it can be recovered.</td>\n</tr>\n<tr>\n<td>Trading</td>\n<td>Controls orders placed by the system. Provides events related to orders.</td>\n</tr>\n</tbody>\n</table><figcaption><div class=\"figcaption-wrapper\">Modules and responsibilities table</div></figcaption></figure></div>\n<p>As usual, if you found I missed one, please <a href=\"/about\" class=\"internal\">tell me</a>.</p>\n<h3 id=\"component-allocations\">Component allocations</h3>\n<p>The way these modules get instantiated at run-time is interesting, to better understand the\nallocation mechanisms that will be needed:</p>\n<div class=\"figure-wrapper\"><figure id=\"fig-3\"><table>\n<thead>\n<tr>\n<th>Module</th>\n<th>Allocation</th>\n<th>Selected By</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Auditing</td>\n<td>static, single</td>\n<td>configuration</td>\n</tr>\n<tr>\n<td>Control endpoint</td>\n<td>static, single</td>\n<td>configuration</td>\n</tr>\n<tr>\n<td>Market history</td>\n<td>static, single</td>\n<td>configuration</td>\n</tr>\n<tr>\n<td>Notification</td>\n<td>static, single</td>\n<td>configuration</td>\n</tr>\n<tr>\n<td>Real-time market</td>\n<td>dynamic, multiple</td>\n<td>strategy</td>\n</tr>\n<tr>\n<td>Strategy evaluator</td>\n<td>dynamic, multiple</td>\n<td>strategy</td>\n</tr>\n<tr>\n<td>Strategy persistence</td>\n<td>static, single</td>\n<td>configuration</td>\n</tr>\n<tr>\n<td>Trading</td>\n<td>dynamic, multiple</td>\n<td>strategy</td>\n</tr>\n</tbody>\n</table><figcaption><div class=\"figcaption-wrapper\">Component allocation table</div></figcaption></figure></div>\n<p>Where <em>static</em> means the component is allocated on startup and destroyed at shutdown, while\n<em>dynamic</em> means allocations and de-allocations can happen during normal life of the system.\n<em>Multiple</em> allocations are the components that will have several instances coexisting during\nthe life of the system. For instance, the system might connect to several markets at once.</p>\n<p>Lastly, the third column details where the knowledge of what and how to instantiate components\nlives. In Cryptomate, it may either be statically configured within the configuration file,\nor dynamically decided by currently running strategies. This means both process will probably\nbe complex enough to mandate a specific builder module.</p>\n<p>We will therefore add the following modules to the list:</p>\n<div class=\"figure-wrapper\"><figure id=\"fig-4\"><table>\n<thead>\n<tr>\n<th>Module</th>\n<th>Responsibility</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Configuration builder</td>\n<td>Instantiates and initializes statically-allocated components from a configuration description (either a file or a data-structure).</td>\n</tr>\n<tr>\n<td>Strategy builder</td>\n<td>Instantiates or trigger the instantiation of components required to start a strategy. This includes the required bookkeeping to shut them down upon stopping the strategy.</td>\n</tr>\n</tbody>\n</table><figcaption><div class=\"figcaption-wrapper\">Modules and responsibilities table</div></figcaption></figure></div>\n<h3 id=\"event-flow-overview\">Event flow overview</h3>\n<p>Since market events will drive most of our logic, and trading is inherently very time-sensitive,\nnow is a good time to picture how incoming market events will flow through our system, from\nmarket data providers all the way to outgoing trading orders:</p>\n<div class=\"figure-wrapper\"><figure id=\"fig-5\"><img src=\"/files/eventflow-4187b6381453dcbe02a009bc301884a3.png\" alt=\"Market event flow overview\" srcset=\"/files/eventflow-1.5x-96ec82ca1b74b019e91f94e40feaceb5.png 1.5x, /files/eventflow-2x-b29dda8b6baebcc2cf0067bdae93a914.png 2x\"><figcaption><div class=\"figcaption-wrapper\">Market event flow overview. Modules not taking a direct part in trading events are omitted.</div></figcaption></figure></div>\n<p>We will be mindful of both ensuring the critical path has reasonable latency, and side processing\ndo not introduce spurious delays.</p>\n<h2 id=\"conclusion\">Conclusion</h2>\n<p>This concludes our initial pass of identifying key Cryptomate modules. This is not set in stone yet,\nbut this should be enough for us to design our high-level architecture.</p>\n<p>So let's now <a href=\"exploring-patterns\" class=\"internal\">explore architecture patterns</a> we could use to structure\nthose modules into an actual design.</p>","fields":{"isPage":false,"slug":"/2018/cryptomate/modules"},"frontmatter":{"title":"Modules and Components","classname":null,"date":"2018-08-08T00:00:00.000Z","formattedDate":"August 08, 2018","isoDate":"2018-08-08T00:00:00+00:00"},"headings":[{"value":"Modularizing the requirements","depth":1},{"value":"Modules overview","depth":2},{"value":"Component allocations","depth":2},{"value":"Event flow overview","depth":2},{"value":"Conclusion","depth":1}],"image":null,"series":{"name":"cryptomate","fullName":null,"fields":{"slug":"/cryptomate"}},"tags":[{"name":"architecture","slug":"/tag/architecture"}]}},"pageContext":{"series":"cryptomate","slug":"/2018/cryptomate/modules","previous":{"fields":{"slug":"/2018/cryptomate/requirements"},"frontmatter":{"title":"Requirements and Quality Attributes","series":"cryptomate"},"tags":[{"name":"architecture","slug":"/tag/architecture"}]},"next":{"fields":{"slug":"/2018/cryptomate/exploring-patterns"},"frontmatter":{"title":"Exploring Patterns","series":"cryptomate"},"tags":[{"name":"architecture","slug":"/tag/architecture"},{"name":"pattern","slug":"/tag/pattern"}]},"seriesPrevious":{"fields":{"slug":"/2018/cryptomate/requirements"},"frontmatter":{"title":"Requirements and Quality Attributes","series":"cryptomate"},"tags":[{"name":"architecture","slug":"/tag/architecture"}]},"seriesNext":{"fields":{"slug":"/2018/cryptomate/exploring-patterns"},"frontmatter":{"title":"Exploring Patterns","series":"cryptomate"},"tags":[{"name":"architecture","slug":"/tag/architecture"},{"name":"pattern","slug":"/tag/pattern"}]}}},
    "staticQueryHashes": ["1733002695","4006707078"]}