SkillAgentSearch skills...

Ccapi

A header-only C++ library for interacting with crypto exchanges. Bindings for Python, Java, C#, Go, and Javascript are provided.

Install / Use

/learn @crypto-chassis/Ccapi

README

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Table of Contents generated with DocToc

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

ccapi

  • A header-only C++ library for streaming market data and executing trades directly from cryptocurrency exchanges (i.e. the connections are between your server and the exchange server without anything in-between).
  • Bindings for other languages such as Python, Java, C#, Go, and Javascript are provided.
  • Code closely follows Bloomberg's API: https://www.bloomberg.com/professional/support/api-library/.
  • It is ultra fast thanks to very careful optimizations.
  • Supported exchanges:
  • Join us on Discord https://discord.gg/b5EKcp9s8T and Medium https://cryptochassis.medium.com.
  • For any questions, email hello@cryptochassis.com.
  • We’re experts in market data collection, high-speed trading system, infrastructure optimization, and proprietary market making. Hire us as engineers, liquidity providers, traders, or asset managers.

Branches

  • The develop branch may contain experimental features.
  • The master branch represents the most recent stable release.

Build

C++

  • This library is header-only.
  • Example CMake: example/CMakeLists.txt.
  • Require C++17 and OpenSSL.
  • Macros in the compiler command line:
    • Define service enablement macro such as CCAPI_ENABLE_SERVICE_MARKET_DATA, CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT, CCAPI_ENABLE_SERVICE_FIX, etc. and exchange enablement macros such as CCAPI_ENABLE_EXCHANGE_BYBIT, etc. These macros can be found at the top of include/ccapi_cpp/ccapi_session.h.
  • Dependencies:
    • boost https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz (notice that its include directory is boost).
    • rapidjson https://github.com/Tencent/rapidjson/archive/refs/tags/v1.1.0.tar.gz (notice that its include directory is rapidjson/include).
    • If you use FIX API, also need hffix https://github.com/jamesdbrock/hffix/archive/refs/tags/v1.4.1.tar.gz (notice that its include directory is hffix/include).
  • Include directory for this library:
    • include.
  • Link libraries:
    • OpenSSL: libssl.
    • OpenSSL: libcrypto.
    • If you need market data for huobi/huobi-usdt-swap/huobi-coin-swap or execution management for huobi-usdt-swap/huobi-coin-swap/bitmart, also link ZLIB.
    • On Windows, also link ws2_32.
  • Compiler flags:
    • -pthread for GCC and MinGW.
  • Tested platforms:
    • macOS: Clang.
    • Linux: GCC.
    • Windows: MinGW.
  • Troubleshoot:
    • Try to remove all build artifacts and start from scratch (e.g. for cmake remove all the contents inside your build directory).
    • "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR)". Try cmake -DOPENSSL_ROOT_DIR=.... On macOS, you might be missing headers for OpenSSL, brew install openssl and cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl. On Ubuntu, sudo apt-get install libssl-dev. On Windows, vcpkg install openssl:x64-windows and cmake -DOPENSSL_ROOT_DIR=C:/vcpkg/installed/x64-windows-static.
    • "Fatal error: can't write <a> bytes to section .text of <b>: 'File too big'". Try to add compiler flag -Wa,-mbig-obj. See https://github.com/assimp/assimp/issues/2067.
    • "string table overflow at offset <a>". Try to add optimization flag -O1 or -O2. See https://stackoverflow.com/questions/14125007/gcc-string-table-overflow-error-during-compilation.
    • On Windows, if you still encounter resource related issues, try to add optimization flag -O3 -DNDEBUG.

non-C++

  • Require SWIG and CMake.
    • SWIG: On macOS, brew install SWIG. On Linux, sudo apt-get install -y swig.
    • CMake: https://cmake.org/download/.
  • Run the following commands.
mkdir binding/build
cd binding/build
rm -rf * (if rebuild from scratch)
cmake -DBUILD_PYTHON=ON -DBUILD_VERSION=1.0.0 .. (Use -DBUILD_JAVA=ON if the target language is Java, -DBUILD_CSHARP=ON if the target language is C#, -DBUILD_GO=ON if the target language is Go, -DBUILD_JAVASCRIPT=ON if the target language is Javascript)
cmake --build .
  • The packaged build artifacts are located in the binding/build/<language>/packaging/<BUILD_VERSION> directory. SWIG generated raw files and build artifacts are located in the binding/build/<language>/ccapi_binding_<language> directory.
  • Python: If a virtual environment (managed by venv or conda) is active (i.e. the activate script has been evaluated), the package will be installed into the virtual environment rather than globally.
  • C#: The shared library is built using the .NET framework.
  • Troubleshoot:
    • "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE
View on GitHub
GitHub Stars713
CategoryDevelopment
Updated1d ago
Forks232

Languages

C++

Security Score

100/100

Audited on Mar 28, 2026

No findings