Bazartalks_Py2Cplus (BazaarTalks-cpp) reimplements the storage, streaming, quant-compute, backtest and serving layers of BazaarTalks in C++, keeping Python only for data acquisition and ML training. This post is a not-run, README-based guide to building it, plus the benchmark the repo itself committed. Not investment advice.
Open-Source Tools · How-To · Markets research
How to use Bazartalks_Py2Cplus: a C++ port of a quant research platform, with its Python-vs-C++ benchmark
Revised
· v1.0.0 · what changed
Code: github.com/herrrickshaw/Bazartalks_Py2Cplus
Watch the walkthrough
Watch on YouTube: youtu.be/XDJQyJeFakw
Why it is useful
- Who benefits: engineers porting a Python research stack to C++ who want a worked example with a validation strategy, golden-fixture tests and a candid benchmark.
- What it replaces: guessing whether a rewrite is worth it; the repo documents a measured 5.94x speedup on one pipeline and, just as usefully, the benchmarking mistake that first made C++ look 40% slower.
- Evidence (from the repo's committed report, not re-run by me): 19 of 19 markets matched the Python original exactly, and the release build took 1.60 s against 9.52 s for Python.
- Honest scope: the build and benchmark were not run for this post, because the dependency stack (vcpkg, DuckDB, Arrow, Drogon, librdkafka) is a long build.
What it is for
BazaarTalks-cpp is a hybrid rewrite. Libraries for the trading calendar, cross-sectional statistics, linear algebra (Eigen), storage clients (DuckDB, Cassandra, SQLite, Parquet), Kafka streaming, an HTTP client and server, and quant-core modules (risk, cost, factor, DVM scoring, backtest) are in C++. Services such as stream consumers, a serve API and a pipeline CLI sit on top.
Components with no mature C++ equivalent, such as yfinance and exchange scrapers, browser-driven data access and scikit-learn model training, stay in python-sidecar/ by design.
Each C++ module is validated against golden fixtures generated from the unmodified Python originals, with the reference command recorded in each test file's header.
I did not build the project or run the benchmark. The build needs vcpkg and heavy dependencies, and the benchmark needs the author's production data layout, which is not in the repo. Everything quantitative below is quoted from the repo's committed report and migration plan.
Who it is for
- C++ and Python engineers planning a hybrid rewrite of a data-heavy pipeline
- Readers who want a worked example of golden-fixture validation and honest benchmarking
- Quant developers who want native DuckDB and Arrow code for factor and backtest work
- Investment advice or trading signals. Not investment advice.
- A quick install: the first build compiles a large dependency tree through vcpkg
- Reproducing the benchmark without the BazaarTalks data layout it expects
What you need
| Requirement | Why | How to get it |
|---|---|---|
| A C++ toolchain, CMake and Ninja | CMake presets drive the build | brew install cmake ninja (macOS) plus a compiler |
| vcpkg | installs the dependencies in vcpkg.json: Eigen, date, Catch2, nlohmann-json, SQLite, DuckDB, librdkafka, Arrow with Parquet, Drogon and databento-cpp | git clone --depth 1 https://github.com/microsoft/vcpkg.git, then bootstrap |
| Python 3 | for the python-sidecar and the benchmark driver scripts | python.org or brew |
| Time and disk | a source build of DuckDB, Arrow and Drogon is long | plan for a long first build; I did not attempt it |
Get the code and an AI assistant
You do not have to be a programmer. Get the repository, give it to an AI assistant, and ask in plain language. Any of these routes works:
| Tool | What you need | Best for |
|---|---|---|
| GitHub | Free account to fork or star; git to clone, or the green Code button, then Download ZIP, or open in Codespaces | Getting the code and keeping up with updates |
| Claude Code | Claude subscription or API key; run claude inside the cloned folder | Letting the AI read and run the whole repo |
| Gemini CLI | Google account; run gemini inside the cloned folder | The same hands-on workflow with Gemini |
| Claude.ai, Gemini or ChatGPT in the browser | A chat account; upload README.md and the files you care about (or paste the output of git ls-files) | Understanding the project and asking questions without installing anything |
| Other tools (Copilot Chat, Cursor, Codex CLI) | Open the cloned folder in the tool and point it at README.md first | Editing and extending the code |
git clone https://github.com/herrrickshaw/Bazartalks_Py2Cplus.git
cd Bazartalks_Py2Cplus
claude # or: gemini
Install
- Clone the repo and bootstrap vcpkg.
git clone https://github.com/herrrickshaw/Bazartalks_Py2Cplus.git cd Bazartalks_Py2Cplus git clone --depth 1 https://github.com/microsoft/vcpkg.git ./vcpkg/bootstrap-vcpkg.sh -disableMetrics - Configure and build with the release preset for anything timing-sensitive.
cmake --preset release cmake --build --preset release ctest --preset release
Quick start: commands and what you should see
Build and test (README instructions, not run here).
cmake --preset debug
cmake --build --preset debug
ctest --preset debug
Not run. The migration plan says 207 of 207 tests were passing at the time of its last build note.
Run the Python-vs-C++ benchmark drivers (not run here).
python3 benchmarks/pipeline_cutover/bench_python.py
python3 benchmarks/pipeline_cutover/bench_cpp.py
Not run. Both emit timing and output as JSON and expect the author's data paths, overridable via BAZAARTALKS_REPO, BAZAARTALKS_OHLC_SEED and BAZAARTALKS_CPP_BIN.
Open the committed comparison report.
open benchmarks/pipeline_cutover/report_2026-07-12.html
A rendered per-market table of Python and C++ timings plus the correction note.
Sample outputs
Real output from a run on the date shown in the sources line; trimmed to fit.
Per-market speedup, C++ release vs Python (quoted from the committed report of 12 July 2026; not re-run)
benchmarks/pipeline_cutover/report_2026-07-12.html
Market Python(s) C++ release(s) Speedup
US 0.4527 0.0730 6.20x
JP 0.4384 0.0684 6.41x
UK 0.5015 0.0754 6.65x
EU 0.5229 0.0671 7.79x
SG 0.4690 0.1184 3.96x
(19 markets in total)
Grand total: Python 9.52s vs C++ 1.60s = 5.94x
Five of nineteen rows shown. Each analyze call is a fresh process, so startup cost matters, and the authors' machine and data are not reproducible from the repo alone.
The correction that matters
docs/MIGRATION_PLAN.md, Cutover run #4
debug build (-O0, 126MB binary): bare startup ~0.28s; total C++ 12.29s vs Python 8.79s (C++ 40% slower)
release build (43MB binary): bare startup ~0.01s; total C++ 1.60s vs Python 9.52s (5.94x faster)
Accuracy: 19/19 markets exact match in both runs
The slowdown was a benchmarking bug (a debug build), not slow code. The repo records the rule: never benchmark or deploy a debug build.
Ways to use it
| Method | How it works |
|---|---|
| Read the migration plan | docs/MIGRATION_PLAN.md covers the phases, the Python boundary decision and the validation strategy. |
| Study the golden-fixture tests | Each test file header gives the Python command used to generate its reference values. |
| Build individual libraries | libs/calendar, stats and linalg are the Phase 1 pieces with the lightest dependencies. |
| Adapt the benchmark drivers | Point the environment variables at your own data to compare a Python and a C++ pipeline. |
| Via an AI assistant | Ask an assistant to map the layers and explain the boundary between C++ and the Python sidecar before you build. |
Sample prompts for your AI assistant
Copy, paste and edit the parts in [brackets].
- Read README.md and docs/MIGRATION_PLAN.md and explain which parts of BazaarTalks were ported to C++ and which stay in Python, and why.
- Explain the Cutover run #4 benchmark mistake in plain English and write a checklist for avoiding it in my own benchmarks.
- Show how a golden-fixture test in this repo is generated from the Python original and how I would add one for a new function.
- Help me build only libs/calendar and libs/stats on my machine and list the exact dependencies those need.
- What does scripts/check_layering.py enforce, and how would I extend it for my own modules?
- List what I would need to reproduce the 19-market benchmark with my own data, using the bench_* scripts.
Limits and honest caveats
- Not investment advice. This is infrastructure and research code.
- I did not build the project, run the tests or run the benchmark. All figures are quoted from the repo's committed report and migration plan (report dated 12 July 2026) and are unverified by me.
- The benchmark data and layout are the author's own; the benchmark cannot be reproduced from the repo alone.
- Debug-build timings are misleading; always use the release preset, as the README warns.
- The Python sidecar needs network scrapers and sometimes paid-account access; those are outside this guide.
Sources: README, docs/MIGRATION_PLAN.md, benchmarks/pipeline_cutover and vcpkg.json in github.com/herrrickshaw/Bazartalks_Py2Cplus, read on 19 October 2026. Nothing was built or executed; timing figures are quoted from the repo's committed report.
- v1.0.0 — 22 October 2026 — first published.
About this article: Researched, written and edited by Umashankar Triplicane Dwarakanathan, with AI research assistance; every figure is meant to trace to the primary source cited. See the Editorial Policy for how sourcing, AI use and corrections work.