Skip to content

Repository files navigation

CMF Advanced Backtesting Engine for Options

Directory structure

.
├── 3rdparty                    # place holder for 3rd party libraries (downloaded during the build)
├── build                       # local build tree used by CMake
├    ├── bin                    # generated binaries
├    ├── lib                    # generated libs (including those, which are built from 3rd party sources)
├    ├── cfg                    # generated config files (if any)
├    └── include                # generated include files (installed during the build for 3rd party sources)
├── cmake                       # cmake helper scripts
├── config                      # example config files
├── scripts                     # shell (and other) maintenance scripts
├── src                         # source files
├    ├── common                 # common utility files
├    ├── ...                    # ...
├    └── main                   # main() for back-tester app
├── test                        # unit-tests and other tests
├── CMakeLists.txt              # main build script
└── README.md                   # this README

OS

Our primary platform is Linux, but nothing prevents it to be built and run on other OS. The following commands are for Linux users. Other users are encouraged to add the corresponding instructions for required steps in this README.

Build

Install dependencies once:

sudo apt install -y cmake g++ clang-format

Build using cmake:

cmake -B build -S .
cmake --build build -j

or

mkdir -p build
pushd build
cmake ..
make -j VERBOSE=1
popd

Test

To run unit tests:

ctest --test-dir build -j

or

pushd build
ctest -j
popd

or

build/bin/test/back-tester-tests

Run

Back-tester:

build/bin/back-tester

Data Processing

Convert market data to Feather format

The convert_to_feather.py script converts JSON market data files (.mbo.json format) to the efficient Apache Feather columnar format, which is optimized for fast I/O and analysis:

uv run scripts/convert_to_feather.py <path_to_data_directory>

Replace <path_to_data_directory> with the directory containing your .mbo.json files. The script will process all JSON files in the directory and generate corresponding .mbo.json.feather files.

Example:

uv run scripts/convert_to_feather.py ./data/market_data/

Contributing

Install UV, create a virtual environment, and install the project dependencies:

curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync

Then activate the virtual environment and set up the git pre-commit hooks:

source .venv/bin/activate
pre-commit install

After that, formatting and linting will run automatically before each commit. If the source code does not meet the required formatting rules, the hook will modify the files and stop the commit, and you will need to stage the updated changes manually.

To run formatting and linting yourself, use one of these commands:

pre-commit run --files file.py
pre-commit run --all-files

The current pre-commit hooks do the following:

  • format and lint C++ code with clang-format;
  • format and lint Python code with ruff;
  • strip outputs from Jupyter notebooks.

About

Back-tester targeted primarily for options developed as part of CMF Advanced Quantitative Analytics Program in 2026

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages