Show HN: C++26 Reflection for Python Algo Trading

  • Posted 5 hours ago by tradrich
  • 1 points
https://github.com/profitviews/merton-market-maker
There’s a constant tension in quant dev between speed-to-market (Python) and speed-to-book (C++). We've had bridges like PyBind11 [1] for years, but the manual boilerplate is usually too high a tax to use them for daily work.

With the C++26 Reflection (P2996) [2], that bridge can now be made invisible. That's the new syntax: ^^T and [: x :] .

I built this repo to show how you can use the Bloomberg/Clang P2996 fork [3] to automatically reflect a C++ quant engine into a Python execution loop. I used Merton Jump Diffusion [4] as the shell - it’s a standard model (with no special alpha) - to show the tech in a real-world context. I initially found out this was working from Callum Piper's ACCU talk [5].

I've included a justfile and Docker Clang build so people can experiment with the new reflection syntax without having to battle through the build tedium.

1. https://github.com/pybind/pybind11 2. https://isocpp.org/files/papers/P2996R13.html 3. https://github.com/bloomberg/clang-p2996 4. Merton, R.C. (1976). Option pricing when underlying stock returns are discontinuous. Journal of Financial Economics, 3(1–2), 125–144. 4. 5. https://youtu.be/SJ0NFLpR9vE

0 comments