Skip to content

Botvana is high-performance and event-driven trading system built using Rust (in early development).

License

Notifications You must be signed in to change notification settings

featherenvy/botvana

Repository files navigation

Botvana: high-performance trading platform

Botvana is an open-source, event-driven, and distributed trading platform targeting crypto markets. It aims to be high-performance, low-latency, reliable, and fault-tolerant. Built in Rust, it allows you to develop and operate market-making and arbitrage strategies.

⚠️ The project is still in very early development ⚠️

Principles:

  • High-performance: Designed and architected to be high-performance from the ground up. It utilizes staged event-driven architecture combined with thread-per-core architecture.
  • Low-latency: Currently utilizing io_uring for network connectivity, with goals to use AF_XDP or kernel by-pass in the future.
  • Reliable: Being built in Rust provides Botvana with memory safety guarantees compared to other systems programming languages.
  • Fault-tolerant: Crypto exchanges are known for unreliability, so Botvana provides explicit fault-tolerant features.

Overview

Botvana is split into these components:

  • botnode: high-performance trading bot
  • botvana-server: coordination server
  • botvana: shared platform definitions
  • station-egui: control application

Supported Exchanges

Currently, in the early phase of the project, the supported exchanges are FTX and Binance.

Deployment architecture

deployment architecture

botnode architecture

botnode architecture

Botnode uses thread-per-core architecture where each thread is pinned to exactly one logical CPU core. Each CPU core runs a different engine with a custom event loop. Data is sent between engines using SPSC channels, and no global state is shared between the threads.

Botnode has these engines:

  • Control engine: Connects to botvana-server and spawns all other engines based on configuration.
  • Market data engine: Connects to the exchange and transforms market data to Botvana's internal types.
  • Indicator engine: Provides indicators built from market data.
  • Trading engine: Makes trading decisions.
  • Exchange engine: Acts as order router and gateway to the exchange.
  • Audit engine: Audits trading activity.

botvana-server

Each botnode needs to connect to a central botvana-server which provides configuration and acts as the central coordinator.

Botvana server expects configuration in cfg/default.toml.

station-egui

Control station application written using egui framework.

Development Prerequisites

In order to work with Botvana you need to have:

  • Linux kernel version >5.13
  • Rust 1.58 or higher
  • Terraform

Getting started

  1. Clone the repo
    git clone https://github.com/featherenvy/botvana.git
  2. Install dependencies required to compile egui
    sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
  3. Build all components
    cargo build
  4. Run dependencies using docker-compose:
    docker-compose up -d
  5. Run botvana-server
    cargo r --bin botvana-server
  6. Run botnode
    SERVER_ADDR=127.0.0.1:7978 BOT_ID=0 cargo r --bin botnode
  7. Run station-egui
    cargo r --bin station-egui

About

Botvana is high-performance and event-driven trading system built using Rust (in early development).

Topics

Resources

License

Stars

Watchers

Forks

Languages