Back to browse
GitHub Repository

Demo algo showing Python with C++ bindings using compile-time reflection

28 starsJupyter Notebook

C++26 Reflection for Python Algo Trading

by tradrich·Feb 22, 2026·1 point·0 comments

AI Analysis

●●SolidWizardryNiche Gem

C++26 reflection kills PyBind11 boilerplate, but only Bloomberg Clang supports it today.

Strengths
  • Genuinely clever: compile-time reflection eliminates binding sync tax
  • Uses cutting-edge C++26 P2996 standard in practical context
  • Merton model gives real-world math complexity without claiming novel alpha
Weaknesses
  • Requires Bloomberg Clang fork—not standard toolchain, limits adoption
  • Niche audience (quants); ecosystem won't converge on C++26 reflection for years
Target Audience

C++/Python quant developers, algorithmic trading engineers, high-performance computing practitioners

Similar To

PyBind11 · CFFI · Boost.Python

Post Description

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

Similar Projects