C++ Crypto Trading Bot

C++ crypto trading bot

C++ crypto trading bot

Introduction

Blackbird Bitcoin Arbitrage is a C++ trading system that does automatic long/short arbitrage between Bitcoin exchanges.

How It Works

Bitcoin is still a new and inefficient market.

Several Bitcoin exchanges exist around the world and the bid/ask prices they propose can be briefly different from an exchange to another.

Watch Me Build a Trading Bot

The purpose of Blackbird is to automatically profit from these temporary price differences while being market-neutral.

Here is a real example where an arbitrage opportunity exists between Bitstamp (long) and Bitfinex (short):

At the first vertical line, the spread between the exchanges is high so Blackbird buys Bitstamp and short sells Bitfinex.

Then, when the spread closes (second vertical line), Blackbird exits the market by selling Bitstamp and buying Bitfinex back.

Advantages

Unlike other Bitcoin arbitrage systems, Blackbird doesn't sell but actually short sells Bitcoin on the short exchange.

C++ crypto trading bot

This feature offers two important advantages:

  1. The strategy is always market-neutral: the Bitcoin market's moves (up or down) don't impact the strategy returns. This removes a huge risk from the strategy.

    Newsletter Sign Up

    The Bitcoin market could suddenly lose half its value that this won't make any difference in the strategy returns.

  2. The strategy doesn't need to transfer funds (USD or BTC) between Bitcoin exchanges. The buy/sell and sell/buy trading activities are done in parallel on two different exchanges, independently.

    C++ crypto trading bot

    Advantage: no need to deal with transfer latency issues.

More details about short selling and market neutrality can be found on issue #100.

Disclaimer

USE THE SOFTWARE AT YOUR OWN RISK. YOU ARE RESPONSIBLE FOR YOUR OWN MONEY.

PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS.

THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.

Code Information

The trade results are stored in CSV files and the detailed activity is stored in log files.

C++ crypto trading bot

New files are created every time Blackbird is started.

It is possible to automatically stop Blackbird after the next trade has closed by creating, at any time, an empty file named stop_after_notrade.

Blackbird uses functions written by René Nyffenegger to encode and decode base64.