Skip to main content
Promotion is the process of taking a strategy that has been written, verified, and backtested in Python and compiling it into the C++20 core that powers the QuanuX spreader. The pipeline moves through three stages: Python prototype, Cython bridge, and native C++ execution logic. Each stage produces a verifiable artifact, and no stage can be skipped. This page explains how each stage works, what the Foundry generates at each step, and what you need to have in place before C++ promotion becomes available.

The three-stage pipeline

Python — Your strategy lives in server/strategies/ and inherits from the StrategyComponent base classes. This is the research layer. It has full access to pandas, numpy, and the broader Python data science ecosystem. Cython — The Foundry generates a .pyx file with typed C++ declarations and a PyStrategyWrapper class that bridges Python calls into the C++ InjectionStub interface. The Cython extension compiles into a shared object that Crucible loads directly. This is the current stable promotion target. C++ — The Foundry generates a native C++20 header and implementation conforming to the spreader’s InjectionStub contract. The compiled artifact runs inside the spreader’s Core 3 execution thread with no Python interpreter in the path. This target is in active development.
C++ generation via target_lang=cpp is in active development and not yet recommended for production use. Use target_lang=cython for stable, high-performance execution. Python and Cython targets are fully supported.

Anaconda environment management

QuanuX is the first quantitative trading platform to offer an official Conda channel. Anaconda is the recommended way to manage the boundary between Python research and C++ execution, because it lets you maintain separate, tightly controlled environments for each stage without dependency conflicts. Install QuanuX into Conda:
When you are iterating on strategy logic, work in a Conda environment that includes your full Python data science stack. When you are ready to compile a Cython extension or run Crucible, activate the QuanuX execution environment where the build toolchain and C++ headers are available. The Anaconda Synapse integration in QuanuX ensures the correct environment is selected automatically when you invoke quanuxctl.

Submitting a forge request targeting C++

The Foundry forge request is the same regardless of target_lang. The following example requests a C++ artifact for a spread strategy:
Response
The Foundry generates a C++20 header conforming to the InjectionStub interface. The generated calculate method maps directly onto the CLZ4_CLF5_Spread.json logic gates:
CLZ4_CLF5_Spread_injected.hpp (generated)
The corresponding Cython wrapper in server/spreader-strategies/CLZ4_CLF5_Spread_wrapper.pyx exposes this to Python for Crucible backtesting:
CLZ4_CLF5_Spread_wrapper.pyx

Git-as-Governance requirement

Before any strategy can be loaded by the live spreader, the following conditions must all be true:
  1. The strategy artifact (.hpp, .pyx, or .py) is committed to the repository.
  2. The commit is cryptographically signed (git commit -S).
  3. The SHA-256 of the artifact on disk matches the hash recorded in the signed commit.
If any condition is not met, the spreader rejects the strategy at load time with a STATE_HALT signal. This is a hard rule enforced by the Ritchie FSM — it cannot be bypassed.
Never edit a generated artifact after committing it. Any modification changes the SHA-256 and will cause the spreader to halt. If the generated code needs changes, submit a new forge request and go through verification and backtesting again before committing.

Promotion checklist

Before promoting a strategy to the live spreader, confirm each of the following:
  • Python strategy passes unit tests in server/strategies/
  • Foundry forge request completed (job_id returned accepted)
  • POST /api/foundry/verify confirms equivalence between Python and generated code
  • Crucible backtest passes with acceptable MAE, MFE, and latency slippage metrics
  • All generated artifacts committed with a signed commit
  • SHA-256 of artifacts on disk matches the signed commit hash