Skip to content

Building

slick-trader is a CMake project. A normal build gives you the engine, the example strategy plugins and the test binary.

Requirements

Item Requirement
CMake 3.28 or later (cmake_minimum_required(VERSION 3.28))
C++ standard C++23, no compiler extensions
Windows Visual Studio 2022 (MSVC). CI uses the runner's default toolset
Linux GCC 14. CI sets gcc-14 and g++-14 explicitly, because the runner's default GCC 13 falls short of C++23
macOS Apple clang from a current Xcode (CI uses the runner's default, on arm64)
Package manager vcpkg in classic mode. The repository has no vcpkg.json on purpose

Plugin libraries are .dll, .so and .dylib respectively. The whole build is position-independent (CMAKE_POSITION_INDEPENDENT_CODE ON) because plugins link slick-trader-core statically. On MSVC the build defines _WIN32_WINNT=0x0601. DEBUG is defined when CMAKE_BUILD_TYPE matches Debug and NDEBUG when it matches Release, which only happens for single-config generators.

Dependencies

Each dependency is looked up as an installed package first. Where there is a minimum version, a miss means CMake fetches that version with FetchContent.

Dependency Minimum Resolution
unofficial-uwebsockets none find_package(... CONFIG REQUIRED). Install uwebsockets[core,ssl,zlib] with vcpkg
nlohmann_json none find_package(... REQUIRED)
slick-logger 2.4.0 Package, else fetched at tag v2.4.0
slick-orderbook 1.1.0 Package, else fetched at tag v1.1.0. No vcpkg port exists
slick-socket 1.4.0 Package, else a source tree at SLICK_TRADER_SLICK_SOCKET_DIR (default ../slick-socket), else fetched at v1.4.0 from SLICK_TRADER_SLICK_SOCKET_GIT_REPOSITORY
slick-queue, slick-shm, slick-stream-buffer, slick-stream-buffer-multiplexer, slick-dynamic_buffer none find_package(... CONFIG QUIET). They normally arrive with the broker SDKs. With no broker built, install them yourself
slick-net by the SDKs find_package(slick-net CONFIG REQUIRED), but only when an enabled broker calls slick_trader_use_slick_net()
coinbase-advanced-cpp 2.1.1 Looked up only when SLICK_TRADER_ENABLE_COINBASE is ON. Package, else fetched at v2.1.1
hyperliquid (hyperliquid-cpp) 0.4.2 Looked up only when SLICK_TRADER_ENABLE_HYPERLIQUID is ON. Package, else fetched at v0.4.2
slick-stacker 0.2.0 Only for the order_stacker plugin, so only when SLICK_TRADER_BUILD_STRATEGIES is ON. Package, else fetched at v0.2.0. No vcpkg port
GTest none find_package(GTest CONFIG REQUIRED) in tests/, only when SLICK_TRADER_BUILD_TESTS is ON
Python3, Lua 5.4 none Optional. See the options table
Doxygen, Graphviz none Optional, for the docs target

The vcpkg packages CI installs are the working list:

vcpkg install nlohmann-json gtest slick-logger slick-net slick-queue slick-shm slick-socket \
  slick-stream-buffer slick-stream-buffer-multiplexer slick-dynamic-buffer \
  coinbase-advanced-cpp slickquant-hyperliquid-cpp "uwebsockets[core,ssl,zlib]"

Release builds of the SlickQuant libraries use -march=native

A vcpkg binary cache restored onto a CPU with a narrower instruction set dies with SIGILL. Key any cache on the CPU features and the compiler, as ci.yml does.

Configure and build

<vcpkg> is your vcpkg checkout. The same two commands work on every platform.

cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=<vcpkg>/scripts/buildsystems/vcpkg.cmake
cmake --build build --config Release --parallel 8

On Linux and macOS also pass -DCMAKE_BUILD_TYPE=Release (or Debug) at configure time, since those are single-config generators. On Linux add -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 when GCC 14 is not your default. Give --parallel a number. A bare --parallel becomes an unlimited make -j and has run CI out of memory.

On Windows the default generator is the Visual Studio one, so --config picks Debug or Release and the outputs land in a per-config folder. To use Ninja, configure with -G Ninja from a shell that has the MSVC environment (vcvars64.bat or a Developer prompt), and pass -DCMAKE_BUILD_TYPE instead of --config.

Output Single-config (Linux, macOS, Ninja) Visual Studio
Engine build/src/slick-trader build/src/<Config>/slick-trader.exe
Strategy plugins build/strategies/*.so or *.dylib build/strategies/<Config>/*.dll
Tests build/tests/slick-trader-tests build/tests/<Config>/slick-trader-tests.exe

cmake --install build installs the engine to bin, the headers to include/slick-trader and the dashboard to share/slick-trader/web.

Options

Option Default Effect
SLICK_TRADER_BUILD_STRATEGIES ON at top level, OFF as a subproject Build the example plugins market_maker and order_stacker. OFF also skips fetching slick-stacker. The engine does not link plugins, it loads them at runtime
SLICK_TRADER_BUILD_TESTS ON at top level, OFF as a subproject Build slick-trader-tests and its two test plugins. Needs GTest
SLICK_TRADER_ENABLE_COINBASE ON Build the Coinbase broker. OFF skips its SDK lookup too
SLICK_TRADER_ENABLE_HYPERLIQUID ON Build the Hyperliquid broker. OFF skips its SDK lookup too
SLICK_TRADER_EXTERNAL_BROKERS empty ;-separated directories of out-of-tree brokers. See Out-of-tree brokers
SLICK_TRADER_SANITIZER empty address,undefined or thread. GCC and Clang only. See Sanitizer builds
SLICK_TRADER_DISABLE_CXX_MODULE_SCAN ON Skip C++ module dependency scanning, which speeds up MSVC builds
SLICK_TRADER_FAST_FETCHCONTENT ON Set FETCHCONTENT_UPDATES_DISCONNECTED for the fetched dependencies, so a configure does not contact the remote
SLICK_TRADER_SUPPRESS_VS_REGEN ON With a Visual Studio generator, set CMAKE_SUPPRESS_REGENERATION to avoid the ZERO_CHECK re-check on each build
SLICK_TRADER_ENABLE_PYTHON_STRATEGY ON Look for Python3 development files and define SLICK_TRADER_PYTHON_SUPPORT. Nothing in the code reads that define yet
SLICK_TRADER_ENABLE_LUA_STRATEGY OFF The same for Lua 5.4 and SLICK_TRADER_LUA_SUPPORT
SLICK_TRADER_SLICK_SOCKET_DIR ../slick-socket Source tree used when no installed slick-socket 1.4.0 is found
SLICK_TRADER_SLICK_SOCKET_GIT_REPOSITORY the SlickQuant repository Where to fetch slick-socket from when neither a package nor a tree is found

Brokers

Each broker is an OBJECT library under src/brokers/<name>/, declared with slick_trader_add_broker() from cmake/slick_trader_broker.cmake.

slick_trader_add_broker(coinbase
    SOURCES coinbase_broker.cpp coinbase_md_connector.cpp coinbase_order_connector.cpp
    DEPENDS slick::coinbase-advanced-cpp
    TESTS   ${CMAKE_SOURCE_DIR}/tests/test_coinbase_trades.cpp)

DEPENDS is linked publicly, so the SDK reaches both slick-trader and slick-trader-tests. TESTS are compiled into the test binary, which is how a broker's suite travels with it. The target is an OBJECT library so the linker keeps the namespace-scope SLICK_TRADER_REGISTER_BROKER("coinbase", CoinbaseBroker) initializer. From a static library it would drop that object and the broker would silently vanish from the registry. slick_trader_link_brokers(target) links every enabled broker into the engine and the test binary, so the two cannot differ.

Configure prints slick-trader brokers: <list> (or none). CI greps that line, so a misspelled option cannot pass by building the defaults. A broker the binary lacks fails startup when a config enables it. See Configuration.

Out-of-tree brokers

A broker kept in its own repository calls slick_trader_add_broker() from its own CMakeLists.txt and is built in by pointing the configure step at it. No file in this repository changes.

cmake -S . -B build "-DSLICK_TRADER_EXTERNAL_BROKERS=/path/to/broker-a;/path/to/broker-b"

Quote the whole argument. Bash and PowerShell read a bare ; as the end of the command. Configure prints each directory as it adds it, the brokers it registered and its own project() version. A directory that registers nothing gets a warning, and a directory with no CMakeLists.txt is a fatal error. Keep the setting in a git-ignored CMakeUserPresets.json so a local path never reaches the repository.

Two helpers serve brokers that share wire layouts with a simulator. slick_trader_find_codec() finds a codec library as a package, then a sibling source tree, then a git fetch. slick_trader_require_slick_socket() guarantees slick-socket at a minimum version and refuses a broker that needs a later one than the engine took. See Adding a broker.

Sanitizer builds

cmake -S . -B build-asan -DCMAKE_BUILD_TYPE=Debug \
  -DSLICK_TRADER_SANITIZER=address,undefined \
  -DCMAKE_TOOLCHAIN_FILE=<vcpkg>/scripts/buildsystems/vcpkg.cmake
cmake --build build-asan --parallel 8
ctest --test-dir build-asan --output-on-failure

address,undefined is ASan with UBSan. thread is TSan, which cannot share a build with ASan. The flags apply to every target from that point on, fetched dependencies and strategy plugins included, and in every build type, so a configure never quietly gives an unsanitized build. MSVC is refused with a fatal error. Plugins share the engine's runtime, which is why they are instrumented too. Use a separate build directory per sanitizer. The options CI sets are in CI workflows.

Building these docs

The narrative docs are MkDocs Material. The C++ reference is Doxygen. CI builds both and publishes them as one site.

pip install -r requirements-docs.txt
mkdocs serve              # live preview on http://127.0.0.1:8000
mkdocs build --strict     # site/, fails on a broken link or anchor

mkdocs serve does not show the API reference, because the nav entry is the published URL https://slickquant.github.io/slick-trader/api/. To build that part:

cmake --build build --target docs   # needs Doxygen at configure time, output in doxygen-out/html

The docs target is a local convenience. CI skips it so the docs job needs no vcpkg and no configure. It stamps the version from CMakeLists.txt into Doxyfile.in. Doxygen reads include/slick-trader and src/ (tests and web/static are excluded) and uses Graphviz for diagrams.

CI workflows

All four live in .github/workflows/.

Workflow Triggers What it does and asserts
ci.yml Push and pull request to master build-and-test: Ubuntu, Windows and macOS, each Debug and Release (six jobs, fail-fast: false). Installs the vcpkg packages above, builds, runs ctest. The Release jobs stage the engine, plugins and shared libraries as slick-trader-<OS>-release artifacts. broker-options: Ubuntu Debug with no brokers, Coinbase only and Hyperliquid only. Each installs only its own SDK, asserts the slick-trader brokers: line, builds and runs the tests. The no-broker job also runs the engine on config_example.json and asserts a non-zero exit and No broker adapter for 'coinbase' in the log
sanitizers.yml Push and pull request to master, manual Ubuntu, GCC 14, Debug, one job for ASan with UBSan and one for TSan, 90-minute ceiling. Lowers vm.mmap_rnd_bits to 28 for the sanitizer runtimes. Checks with nm that the sanitizer runtime is in the test binary, then runs ctest with halt_on_error for UBSan and TSan so a finding fails the job
documentation.yml Push and pull request to master touching include/, src/, strategies/, docs/, mkdocs.yml, Doxyfile.in, requirements-docs.txt or a root *.md, plus manual build-docs: mkdocs build --strict, Doxygen, combines them into site/ with the API under site/api/, uploads it, and deploys to GitHub Pages on master pushes. check-links: markdown-link-check. markdown-lint: .markdownlint.json over README.md, CHANGELOG.md and docs/*.md
release.yml Tags matching v* See below

Versioning and releases

The version lives in one place, the root project(SlickTrader VERSION x.y.z). It becomes the SLICK_TRADER_VERSION compile definition (the startup banner and GET /api/health report it) and the Doxygen project number. The docs workflow reads it with sed from the same line.

To release:

  1. Bump the version in CMakeLists.txt and add a # vX.Y.Z - MM-DD-YYYY section at the top of CHANGELOG.md.
  2. Merge to master and wait for ci.yml to pass on that commit.
  3. Tag the commit vX.Y.Z and push the tag.

release.yml does not rebuild. It finds the successful ci.yml run for the tagged commit (it fails if there is none) and downloads the three Release artifacts from it. It then packs each into a folder with the engine, strategies/, web/static/, a config/config_example.json whose plugin folder is rewritten to strategies, plus README.md, LICENSE and CHANGELOG.md. The archives are slick-trader-<version>-windows-x64.zip, slick-trader-<version>-linux-x64.tar.gz and slick-trader-<version>-macos-arm64.tar.gz.

The release notes are the CHANGELOG.md section whose header starts with the tag, for example # v0.11.0, up to the next top-level header, with leading and trailing blank lines trimmed. With no such section the body says No changelog entry found for this version. The release is created as a draft, so publish it by hand after checking the notes.