Benthic - An Exchange in Rust (Matching Engine w/ Margin)
Sonia: Code & Skate | Play
0:00 / 0:00
Benthic - An Exchange in Rust (Matching Engine w/ Margin)
973 просмотра · 1 год назад
Sonia: Code & Skate | Play
1,3 тыс. подписчиков
973 просмотра · 1 год назад
C++ vs Rust Returns! 🚨 Deep Dive into Crypto Exchange Order Execution & Lot Management in Rust (Featuring the Margin Component) 🦀💹
The battle of the titans continues! Following up on our "C++ vs Rust" series, we're diving deep into a real-world application: the core of a cryptocurrency exchange built with Rust.
In this video, we meticulously explore the Rust code that drives crucial functionalities, including a look at the Margin Component:
Order Matching: See how buy and sell orders are efficiently paired.
Margin Component: We'll walk through the design and role of the margin component within the exchange architecture.
Real-time Account Updates: Witness how trader balances and asset positions are instantly updated.
Detailed Lot Management: We'll trace the lifecycle of open and closed lots within trader subaccounts.
"Inflight Lot" Handling: Learn how newly executed trades generate "inflight lots" and how they are matched against existing positions.
We'll walk through a practical trading scenario and then dissect the underlying Rust code, demonstrating these concepts in action, including the structure of the margin component. You'll also see how this high-performance system efficiently handles decimal numbers using u64.
🔗 Links:
C++ vs Rust - Season 1: • C++ vs Rust - Season 1 (NodeGraph Example)
GitHub Repository (Rust Code): https://github.com/sadhbh-c0d3/benthic
⏱️ Chapters:
00:00:00 - How does the trading app work?
00:01:13 - Walk-through example trading scenario
00:17:07 - Architecture of the Trading Exchange
00:20:33 - Let's look into the code!
00:29:25 - Order Execution
00:36:11 - Abstracting Order-Matching at Zero-Cost
00:41:13 - Order Book Diagram
00:45:09 - Updating Accounts
00:52:33 - Decimal multiplication with Polynomial Decomposition
00:54:13 - Order Delivery
00:57:30 - Storing Transaction Lots
01:05:07 - Thank you!
💬 What are your thoughts on the design and implementation of margin components in high-performance trading systems? Share your insights in the comments below! 👇
👍 Like, Subscribe, and hit the notification bell for more in-depth Rust and C++ content!
#rustlang #cryptotrading #algotrading #programming #rustcoding #coding #cpp #ordermatching #lotmanagement #fintech #margin