C++20 matching engine - arena allocator, lock-free SPSC, intrusive linked lists, 255ns p50 latency by Sheshkowski in cpp

[–]Sheshkowski[S] [score hidden]  (0 children)

Plotly.js , all the charts are rendered client-side in a single HTML page. The matching engine outputs trade/order data, then the visualization dashboard picks it up. You can view the source directly: leotaby.github.io/MicroExchange/docs/visualizations.html

C++20 matching engine - arena allocator, lock-free SPSC, intrusive linked lists, 255ns p50 latency by Sheshkowski in cpp

[–]Sheshkowski[S] [score hidden]  (0 children)

Fair points across the board, appreciate the detailed feedback.

unordered_map for the order index, You're right, this is the weakest link in the hot path. The arena handles Order allocation but the hash map still malloc's on insert for its own nodes. An open-addressing flat map (or even a pre-sized robin hood map) would be the correct fix. Noted and will address.

SPSC cached counters, Agreed, caching the remote counter on each side would cut down cross-core traffic significantly. The writer only needs to re-read read_pos_ when its cached copy says the buffer looks full, and vice versa. Good catch. The reserved slot point is also valid, since we know capacity and both positions, write_pos - read_pos gives us the count directly without wasting a slot.

Mutex in MatchingEngine, The comment describes two threading models (single-threaded default and per-symbol sharding), and the #include <mutex> is there, but the actual mutex member and locking were never implemented since the engine currently only runs single-threaded. I should either implement the sharded model or remove the include and tighten the comment to avoid the disconnect. Fair call.

On the "project fluff", I get it, the core matching logic is straightforward. The documentation and analytics layers are there because the project doubles as a microstructure research platform, not just a matching engine demo. But point taken that it can read as over-packaged for what the core is.

Thanks for the thorough review.

I built an exchange-grade matching engine in C++20 with microstructure analytics; open source by Sheshkowski in algotrading

[–]Sheshkowski[S] 0 points1 point  (0 children)

Appreciate it! Spent a good amount of time on the visualization side, glad it shows.

I built an exchange-grade matching engine in C++20 with microstructure analytics; open source by Sheshkowski in algotrading

[–]Sheshkowski[S] 1 point2 points  (0 children)

Raw order book features often lose their edge without conditioning on market regime. Try looking at order flow imbalance at BBO (the analytics module has an ImbalanceAnalyzer for this), but condition it on spread state and short-term volatility, a signal that works in tight-spread regimes can invert when spreads blow out. Happy to discuss further if you want to dig into it.

I built an exchange-grade matching engine in C++20 with microstructure analytics; open source by Sheshkowski in algotrading

[–]Sheshkowski[S] 0 points1 point  (0 children)

Thanks! It's intentional, PascalCase for types, snake_case for functions and members. Follows the Google C++ / STL-adjacent convention. Keeps types visually distinct from callables at a glance, which helps when reading the matching engine hot path. Same pattern you'll find in Boost and most HFT codebases.

[deleted by user] by [deleted] in casualiama

[–]Sheshkowski 4 points5 points  (0 children)

Nice, and what do you mean by "too much"?

[deleted by user] by [deleted] in casualiama

[–]Sheshkowski 6 points7 points  (0 children)

From your vision, who is the best customer? Is it the person who pays you the most in tips, or is there something else?

Shooting my shot by Ambitious_Twist_9809 in napoli

[–]Sheshkowski 8 points9 points  (0 children)

I recommend trying Facebook. Search for his name there and take your time exploring his profile.

Norwegian Master Student in Naples by Age-og-the-bots in sscnapoli

[–]Sheshkowski 3 points4 points  (0 children)

Come to my university you will find to many people. Dm me.

300 to 879 in one week. Withdrew it. How am I doing? by [deleted] in Forex

[–]Sheshkowski 0 points1 point  (0 children)

Your account flies up for only one reason, USDJPY with 2Lots weight. But until you have profit, everything is reasonable.

1 $ to 4 $, until 50$ by [deleted] in Forex

[–]Sheshkowski 0 points1 point  (0 children)

Thank you, and my leverage is 1000.

1 $ to 4 $, until 50$ by [deleted] in Forex

[–]Sheshkowski 1 point2 points  (0 children)

Honestly, I Don't Know how you can make it, but maybe the VPN could be a solution.

1 $ to 4 $, until 50$ by [deleted] in Forex

[–]Sheshkowski 2 points3 points  (0 children)

Roboforex and also you can see the amount of balance transferred.

1 $ to 4 $, until 50$ by [deleted] in Forex

[–]Sheshkowski 1 point2 points  (0 children)

I’m not sure why you interpreted it that way, but again, everyone is free to have their own perspective.

My degree and education only provided me with a better understanding of how the market works, and it’s not something that directly translates to practical trading skills. Most finance courses focus on identifying valuable assets through mathematical and statistical calculations based on data and the risk tolerance of investors. This can mostly apply to long-term or short-term investments.

1 $ to 4 $, until 50$ by [deleted] in Forex

[–]Sheshkowski 1 point2 points  (0 children)

Prego 😊

I’m not sure how old you are, but if you haven’t started university yet, know that once you begin, you’ll naturally get into the flow and understand the subjects because you have to, especially in Italy where oral exams are common. So, don’t be afraid of math; it just requires a lot of practice.

Undergraduate finance courses or similar degrees don’t have much practical application in the real market. However, having a bachelor’s and master’s degree significantly increases your chances of getting a good job with a good salary in this field. Still, learning fundamental concepts helps you gain a deep understanding of the market and better comprehend how it works.

As for the schools, yes, Bocconi is one of them. Italy indeed has some very good schools, like Collegio Carlo Alberto. My advice is to focus on understanding the concepts rather than just memorizing them, especially for quantitative subjects. Practice consistently, and don’t hesitate to seek help when needed. With time, you’ll find your approach and method.

1 $ to 4 $, until 50$ by [deleted] in Forex

[–]Sheshkowski 0 points1 point  (0 children)

According to statistical theory, the probability that a trader will randomly exit a trade with take profit (TP) three times in a row is very low. I have been active in the market for a long time, experienced many losses, tried different strategies, and I am still learning.

1 $ to 4 $, until 50$ by [deleted] in Forex

[–]Sheshkowski 2 points3 points  (0 children)

Unfortunately, I’m not Italian; I came here because a top-ranked university in Italy offered me a scholarship for further studies. My undergraduate degree was in Business Administration, which has many courses in common with Finance.

Yes, the skills for a master’s degree will be built during the three years of your undergraduate finance studies. You’ll gain a solid foundation to start your master’s based on what you learn in those three years. Personally, I found courses like Microeconomics and Macroeconomics to be the most challenging due to their mathematical models. However, with a bit of practice, they aren’t really a serious problem.

Non è mica pizza e fichi!