Giter Site home page Giter Site logo

roq-trading / roq-samples Goto Github PK

View Code? Open in Web Editor NEW
156.0 15.0 54.0 10.4 MB

C++ examples.

Home Page: https://roq-trading.com/

License: BSD 3-Clause "New" or "Revised" License

Shell 2.32% C++ 86.70% CMake 10.68% Python 0.29% Batchfile 0.01%
cpp23 example demo api

roq-samples's Introduction

roq-cpp-samples

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

Operating Systems

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

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 development environment

scripts/create_conda_env unstable 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

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

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

Gateways (install, configure, run)

conda install -y --channel https://roq-trading.com/conda/unstable \
    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
conda install -y --channel https://roq-trading.com/conda/unstable \
    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

roq-samples's People

Contributors

jangob avatar thraneh avatar viciouspotato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.