Skip to content

high-performance, multi-threaded triangular arbitrage detection engine in C++ for cryptocurrency markets

Notifications You must be signed in to change notification settings

horaja/arbitrage-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Latency-Aware, Risk-Aware Triangular Arbitrage Engine

This project is a high-performance triangular arbitrage detection engine built in C++ for cryptocurrency markets. It identifies risk-free profit opportunities and uses a sophisticated Gaussian Process model, trained in Python, to predict execution latency. This ensures the system only attempts trades with a high probability of success, making it a robust and practical automated trading system.

Key Features

  • High-Performance Core: The arbitrage detection logic is written in C++ for maximum performance.
  • Multi-threaded Architecture: Decouples data ingestion from the core trading logic using concurrent queues.
  • Graph-Based Detection: Models the market as a graph and uses the Bellman-Ford algorithm to find arbitrage opportunities (negative weight cycles).
  • Probabilistic Latency Modeling: Employs a Gaussian Process (GP) regressor to provide a probabilistic forecast of round-trip execution latency, preventing trades with high timing risk.
  • Risk-Aware Logic: The core C++ engine is parameterized by the ML model's output, only executing trades that are predicted to be profitable after accounting for latency risk.

Technology Stack

  • Core Engine: C++
  • ML Model & Data Logging: Python
  • Key Libraries:
    • C++: Boost, websocketpp, Eigen
    • Python: pandas, websockets, scikit-learn, GPy
  • Build System: CMake

Setup and Usage

Prerequisites

  • A C++ compiler (GCC, Clang)
  • CMake
  • Python 3.8+
  • Boost Libraries

Installation & Setup

  1. Clone the repository:
    git clone [Your Repository URL]
    cd [repository-name]
  2. Setup Python Environment:
    cd python_utils
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  3. Build the C++ Engine:
    cd ../cpp_engine
    mkdir build && cd build
    cmake ..
    make

Running the Project

  1. Start the Data Logger:
    # From the python_utils directory
    python data_logger.py
  2. Run the C++ Engine:
    # From the cpp_engine/build directory
    ./arbitrage_engine

About

high-performance, multi-threaded triangular arbitrage detection engine in C++ for cryptocurrency markets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published