• Stars
    star
    157
  • Rank 238,399 (Top 5 %)
  • Language
    C++
  • License
    MIT License
  • Created over 6 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

C++ examples.

roq-samples

Samples demonstrating how to implement various features of algorithmic trading solutions.

Operating Systems

  • Linux (x86-64, AArch64)
  • macOS (x86-64, Arm64)

Note! The Windows Subsystem for Linux (WSL) is NOT supported. Reason can be found here.

Library/Package Dependencies

  • Abseil-C++ (Apache 2.0 License)
  • FlatBuffers (Apache 2.0 License)
  • fmt (MIT License)
  • roq-api (MIT License)
  • roq-logging (MIT License)
  • roq-web (Commerical License, free to use)
  • roq-client (Commerical License, free to use)

Optional

Prerequisites

The project is primarily designed to be compatible with the conda package manager.

Use stable for (the approx. monthly) release build. Use unstable for the more regularly updated development builds.

Initialize sub-modules

git submodule update --init --recursive

Create environment

scripts/create_conda_env.sh stable debug

Activate environment

source opt/conda/bin/activate dev

Building

Sometimes you may need to delete CMakeCache.txt if CMake has cached an incorrect configuration.

cmake . && make -j4

Using

  • Example 1
    • Connect to market gateway
    • Subscribe using regex patterns
  • Example 2
    • Manage disconnect
    • Process incremental market data update
    • Maintain a market depth view
    • Update a simple model
  • Example 3
    • Maintain positions
    • Place limit orders
    • Deal with order acks and updates
    • Historical simulation
    • Live trading
  • Example 4
    • Subscribe and nothing else
  • Example 5
    • Transfer CustomMessage from a secondary thread
  • Import
    • Convert any data source to an event-log
    • Encoding has header-only dependencies

Simulation Data (install)

Simulation requires you to either use your own event logs (automatically captured when you're running a gateway) or use sample data

mamba install -y --channel https://roq-trading.com/conda/stable \
    roq-data

Data can now be found in the $CONDA_PREFIX/share/roq-data/ directory.

Gateways (install, configure, run)

Deribit

mamba install -y --channel https://roq-trading.com/conda/stable \
    roq-deribit

It is easiest to start from a config file template

cp $CONDA_PREFIX/share/roq-deribit/config.toml ~/deribit.toml

Edit this file and update with your Deribit API credentials (link).

You should look for these lines and replace as appropriate

login = "YOUR_DERIBIT_LOGIN_GOES_HERE"
secret = "YOUR_DERIBIT_SECRET_GOES_HERE"

Launch the gateway

roq-deribit \
    --name "deribit" \
    --config_file ~/deribit.toml \
    --client_listen_address ~/deribit.sock

Coinbase Pro

mamba install -y --channel https://roq-trading.com/conda/stable \
    roq-coinbase-pro

It is easiest to start from a config file template

cp $CONDA_PREFIX/share/roq-coinbase-pro/config.toml ~/coinbase-pro.toml

Edit this file and update with your Coinbase Pro API credentials (link).

You should look for these lines and replace as appropriate

login = "YOUR_COINBASE_PRO_API_KEY_GOES_HERE"
password = "YOUR_COINBASE_PRO_PASSPHRASE_GOES_HERE"
secret = "YOUR_COINBASE_PRO_SECRET_GOES_HERE"

Launch the gateway

roq-coinbase-pro \
    --name "coinbase-pro" \
    --config_file ~/coinbase-pro.toml \
    --client_listen_address ~/coinbase-pro.sock

License

The project is released under the terms of the BSD 3-Clause license.

Links

More Repositories

1

roq-api

C++ interfaces used to communicate with Roq gateways.
C++
466
star
2

roq-python

Python 3.x bindings for some of Roq's C++23 APIs.
C++
10
star
3

roq-ansible

Ansible Playbook.
8
star
4

roq-logging

Logging utilities.
C++
7
star
5

roq-algo

C++ tools for building algorithmic trading strategies.
C++
3
star
6

roq-cmake

CMake scripts and utilties.
CMake
3
star
7

roq-clickhouse-adapter

Template project demonstrating ClickHouse integration.
C++
3
star
8

roq-cpp-client-template

Client template project using C++.
C++
3
star
9

roq-zeromq-bridge

Publish real-time events to ZeroMQ. [C++20] [Bridge] [EXAMPLE]
C++
2
star
10

roq-cpp-fix-client-template

FIX client template project using C++.
C++
2
star
11

roq-ansible-monitor

Monitor Roq's gateways using Prometheus and Grafana. [Ansible] [DevOps]
Python
1
star
12

roq-redis-bridge

Publish real-time events to Redis. [C++20] [Bridge] [EXAMPLE]
C++
1
star
13

roq-fix-proxy

FIX load-balancer supporting message routing by client. (Used with FIX-Bridge.)
C++
1
star
14

roq-analysis

Data analysis.
Jupyter Notebook
1
star
15

roq-algo-playground

C++ framework for using the algorithmic trading strategy library
C++
1
star
16

roq-issues

Issue tracker for Roq's software solutions.
1
star
17

.github

1
star
18

roq-docker-demo

Docker deployment using Supervisor to manage several Roq services.
Dockerfile
1
star
19

roq-ansible-gateways

Install and configure Roq's gateways [Ansible] [DevOps]
Python
1
star
20

roq-flags

Command-line utilities.
C++
1
star
21

roq-clickhouse-cpp

Demonstrates how to use the roq-adapter library to export event-logs to ClickHouse
C++
1
star
22

roq-risk-manager

Implements a basic position and risk management application. [C++20] [Risk]
C++
1
star
23

roq-vue

User interface for Roq's market gateways. [Vue] [EXPERIMENT]
Vue
1
star
24

roq-python-samples

Python examples.
Python
1
star
25

roq-java-samples

Java examples.
Java
1
star