{"id":3242,"date":"2024-12-25T10:50:50","date_gmt":"2024-12-25T10:50:50","guid":{"rendered":"https:\/\/sparkminds.net\/?p=3242"},"modified":"2024-12-26T10:31:11","modified_gmt":"2024-12-26T10:31:11","slug":"matching-engine-using-ring-buffer","status":"publish","type":"post","link":"https:\/\/sparkminds.net\/vi\/matching-engine-using-ring-buffer\/","title":{"rendered":"Matching Engine using Ring Buffer"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3242\" class=\"elementor elementor-3242\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f9b500c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f9b500c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-85de0f9\" data-id=\"85de0f9\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d7cb175 elementor-widget elementor-widget-text-editor\" data-id=\"d7cb175\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>In a crypto, stock, or foreign exchange, speed and efficiency play an important role, especially for matching engines that process buy and sell orders. A ring buffer is a circular data structure that can improve the performance of the exchange by minimizing memory overhead and ensuring consistent data flow. This article will provide you with a comprehensive guide to developing a matching engine using a ring buffer.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a4c0ade elementor-widget elementor-widget-heading\" data-id=\"a4c0ade\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Matching engine (ME - Order Matching System)<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e7e87c elementor-widget elementor-widget-heading\" data-id=\"8e7e87c\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">1. Definition<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-eb05c6f elementor-widget elementor-widget-text-editor\" data-id=\"eb05c6f\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tThe matching engine is one of the core components of financial exchanges (both stock and cryptocurrency exchanges). It will match buy and sell orders based on pre-determined rules.\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b3e1f9c elementor-widget elementor-widget-heading\" data-id=\"b3e1f9c\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">2. How it works<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6be5cc4 elementor-widget elementor-widget-text-editor\" data-id=\"6be5cc4\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tThe matching engine will operate on 5 main steps: Receiving orders, order storage, order matching, trade execution, and updating the order book.\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2c58f5b elementor-widget elementor-widget-text-editor\" data-id=\"2c58f5b\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ol>\n \t<li><strong>Receiving order:<\/strong> The matching engine will receive buy or sell orders from users with information such as symbol, price, quantity, and order type (market order, limit order&#8230;).<\/li>\n<\/ol>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b5514fa elementor-widget elementor-widget-text-editor\" data-id=\"b5514fa\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ol start=\"2\"><li><strong>Order Storage:<\/strong> Orders are stored in the <a href=\"https:\/\/www.investopedia.com\/terms\/o\/order-book.asp\"><span style=\"text-decoration: underline;\">Order book<\/span><\/a>, which consists of two main lists:<ul><li><strong>Buy Orders<\/strong>: A list of buy orders sorted in descending price order.<\/li><li><strong>Sell Orders<\/strong>: A list of sell orders sorted in ascending price order.<\/li><\/ul><\/li><\/ol>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a98d4cc elementor-widget elementor-widget-text-editor\" data-id=\"a98d4cc\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ol start=\"3\"><li><strong>Order Matching:<\/strong> The matching engine checks if buy and sell orders can be matched. Then, the orders will be matched following the common order matching rules :<ul><li><strong>Price:<\/strong> A buy order can match with a sell order if the buy price is higher than or equal to the selling price.<\/li><li><strong>Time:<\/strong> If multiple orders are at the same price, the order placed earlier will be prioritized.<\/li><\/ul><\/li><\/ol>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-844b243 elementor-widget elementor-widget-text-editor\" data-id=\"844b243\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ol start=\"4\"><li><strong>Trade Execution:<\/strong> If a buy order and a sell order match, the transaction will be executed. The quantity of stock is transferred from the seller to the buyer, and the money is transferred from the buyer to the seller.<\/li><\/ol>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2f3bc38 elementor-widget elementor-widget-text-editor\" data-id=\"2f3bc38\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ol start=\"5\"><li><strong>Updating the order book:<\/strong> After the trade is executed, the order book is updated to reflect matched orders and the remaining amount of the orders.<\/li><\/ol>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7453d79 elementor-widget elementor-widget-text-editor\" data-id=\"7453d79\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>For example, we have two orders:<\/p><ul><li>Buy order: 5 ETH for $100<\/li><li>Sell order: 2 ETH for $99<\/li><\/ul><p>When a sell order for 2 ETH at $99 is submitted, the matching engine will match this order with the first buy order in the order book. As a result, a transaction of 2 ETH at $99 will be executed. Once the trade is completed, the matching engine will store the remaining buy order amount in the buy order queue, or vice versa.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-94b0fea elementor-widget elementor-widget-heading\" data-id=\"94b0fea\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">3. Common types of orders<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fb42eb3 elementor-widget elementor-widget-text-editor\" data-id=\"fb42eb3\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tAn exchange may have a variety of order types, but basically, there are 4 types of order as below. \t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2f95c84 elementor-widget elementor-widget-text-editor\" data-id=\"2f95c84\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul><li><strong>Market Order:<\/strong> A buy or sell order is at the current best price.<\/li><li><strong>Limit Order:<\/strong> A buy or sell order is at the specified price or better.<\/li><li><strong>Stop Order:<\/strong> An order when the price reaches the specified price.<\/li><li><strong>Stop-Limit Order:<\/strong> An order can be turned into a limit order when the price reaches a specific level.<\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-108732b elementor-widget elementor-widget-heading\" data-id=\"108732b\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Ring Buffer Overview<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3980b44 elementor-widget elementor-widget-heading\" data-id=\"3980b44\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">1. Definition<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-173db72 elementor-widget elementor-widget-text-editor\" data-id=\"173db72\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tA Ring Buffer (also known as a circular buffer) is a data structure with a fixed size, used to store elements in a FIFO (First In, First Out) manner. When the buffer is full, it overwrites the oldest data with the newest data. Below are some key points about the Ring Buffer:\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a017082 elementor-widget elementor-widget-text-editor\" data-id=\"a017082\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul><li><strong>Fixed Size<\/strong>: The Ring Buffer has a fixed size, so when it becomes full, the new element will overwrite the oldest element.<\/li><li><strong>Two Pointers<\/strong>: Head Pointer points to the most recent position, and Tail Pointer points to the oldest position.<\/li><li><strong>Efficient Memory Usage<\/strong>: The Ring Buffer does not need to move data when writing or reading, which optimizes memory usage and improves performance.<\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6273f97 elementor-widget elementor-widget-html\" data-id=\"6273f97\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>```bash\r\nnpm install react-native-maps or yarn add react-native-maps\r\n```<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-566d2a2 elementor-widget elementor-widget-heading\" data-id=\"566d2a2\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">2. Typical use cases<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5abacb7 elementor-widget elementor-widget-text-editor\" data-id=\"5abacb7\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tRing Buffers are commonly used in systems that require continuous data stream processing, such as:\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5354df6 elementor-widget elementor-widget-text-editor\" data-id=\"5354df6\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul><li>Audio or video processing.<\/li><li>Inter-process communication.<\/li><li>Queues in real-time systems<\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ade47d1 elementor-widget elementor-widget-html\" data-id=\"ade47d1\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>&lt;application&gt;\r\n  &lt;meta-data\r\n    android:name&#x3D;&quot;com.google.android.geo.API_KEY&quot;\r\n    android:value&#x3D;&quot;YOUR_GOOGLE_MAPS_API_KEY&quot; &#x2F;&gt;\r\n&lt;&#x2F;application&gt;<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-80b2f30 elementor-widget elementor-widget-heading\" data-id=\"80b2f30\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">3. Benefits<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-44c6240 elementor-widget elementor-widget-text-editor\" data-id=\"44c6240\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul><li>High performance due to no need for data shifting when adding or removing elements.<\/li><li>Efficient memory usage with a fixed size.<\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e3629e5 elementor-widget elementor-widget-heading\" data-id=\"e3629e5\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">4. Drawbacks<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2848526 elementor-widget elementor-widget-text-editor\" data-id=\"2848526\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul><li>Fixed size can be limited if the amount of data changes unpredictably.<\/li><li><span style=\"letter-spacing: 0.1px;\">More complex in m<\/span>anaging full and empty states\u00a0<\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-78c5ae9 elementor-widget elementor-widget-heading\" data-id=\"78c5ae9\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">5. How it works<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9f8b813 elementor-widget elementor-widget-text-editor\" data-id=\"9f8b813\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul><li>Implemented on an array, using two pointers: tail and head.<\/li><li>When a write command is received, the head pointer writes data to the buffer and then increments by 1.<\/li><li>When a read command is received, data is read from the buffer, and the tail is incremented by 1.<\/li><li>When a pointer reaches the last element, it automatically points back to the initial position.<\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b8ad013 elementor-widget elementor-widget-image\" data-id=\"b8ad013\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/Difference-Between-Linear-and-Circular-Queue_Figure-2.gif\" class=\"attachment-large size-large wp-image-3248\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1b470db elementor-widget elementor-widget-heading\" data-id=\"1b470db\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Here is the command<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-72c0370 elementor-widget elementor-widget-html\" data-id=\"72c0370\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>\/\/ Does not allow overwriting\r\nIF (TAIL + 1) === SIZE ( throw IS_FULL), TAIL = (TAIL + 1) % SIZE \r\n<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d80e796 elementor-widget elementor-widget-text-editor\" data-id=\"d80e796\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>For example:<br \/>SIZE = 5 We have:<br \/>Buffer: [ , , , , ]<br \/>HEAD = 0<br \/>TAIL = 0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dc456ad elementor-widget elementor-widget-text-editor\" data-id=\"dc456ad\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ol start=\"2\">\n \t<li>Open ios\/Podfile and add the following snippets:<\/li>\n<\/ol>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-af24bf4 elementor-widget elementor-widget-html\" data-id=\"af24bf4\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>\r\n\/\/ Plus 1,\r\nBuffer: [1, , , , ]\r\nHEAD = 0\r\nTAIL = 1\r\n\r\n\r\n\/\/ Plus 2. \r\nBuffer: [1, 2, , , ]\r\nHEAD = 0\r\nTAIL = 2\r\n\r\n\/\/ Plus 3.\r\nBuffer: [1, 2, 3, , ]\r\nHEAD = 0\r\nTAIL = 3\r\n\r\n\/\/ Plus 4.\r\nBuffer: [1, 2, 3, 4, ]\r\nHEAD = 0\r\nTAIL = 4\r\n\r\n\/\/ Plus 5.\r\nBuffer: [1, 2, 3, 4, 5]\r\nHEAD = 0\r\nTAIL = 5\r\n\r\n\/\/ Plus 6.\r\nThrow IS_FULL\r\n\r\n\/\/ Pop \r\n1,2,3,4,5\r\n<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b020b9b elementor-widget elementor-widget-html\" data-id=\"b020b9b\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>\r\n\/\/ Allows overwriting\r\nIF (TAIL + 1) === SIZE HEAD = (HEAD + 1) % SIZE  , TAIL = (TAIL + 1) % SIZE \r\n<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b4d81d5 elementor-widget elementor-widget-html\" data-id=\"b4d81d5\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>\r\n\/\/ Plus 1. \r\nBuffer: [1, , , , ]\r\nHEAD = 0\r\nTAIL = 1\r\n\r\n\r\n\/\/ Plus 2. \r\nBuffer: [1, 2, , , ]\r\nHEAD = 0\r\nTAIL = 2\r\n\r\n\/\/ Plus 3.\r\nBuffer: [1, 2, 3, , ]\r\nHEAD = 0\r\nTAIL = 3\r\n\r\n\/\/ Plus 4.\r\nBuffer: [1, 2, 3, 4, ]\r\nHEAD = 0\r\nTAIL = 4\r\n\r\n\/\/ Plus 5.\r\nBuffer: [1, 2, 3, 4, 5]\r\nHEAD = 0\r\nTAIL = 5\r\n\r\n\/\/ Plus 6.\r\nBuffer: [6, 2, 3, 4, 5]\r\nHEAD = 0\r\nTAIL = 1\r\n\r\n\/\/ Plus 6.\r\nBuffer: [6, 7, 3, 4, 5]\r\nHEAD = 0\r\nTAIL = 2\r\n\r\n\/\/ POP HEAD start = 2 \r\n3,4,5,6,7\r\n<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6fd2bbc elementor-widget elementor-widget-text-editor\" data-id=\"6fd2bbc\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>when you apply a Ring Buffer in the matching engine, it will help optimize the processing of buy and sell orders quickly and efficiently. The Ring Buffer ensures that orders are processed in FIFO order, while the order book and matching algorithm ensure that orders are matched accurately according to predefined rules.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-482fcb2 elementor-widget elementor-widget-heading\" data-id=\"482fcb2\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Demo: Application of Machine Engine and Ring Buffer in P2P trading.<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a0ae2f3 elementor-widget elementor-widget-text-editor\" data-id=\"a0ae2f3\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>In the current financial trading landscape, P2P (peer-to-peer) trading systems are gaining popularity for their transparency and efficiency. To improve the performance and reliability of these systems, it is crucial to implement advanced technologies like the Matching Engine (ME) and Ring Buffer.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4c0c715 elementor-widget elementor-widget-heading\" data-id=\"4c0c715\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Technology used<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5c34b1a elementor-widget elementor-widget-text-editor\" data-id=\"5c34b1a\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Database: MYSQL<br \/>Backend: Java Spring boot<br \/>Front end: NextJs<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0eea49e elementor-widget elementor-widget-heading\" data-id=\"0eea49e\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Workflow<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-38d8455 elementor-widget elementor-widget-image\" data-id=\"38d8455\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1796\" height=\"1256\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/workflow.webp\" class=\"attachment-full size-full wp-image-3260\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/workflow.webp 1796w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/workflow-300x210.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/workflow-1024x716.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/workflow-768x537.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/workflow-1536x1074.webp 1536w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/workflow-472x330.webp 472w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/workflow-257x180.webp 257w\" sizes=\"(max-width: 1796px) 100vw, 1796px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-28e5ad8 elementor-widget elementor-widget-heading\" data-id=\"28e5ad8\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Data Diagram<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4f0adf8 elementor-widget elementor-widget-image\" data-id=\"4f0adf8\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"742\" height=\"740\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/data-diagram-.webp\" class=\"attachment-full size-full wp-image-3251\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/data-diagram-.webp 742w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/data-diagram--300x300.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/data-diagram--150x150.webp 150w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/data-diagram--331x330.webp 331w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/data-diagram--180x180.webp 180w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/data-diagram--400x400.webp 400w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f615f7e elementor-widget elementor-widget-text-editor\" data-id=\"f615f7e\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Below is an example of user input<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b09f64 elementor-widget elementor-widget-image\" data-id=\"7b09f64\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"990\" height=\"1320\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/user-input.webp\" class=\"attachment-full size-full wp-image-3259\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/user-input.webp 990w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/user-input-225x300.webp 225w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/user-input-768x1024.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/user-input-248x330.webp 248w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/user-input-135x180.webp 135w\" sizes=\"(max-width: 990px) 100vw, 990px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2036aea elementor-widget elementor-widget-text-editor\" data-id=\"2036aea\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Order type: Select the order type you want.<br \/>Price: Enter the price that you want.<br \/>Amount: Specify the value of tokens you wish to buy or sell.<br \/>Total: The system will compute the total USD needed.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8c11212 elementor-widget elementor-widget-heading\" data-id=\"8c11212\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Main Processing Classes <\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f08a941 elementor-widget elementor-widget-text-editor\" data-id=\"f08a941\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul><li>P2POrderService<\/li><li>MatchingEngineService<\/li><li>P2PTransactionService<\/li><li>UserWalletService<\/li><li>RingBuffer<\/li><li>UserCryptoWalletService<\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-570f520 elementor-widget elementor-widget-heading\" data-id=\"570f520\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">P2POrderService<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-96f6df5 elementor-widget elementor-widget-text-editor\" data-id=\"96f6df5\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Receives orders and places them into the ring buffer to await processing by the matching engine. It calls the UserWalletService and UserCryptoWalletService to update the user&#8217;s balance.<\/p><p>If the transaction type is BUY, the system will freeze the total USD needed in the user&#8217;s wallet.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-00cb42d elementor-widget elementor-widget-image\" data-id=\"00cb42d\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1862\" height=\"362\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance.webp\" class=\"attachment-full size-full wp-image-3256\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance.webp 1862w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-300x58.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-1024x199.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-768x149.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-1536x299.webp 1536w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-570x111.webp 570w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-270x52.webp 270w\" sizes=\"(max-width: 1862px) 100vw, 1862px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-259b9cd elementor-widget elementor-widget-text-editor\" data-id=\"259b9cd\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tConversely, the system will freeze the total tokens to be sold.\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-202ad29 elementor-widget elementor-widget-image\" data-id=\"202ad29\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1998\" height=\"358\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-when-create-sell-order.webp\" class=\"attachment-full size-full wp-image-3255\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-when-create-sell-order.webp 1998w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-when-create-sell-order-300x54.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-when-create-sell-order-1024x183.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-when-create-sell-order-768x138.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-when-create-sell-order-1536x275.webp 1536w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-when-create-sell-order-570x102.webp 570w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/freeze-users-balance-when-create-sell-order-270x48.webp 270w\" sizes=\"(max-width: 1998px) 100vw, 1998px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d18cc05 elementor-widget elementor-widget-heading\" data-id=\"d18cc05\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">MatchingEngineService<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fff7ec6 elementor-widget elementor-widget-text-editor\" data-id=\"fff7ec6\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Sequentially retrieve orders from the ring buffer in FCFS order and match them with previous orders to execute P2P transactions.<\/p><p>The transactions are compared to meet the following conditions:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ce9e50c elementor-widget elementor-widget-html\" data-id=\"ce9e50c\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>\r\n * Buy order: Buy price >= Sell price\r\n * Sell order: Sell price <= Buy price\r\n * Cannot buy from oneself\r\n * Tokens must be the same \r\n<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bd9e988 elementor-widget elementor-widget-image\" data-id=\"bd9e988\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1698\" height=\"968\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/compare-transactions.webp\" class=\"attachment-full size-full wp-image-3250\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/compare-transactions.webp 1698w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/compare-transactions-300x171.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/compare-transactions-1024x584.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/compare-transactions-768x438.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/compare-transactions-1536x876.webp 1536w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/compare-transactions-570x325.webp 570w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/compare-transactions-270x154.webp 270w\" sizes=\"(max-width: 1698px) 100vw, 1698px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c222e69 elementor-widget elementor-widget-text-editor\" data-id=\"c222e69\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>You can use @PostConstruct to declare a single ring buffer for the application with the buffer size specified in the application file.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-edc4089 elementor-widget elementor-widget-image\" data-id=\"edc4089\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1388\" height=\"376\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-single-ring-buffer.webp\" class=\"attachment-full size-full wp-image-3253\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-single-ring-buffer.webp 1388w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-single-ring-buffer-300x81.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-single-ring-buffer-1024x277.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-single-ring-buffer-768x208.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-single-ring-buffer-570x154.webp 570w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-single-ring-buffer-270x73.webp 270w\" sizes=\"(max-width: 1388px) 100vw, 1388px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-127bb63 elementor-widget elementor-widget-text-editor\" data-id=\"127bb63\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The cron job will call the processOrders function every minute,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6a90bb2 elementor-widget elementor-widget-image\" data-id=\"6a90bb2\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1258\" height=\"186\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/call-processorders-function.webp\" class=\"attachment-full size-full wp-image-3249\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/call-processorders-function.webp 1258w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/call-processorders-function-300x44.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/call-processorders-function-1024x151.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/call-processorders-function-768x114.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/call-processorders-function-570x84.webp 570w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/call-processorders-function-270x40.webp 270w\" sizes=\"(max-width: 1258px) 100vw, 1258px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b9cbdb4 elementor-widget elementor-widget-text-editor\" data-id=\"b9cbdb4\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tor you can use @Scheduled as shown below to set a custom time.\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6e4c90c elementor-widget elementor-widget-html\" data-id=\"6e4c90c\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>\r\n @Scheduled(fixedRate = {milisecond})\r\n<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a8bc72d elementor-widget elementor-widget-text-editor\" data-id=\"a8bc72d\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tOrder matching processing function.\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e497e85 elementor-widget elementor-widget-image\" data-id=\"e497e85\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"827\" height=\"789\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/order-matching-processing-function.webp\" class=\"attachment-full size-full wp-image-3257\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/order-matching-processing-function.webp 827w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/order-matching-processing-function-300x286.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/order-matching-processing-function-768x733.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/order-matching-processing-function-346x330.webp 346w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/order-matching-processing-function-189x180.webp 189w\" sizes=\"(max-width: 827px) 100vw, 827px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ef91bf9 elementor-widget elementor-widget-text-editor\" data-id=\"ef91bf9\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Upon successful order matching, the MatchingEngineService will call the P2PTransactionService to save the transaction history in the database (buyOrder, sellOrder, quantity, price).<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d5eacc3 elementor-widget elementor-widget-heading\" data-id=\"d5eacc3\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Declare Ring buffer <\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a947cee elementor-widget elementor-widget-text-editor\" data-id=\"a947cee\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Class RingBuffer includes: size, head, tail, isFull<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-81681d7 elementor-widget elementor-widget-image\" data-id=\"81681d7\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1204\" height=\"702\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-ring-buffer.webp\" class=\"attachment-full size-full wp-image-3254\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-ring-buffer.webp 1204w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-ring-buffer-300x175.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-ring-buffer-1024x597.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-ring-buffer-768x448.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-ring-buffer-566x330.webp 566w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-ring-buffer-270x157.webp 270w\" sizes=\"(max-width: 1204px) 100vw, 1204px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dd5d913 elementor-widget elementor-widget-text-editor\" data-id=\"dd5d913\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>By applying the ring buffer algorithm, we can declare a push function to add a new item to the buffer.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b04e43 elementor-widget elementor-widget-html\" data-id=\"7b04e43\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code>\r\n\/\/ Does not allow overwriting\r\nIF (TAIL + 1) === SIZE ( throw IS_FULL), TAIL = (TAIL + 1) % SIZE \r\n<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d57b554 elementor-widget elementor-widget-image\" data-id=\"d57b554\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1176\" height=\"522\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-push-function.webp\" class=\"attachment-full size-full wp-image-3252\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-push-function.webp 1176w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-push-function-300x133.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-push-function-1024x455.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-push-function-768x341.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-push-function-570x253.webp 570w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/declare-a-push-function-270x120.webp 270w\" sizes=\"(max-width: 1176px) 100vw, 1176px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-04c0445 elementor-widget elementor-widget-text-editor\" data-id=\"04c0445\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tAnd the pop function retrieves the first element from the buffer and increments the head to the next element.\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2a83d2d elementor-widget elementor-widget-image\" data-id=\"2a83d2d\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1174\" height=\"588\" src=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/pop-function.webp\" class=\"attachment-full size-full wp-image-3258\" alt=\"\" srcset=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/pop-function.webp 1174w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/pop-function-300x150.webp 300w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/pop-function-1024x513.webp 1024w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/pop-function-768x385.webp 768w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/pop-function-570x285.webp 570w, https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/pop-function-270x135.webp 270w\" sizes=\"(max-width: 1174px) 100vw, 1174px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-99a6fab elementor-widget elementor-widget-text-editor\" data-id=\"99a6fab\" data-element_type=\"widget\" data-settings=\"{&quot;ultimate_floating_fx_translate_y&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Above are all steps that will help you develop a matching engine using ring buffer. You can follow these steps and enhance the performance of a crypto\/foreign\/stock exchanges. If want to develop a those exchanges or applicaton that need a matching engine you can\u00a0<a href=\"https:\/\/sparkminds.net\/contacts\/\"><span style=\"text-decoration: underline;\">contact us<\/span><\/a>, share the project details and get the quotation.\u00a0<br \/>We are always willing to sign an <a href=\"https:\/\/sparkminds.net\/non-disclosure-agreement-nda\/\"><span style=\"text-decoration: underline;\">NDA<\/span> <\/a>to save your information!<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>In a crypto, stock, or foreign exchange, speed and efficiency play an important role, especially for matching engines that process [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3243,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[24,47],"tags":[],"class_list":["post-3242","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-custom-web-app","category-general","no-social-count","single-post-item mb40"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Matching Engine using Ring Buffer<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sparkminds.net\/vi\/matching-engine-using-ring-buffer\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Matching Engine using Ring Buffer\" \/>\n<meta property=\"og:description\" content=\"In a crypto, stock, or foreign exchange, speed and efficiency play an important role, especially for matching engines that process [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sparkminds.net\/vi\/matching-engine-using-ring-buffer\/\" \/>\n<meta property=\"og:site_name\" content=\"SparkMinds\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sparkminds.jsc\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-25T10:50:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-26T10:31:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"823\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 ph\u00fat\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/sparkminds.net\/#\/schema\/person\/f4769a5d0dd2b458b03580b337c920b8\"},\"headline\":\"Matching Engine using Ring Buffer\",\"datePublished\":\"2024-12-25T10:50:50+00:00\",\"dateModified\":\"2024-12-26T10:31:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/\"},\"wordCount\":1205,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/sparkminds.net\/#organization\"},\"image\":{\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp\",\"articleSection\":[\"Custom Web\/App\",\"General\"],\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/\",\"url\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/\",\"name\":\"Matching Engine using Ring Buffer\",\"isPartOf\":{\"@id\":\"https:\/\/sparkminds.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp\",\"datePublished\":\"2024-12-25T10:50:50+00:00\",\"dateModified\":\"2024-12-26T10:31:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#breadcrumb\"},\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#primaryimage\",\"url\":\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp\",\"contentUrl\":\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp\",\"width\":1024,\"height\":823},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/sparkminds.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Matching Engine using Ring Buffer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/sparkminds.net\/#website\",\"url\":\"https:\/\/sparkminds.net\/\",\"name\":\"SparkMinds\",\"description\":\"A Reliable Software Development Partner\",\"publisher\":{\"@id\":\"https:\/\/sparkminds.net\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/sparkminds.net\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"vi\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/sparkminds.net\/#organization\",\"name\":\"SparkMinds J.S.C\",\"alternateName\":\"SparkMinds\",\"url\":\"https:\/\/sparkminds.net\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/sparkminds.net\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/11\/sticky-logo-menu-sparkmind.png\",\"contentUrl\":\"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/11\/sticky-logo-menu-sparkmind.png\",\"width\":181,\"height\":66,\"caption\":\"SparkMinds J.S.C\"},\"image\":{\"@id\":\"https:\/\/sparkminds.net\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/sparkminds.jsc\",\"https:\/\/www.linkedin.com\/company\/sparkminds-j-s-c\/about\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/sparkminds.net\/#\/schema\/person\/f4769a5d0dd2b458b03580b337c920b8\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/sparkminds.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bdfb7783cd4581a22bc1899273891ef702c5338854739f578d2f5cb72d515f34?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bdfb7783cd4581a22bc1899273891ef702c5338854739f578d2f5cb72d515f34?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/sparkminds.net\"],\"url\":\"https:\/\/sparkminds.net\/vi\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Matching Engine using Ring Buffer","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sparkminds.net\/vi\/matching-engine-using-ring-buffer\/","og_locale":"vi_VN","og_type":"article","og_title":"Matching Engine using Ring Buffer","og_description":"In a crypto, stock, or foreign exchange, speed and efficiency play an important role, especially for matching engines that process [&hellip;]","og_url":"https:\/\/sparkminds.net\/vi\/matching-engine-using-ring-buffer\/","og_site_name":"SparkMinds","article_publisher":"https:\/\/www.facebook.com\/sparkminds.jsc","article_published_time":"2024-12-25T10:50:50+00:00","article_modified_time":"2024-12-26T10:31:11+00:00","og_image":[{"width":1024,"height":823,"url":"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp","type":"image\/webp"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"admin","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"8 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#article","isPartOf":{"@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/"},"author":{"name":"admin","@id":"https:\/\/sparkminds.net\/#\/schema\/person\/f4769a5d0dd2b458b03580b337c920b8"},"headline":"Matching Engine using Ring Buffer","datePublished":"2024-12-25T10:50:50+00:00","dateModified":"2024-12-26T10:31:11+00:00","mainEntityOfPage":{"@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/"},"wordCount":1205,"commentCount":0,"publisher":{"@id":"https:\/\/sparkminds.net\/#organization"},"image":{"@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#primaryimage"},"thumbnailUrl":"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp","articleSection":["Custom Web\/App","General"],"inLanguage":"vi","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/","url":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/","name":"Matching Engine using Ring Buffer","isPartOf":{"@id":"https:\/\/sparkminds.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#primaryimage"},"image":{"@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#primaryimage"},"thumbnailUrl":"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp","datePublished":"2024-12-25T10:50:50+00:00","dateModified":"2024-12-26T10:31:11+00:00","breadcrumb":{"@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#primaryimage","url":"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp","contentUrl":"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/12\/matching-engine-using-ring-buffer-e1735034192816.webp","width":1024,"height":823},{"@type":"BreadcrumbList","@id":"https:\/\/sparkminds.net\/matching-engine-using-ring-buffer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sparkminds.net\/"},{"@type":"ListItem","position":2,"name":"Matching Engine using Ring Buffer"}]},{"@type":"WebSite","@id":"https:\/\/sparkminds.net\/#website","url":"https:\/\/sparkminds.net\/","name":"SparkMinds","description":"A Reliable Software Development Partner","publisher":{"@id":"https:\/\/sparkminds.net\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sparkminds.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/sparkminds.net\/#organization","name":"SparkMinds J.S.C","alternateName":"SparkMinds","url":"https:\/\/sparkminds.net\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/sparkminds.net\/#\/schema\/logo\/image\/","url":"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/11\/sticky-logo-menu-sparkmind.png","contentUrl":"https:\/\/sparkminds.net\/wp-content\/uploads\/2024\/11\/sticky-logo-menu-sparkmind.png","width":181,"height":66,"caption":"SparkMinds J.S.C"},"image":{"@id":"https:\/\/sparkminds.net\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/sparkminds.jsc","https:\/\/www.linkedin.com\/company\/sparkminds-j-s-c\/about\/"]},{"@type":"Person","@id":"https:\/\/sparkminds.net\/#\/schema\/person\/f4769a5d0dd2b458b03580b337c920b8","name":"admin","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/sparkminds.net\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/bdfb7783cd4581a22bc1899273891ef702c5338854739f578d2f5cb72d515f34?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bdfb7783cd4581a22bc1899273891ef702c5338854739f578d2f5cb72d515f34?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/sparkminds.net"],"url":"https:\/\/sparkminds.net\/vi\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/posts\/3242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/comments?post=3242"}],"version-history":[{"count":20,"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/posts\/3242\/revisions"}],"predecessor-version":[{"id":3277,"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/posts\/3242\/revisions\/3277"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/media\/3243"}],"wp:attachment":[{"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/media?parent=3242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/categories?post=3242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sparkminds.net\/vi\/wp-json\/wp\/v2\/tags?post=3242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}