High frequency trading bot for crypto currencies

Related tags

Graphics gamma-ray
Overview

license

Gamma Ray

WARNING: The author of this software will not be responsible for your losses on the market, use at your own discretion.

Introduction

Gamma Ray is a high frequnecy market maker trading bot for crypto currency markets written in C++. It is able to consistantly update maker orders under 100 micro seconds.

This program is aimes to be a starting point for developing your own market maker algorithms, and it comes with 3 existing strategies for you to get started:

  • Top, which tries to post 1 tick better than the existing best bid and ask prices in the orderbook, given a minimum spread contraint.
  • Mid, which post bid/ask orders with a fixed spread.
  • Avellaneda Stoikov, which is a high frequency market maker framework with a proper model, for more information you may read the paper here. A jupyter notebook doc/AS model calibration.ipynb is provided giving a sample method to calibrate model parameters.

As of now this program only supports one exchange: Bitmex, more exchanges may be added in the future depend on user request.

Build Instructions

This program is tested on Ubuntu 18, other Linux distributions may differ from this instruction.

Install dependencies

# install dependent packages
sudo apt-get update
sudo apt-get -y install build-essential doxygen graphviz ninja-build libboost-all-dev libssl-dev libcpprest-dev

# install cmake 3.18
wget https://github.com/Kitware/CMake/releases/download/v3.18.0-rc1/cmake-3.18.0-rc1.tar.gz && tar -xzvf cmake-3.18.0-rc1.tar.gz && cd cmake-3.18.0-rc1
./bootstrap && make
sudo make install
cd .. && rm -rf cmake-3.18.0-rc1
source

# install poco
git clone -b master https://github.com/pocoproject/poco.git
cd poco
mkdir cmake-build && cd cmake-build
cmake ..
sudo cmake --build . --target install
cd ../.. && rm -rf poco

Build

git clone --recurse-submodules https://github.com/hello2all/gamma-ray
cd gamma-ray

mkdir release
cd release

cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
ninja

Configuration

A sample configuration sample-config.json is provided, after editing according to your parameters this config file is required to be renamed to gamma-ray.json and copied into the same directory as the executable.

cp ./sample-config.json ./release/gamma-ray.json

A brief explaination of configurable parameteres:

  • websocketUrl: Websocket API end point
  • httpUrl: REST API end point
  • apiKey: API key
  • apiSecret: API secret
  • contract: trading pair, currently supports only perpetual contracts such as BTCUSD, ETHUSD etc.
  • quotingMode: quoting strategy, you can choose from Mid, Top and AvellanedaStoikov.
  • size: order size/quantity
  • quotingModeParam: quoting strategy specific parameters
  • pairs: how many price levels of bid ask pairs will be posted
  • priceInterval: price difference between price levels
  • sizeIncrement: size difference between price levels
  • skewFactor: for each executed order size, mid price will move one tick against the executed side
  • tradesPerMinute: safety feature, maximum orders can be executed before stop quoting, not yet implemented

Run

With gamma-ray.json config file in the same directory with the executable

./release/main

Deployment

For the best latency, this bot should be deployed on AWS eu-west-1c.

Donations ❤️

This project is still evolving and need your help to grow. If you find this project useful, please consider support the development of this project by donating using the following addresses. Testing HFT strategies replies on trading on live markets due to many technical constrains, which can be costly. Your contribution will keep this project free and open to the public.

BTC: 3BMEXLjaNku2Sh73s2i1DZVTgKpDrzTSwk

ETH: 0x9DFe1C3E906Ec27121e7921953CEdA5AaB558306

Donators will have early access to new features and your feature requests will be prioritised.

Join the community

If you have questions or would like to contribute to the project, join our Discord channel. It's gonna be a sausage party, I promise :p

https://discord.gg/ZAG6aCXfCs

Issues
  • libPocoXML.so.71: cannot open shared object file: No such file or directory

    libPocoXML.so.71: cannot open shared object file: No such file or directory

    Hi, i want to contribute if i can. I followed the insructions but get this final error

    ./main: error while loading shared libraries: libPocoXML.so.71: cannot open shared object file: No such file or directory

    Any fixes for this?

    Regards

    opened by z772 8
  • ninja error

    ninja error

    $:~/poco/gamma-ray/release$ ninja [1/20] Building CXX object CMakeFiles/engine.dir/cmake_pch.hxx.gch FAILED: CMakeFiles/engine.dir/cmake_pch.hxx.gch /usr/bin/c++ -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -DENABLE_DOCTEST_IN_LIBRARY -DPOCO_ENABLE_CPP11 -DPOCO_ENABLE_CPP14 -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX -DXML_DTD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_XOPEN_SOURCE=500 -I. -I../include -I../external/doctest/doctest -I../external/websocketpp -Wall -Werror -Wfatal-errors -Wpedantic -Wextra -Wmissing-include-dirs -pthread -O3 -DNDEBUG -Wall -Werror -Wfatal-errors -Wpedantic -Wextra -Wmissing-include-dirs -pthread -Wno-switch-enum -std=c++1z -Winvalid-pch -x c++-header -include /home/ubuntu/poco/gamma-ray/release/CMakeFiles/engine.dir/cmake_pch.hxx -MD -MT CMakeFiles/engine.dir/cmake_pch.hxx.gch -MF CMakeFiles/engine.dir/cmake_pch.hxx.gch.d -o CMakeFiles/engine.dir/cmake_pch.hxx.gch -c CMakeFiles/engine.dir/cmake_pch.hxx.cxx cc1plus: error: ../external/doctest/doctest: No such file or directory [-Werror=missing-include-dirs] compilation terminated due to -Wfatal-errors. cc1plus: all warnings being treated as errors [2/20] Building CXX object CMakeFiles/main.dir/cmake_pch.hxx.gch FAILED: CMakeFiles/main.dir/cmake_pch.hxx.gch /usr/bin/c++ -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -DENABLE_DOCTEST_IN_LIBRARY -DPOCO_ENABLE_CPP11 -DPOCO_ENABLE_CPP14 -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX -DXML_DTD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_XOPEN_SOURCE=500 -I. -I../include -I../external/doctest/doctest -I../external/websocketpp -Wall -Werror -Wfatal-errors -Wpedantic -Wextra -Wmissing-include-dirs -pthread -O3 -DNDEBUG -flto -fno-fat-lto-objects -Wall -Werror -Wfatal-errors -Wpedantic -Wextra -Wmissing-include-dirs -pthread -Wno-switch-enum -std=c++1z -Winvalid-pch -x c++-header -include /home/ubuntu/poco/gamma-ray/release/CMakeFiles/main.dir/cmake_pch.hxx -MD -MT CMakeFiles/main.dir/cmake_pch.hxx.gch -MF CMakeFiles/main.dir/cmake_pch.hxx.gch.d -o CMakeFiles/main.dir/cmake_pch.hxx.gch -c CMakeFiles/main.dir/cmake_pch.hxx.cxx cc1plus: error: ../external/doctest/doctest: No such file or directory [-Werror=missing-include-dirs] compilation terminated due to -Wfatal-errors. cc1plus: all warnings being treated as errors ninja: build stopped: subcommand failed.

    opened by linucis 6
  • Build Error

    Build Error

    I got this error afetr ninja command: -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.65") found components: system thread -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: random system thread filesystem chrono atomic date_time regex -- IPO is supported -- Configuring done -- Generating done -- Build files have been written to: /home/diego/Documenti/OrderBook/gamma-ray-main/gamma-ray/release [1/4] Building CXX object tests/CMakeFiles/unit_tests.dir/main.cpp.o FAILED: tests/CMakeFiles/unit_tests.dir/main.cpp.o /usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_CHRONO_DYN_LINK -DBOOST_DATE_TIME_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_RANDOM_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -DENABLE_DOCTEST_IN_LIBRARY -DPOCO_ENABLE_CPP11 -DPOCO_ENABLE_CPP14 -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX -DXML_DTD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_XOPEN_SOURCE=500 -I. -I../include -I../external/doctest/doctest -I../external/websocketpp -Wall -Werror -Wfatal-errors -Wpedantic -Wextra -Wmissing-include-dirs -pthread -O3 -DNDEBUG -Wall -Werror -Wfatal-errors -Wpedantic -Wextra -Wmissing-include-dirs -pthread -Wno-switch-enum -std=c++17 -Winvalid-pch -include /home/diego/Documenti/OrderBook/gamma-ray-main/gamma-ray/release/tests/CMakeFiles/unit_tests.dir/cmake_pch.hxx -MD -MT tests/CMakeFiles/unit_tests.dir/main.cpp.o -MF tests/CMakeFiles/unit_tests.dir/main.cpp.o.d -o tests/CMakeFiles/unit_tests.dir/main.cpp.o -c ../tests/main.cpp In file included from ../tests/main.cpp:2: ../external/doctest/doctest/doctest.h:4299:47: error: size of array ‘altStackMem’ is not an integral constant-expression 4299 | static char altStackMem[4 * SIGSTKSZ]; | ^ compilation terminated due to -Wfatal-errors. [2/4] Building CXX object CMakeFiles/main.dir/app/main.cpp.o FAILED: CMakeFiles/main.dir/app/main.cpp.o /usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_CHRONO_DYN_LINK -DBOOST_DATE_TIME_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_RANDOM_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -DENABLE_DOCTEST_IN_LIBRARY -DPOCO_ENABLE_CPP11 -DPOCO_ENABLE_CPP14 -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX -DXML_DTD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_XOPEN_SOURCE=500 -I. -I../include -I../external/doctest/doctest -I../external/websocketpp -Wall -Werror -Wfatal-errors -Wpedantic -Wextra -Wmissing-include-dirs -pthread -O3 -DNDEBUG -flto -fno-fat-lto-objects -Wall -Werror -Wfatal-errors -Wpedantic -Wextra -Wmissing-include-dirs -pthread -Wno-switch-enum -std=c++17 -Winvalid-pch -include /home/diego/Documenti/OrderBook/gamma-ray-main/gamma-ray/release/CMakeFiles/main.dir/cmake_pch.hxx -MD -MT CMakeFiles/main.dir/app/main.cpp.o -MF CMakeFiles/main.dir/app/main.cpp.o.d -o CMakeFiles/main.dir/app/main.cpp.o -c ../app/main.cpp In file included from ../app/main.cpp:3: ../external/doctest/doctest/doctest.h:4299:47: error: size of array ‘altStackMem’ is not an integral constant-expression 4299 | static char altStackMem[4 * SIGSTKSZ]; | ^ compilation terminated due to -Wfatal-errors. ninja: build stopped: subcommand failed.

    So I checked and i saw that the doctest haven't been downloaded correctly. So i manually installed it and the compilation succeded.

    But when i try to launch the application i got this error:

    terminate called after throwing an instance of 'nlohmann::detail::parse_error' what(): [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal Annullato (core dump creato)

    opened by delavegaOpengl 0
  • Does not run on Mainnet

    Does not run on Mainnet

    [email protected]:~/gamma-ray$ ./run-release.sh [2021-01-17 20:05:27] [info] Error getting remote endpoint: system:9 (Bad file descriptor) [2021-01-17 20:05:27] [error] handle_connect error: Timer Expired [2021-01-17 20:05:27] [info] asio async_shutdown error: asio.ssl:336462100 (uninitialized) terminate called after throwing an instance of 'char const*' Aborted (core dumped)

    opened by z772 0
  • HTTP Status error

    HTTP Status error

    [2021-01-18 18:01:56] [error] Server handshake response error: websocketpp.processor:20 (Invalid HTTP status.) [2021-01-18 18:01:56] [info] asio async_shutdown error: asio.ssl.stream:1 (stream truncated) terminate called after throwing an instance of 'char const*' Aborted (core dumped)

    Post your BTC wallet so we all can support this development for atleast a working mainnet version we can further development.

    Regards

    opened by z772 4
Owner
TIAN Liang Yuan
TIAN Liang Yuan
Open source Altium Database Library with over 147,000 high quality components and full 3d models.

Open source Altium Database Library with over 147,000 high quality components and full 3d models.

Mark 1.2k Jun 20, 2022
Efficiently spawn and move high amounts of objects like bullets for bullet hells, particles and more.

Godot Native Bullets Efficiently spawn and move high amounts of objects like bullets for bullet hells, particles and more. This is a GDNative plugin,

Samuele Zolfanelli 73 Jun 13, 2022
⚡High-performance rendering for python

ZenGL ZenGL is a minimalist Python module providing exactly one way to render scenes with OpenGL. pip install zengl Documentation zengl on Github zen

Szabolcs Dombi 121 Jun 18, 2022
Source Code for "Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs" by Eric Haines and Tomas Akenine-Möller

Apress Source Code This repository accompanies Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs by Eric Haines and Tomas

Apress 819 Jun 15, 2022
GLSL and ESSL are Khronos high-level shading languages.

GLSL GLSL and ESSL are Khronos high-level shading languages. Khronos Registries are available for OpenGL OpenGL ES Vulkan Extension specifications in

The Khronos Group 228 Jun 17, 2022
The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation

DirectX Shader Compiler The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) pr

Microsoft 2.2k Jun 27, 2022
Fast and easy to use, high frequency trading framework for betfair

Hedg Fast and easy to use, high frequency trading framework for betfair About Hedg In the sports trading industry, low latency is really important. Th

Oluwatosin Alagbe 8 Jun 11, 2022
Provide a unified trading framework and connectors to popular trading venues

Boost.connector Provide a unified trading framework and connectors to popular trading venues This is currently NOT an official Boost library. Introduc

Richard Hodges 6 Nov 24, 2021
Trading bot who's doing transaction between different money.

CNA - TRADE Since 2002, trading robots, AKA algorithmic trading, are considered to be one of the major breakthroughs on financial markets over the las

Mehdi 3 Nov 8, 2021
Mnemonic seed library for Monero and other CryptoNote-based currencies.

Features 16 mnemonic words (36% shorter than the original 25-word seed) embedded wallet birthday to optimize restoring from the seed supports encrypti

null 17 Jun 4, 2022
GNUWeebBot - High-performance bot Telegram, running on Linux environment.

High-performance bot Telegram, running on Linux environment, written in C. Core Features Event Debug Event Logger Modules Telegram debug info.

GNU/Weeb 11 May 8, 2022
Real Time, High performance BOT detection and protection

REAL-TIME BOT PROTECTION CHALLENGE IronFox https://innovera.ir IronFox is a real-time and high performance bot protection, that using Nginx as a reve

Khalegh Salehi 3 Jun 5, 2022
Algorithmic Trading in C++

Notes: API sources: Binance (Spot + Futures + Testnet), IBKR Libraries used: cpprestsdk, boost, stl, gperftools Technical indicators used: EMA, SMA, R

dao ngoc hieu 16 Jun 17, 2022
Space exploration, trading, and combat game.

Endless Sky Explore other star systems. Earn money by trading, carrying passengers, or completing missions. Use your earnings to buy a better ship or

Endless Sky 3.5k Jun 23, 2022
Wasserstein Inverted Frequency Modulation Synthesizer

Wasserstein Inverted Frequency Modulation Synthesizer 発表資料: https://speakerdeck.com/fadis/wassersteinni-fmyin-yuan 発表動画: https://youtu.be/VF9VX01QYs0

Fadis 12 May 25, 2022
AMD K6-2 (CXT) / K6-2+ / K6-3 / K6-3+ Write Allocate / Write Combine / Write Ordering / Frequency Multiplier Initialization driver for MS-DOS

K6INIT What is this? This is a driver for MS-DOS to replace k6dos.sys which is a bit useless and unflexible. It does not support the CXT versions of t

null 8 May 26, 2022
AVR-based frequency counter module with I2C interface.

AVR-based Frequency Counter The AVR-based frequency counter is partly based on the project developed by Herbert Dingfelder with some extensions and mo

DoWiD 1 Feb 26, 2022
Real time monaural source separation base on fully convolutional neural network operates on Time-frequency domain.

Real time monaural source separation base on fully convolutional neural network operates on Time-frequency domain.

James Fung 94 Jun 20, 2022
Image frequency analyzer

MotionCam Image frequency analyzer Following app uses captured frames (center point from the middle and its color) to analize their potential freqency

Piotr Dymala 1 Jan 2, 2022
By controlling the frequency at which the output Pins of MSP430 are turned off and on, we can make music.

By controlling the frequency at which the output Pins of MSP430 are turned off and on, we can make music.

Premkumar Vincent 1 Nov 9, 2021
Next-gen Rowhammer fuzzer that uses non-uniform, frequency-based patterns.

Blacksmith Rowhammer Fuzzer This repository provides the code accompanying the paper Blacksmith: Scalable Rowhammering in the Frequency Domain that is

Computer Security Group @ ETH Zurich 165 May 16, 2022
Get the current average CPU frequency on Apple M1 chips.

M1 CPU Frequency Get the current average CPU frequency on Apple M1 chips. Usage Download the precompiled binary from the releases and run it in the te

BitesPotatoBacks 11 Jun 24, 2022
ncpaprop, a command-line package for modeling the propagation of low-frequency acoustic waves in the atmosphere.

ncpaprop ncpaprop is a software package aiming at providing a comprehensive set of tested and validated numerical models for simulating the long range

Claus Hetzer 7 Mar 14, 2022
A modern, portable, easy to use crypto library.

Sodium is a new, easy-to-use software library for encryption, decryption, signatures, password hashing and more. It is a portable, cross-compilable, i

Frank Denis 10.2k Jun 25, 2022
A lightweight, secure, easy-to-use crypto library suitable for constrained environments.

The Hydrogen library is a small, easy-to-use, hard-to-misuse cryptographic library. Features: Consistent high-level API, inspired by libsodium. Instea

Frank Denis 388 Jun 18, 2022
TLS/SSL and crypto library

Welcome to the OpenSSL Project OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the Transport Layer Security (TLS) protoco

OpenSSL 18.7k Jun 28, 2022
Single C file TLS 1.2/1.3 implementation, using tomcrypt as crypto library

TLSe Single C file TLS 1.3, 1.2, 1.1 and 1.0(without the weak ciphers) implementation, using libtomcrypt as crypto library. It also supports DTLS 1.2

Eduard Suica 442 Jun 22, 2022
DARKCAT Project - A Strong Prototype Crypto-Locker

Darkcat is an Open Source Crypto-locker directed at an audience with an interest in the field of Cyber Security. The locker is similar to how very obnoxious Ransomwares operate using 2-Layer Key Encryption with the intent of making it almost impossible to recover any key from memory even during the event of Encryption.

Alexander Töpfer 29 Apr 17, 2022