/binancews

Primary LanguageC++Apache License 2.0Apache-2.0

Binance WebSockets

binancews is a C++ library which receives market data from the Binance crypto currency exchange.

The project uses Microsoft's cpprestsdk for asynchronous websocket functionality to receive the market data which is then published to Redis using the RedisPlusPlus library.

These dependencies are handled by vcpkg, a cross platform package manager.

Build

Windows

  1. Build vcpkg: open a command prompt in vcpkg_win and run: bootstrap-vcpkg.bat
  2. Install dependencies: in the same prompt run:
   .\vcpkg.exe install cpprestsdk[websockets]:x64-windows-static poco:x64-windows-static boost-asio:x64-windows-static redis-plus-plus[cxx17]:x64-windows-static
  1. Open the VS solution binancews/binancews.sln
  2. Change to 'Release', right-click on the 'binancews' project and select "Setup as startup project"
  3. Run

Linux

  1. Build vcpkg: open shell in vcpkg_linux and run: bootstrap-vcpkg.sh
  2. Install dependencies: in the same prompt run:
./vcpkg install cpprestsdk[websockets]:x64-linux poco:x64-linux boost-asio:x64-linux redis-plus-plus[cxx17]:x64-linux
  1. Go up a directory then into 'binancews' directory and run: cmake .
  2. Then run: make
  3. The binary is in the 'binancews' sub-dir ('binancews/binancews' from the top level directory)

Run

  1. To use without Redis, run with no command line args
  2. Redis IP and port are set via command line args: ./binancews [ip] [port] , i.e. ./binancews 192.168.10.10 6379
  3. This expects the Binance exchange websocket URI at wss://stream.binance.com:9443 : Change in BinanceExchange.hpp