Intra-Exchange Arbitrage Analysis for Arbitrum (ARB) on Binance (NanoSec Case Study)
Find a file
2025-07-01 23:58:59 +03:00
cmd DONE: BinanceAPI, Orderbook Management, Arbitrage Calculation 2025-07-01 22:38:26 +03:00
internal DONE: BinanceAPI, Orderbook Management, Arbitrage Calculation 2025-07-01 22:38:26 +03:00
.gitignore DONE: BinanceAPI, Orderbook Management, Arbitrage Calculation 2025-07-01 22:38:26 +03:00
config.json Update config.json 2025-07-01 23:58:59 +03:00
go.mod DONE: BinanceAPI, Orderbook Management, Arbitrage Calculation 2025-07-01 22:38:26 +03:00
go.sum DONE: BinanceAPI, Orderbook Management, Arbitrage Calculation 2025-07-01 22:38:26 +03:00
LICENSE Initial commit 2025-06-28 10:44:44 +03:00
README.md Update README.md 2025-07-01 23:05:33 +03:00

binance-arbitrage

Intra-Exchange Arbitrage Analysis for Arbitrum (ARB) on Binance

Program Flow

  1. All configurations read from config.json file

    • Default values are defined in internal/utils/config.go
  2. Creates a new logger instance

  3. Creates OrderBook channel to store values of symbols and OrderBookManager to store all values of all symbols (concurrent)

  4. Connects to Binance WSS

    • And checks connection status, ensure stability (concurrent)
  5. Waits until all symbol values get from WSS

  6. Starts Arbitrage Detector and checks for triangular arbitrage opportunities (concurrent)

    • Outputs a signal when configured threshold exceed
  7. Runs until exit signal sent from user and outputs a mini info about connection status

Notes

  • requires at least go 1.23+ to run/compile (tested and implemented in 1.24.3)
  • run binance-arbitrage program with go run cmd/main.go from current directory (or the directory where is your config file located)

Things that not implemented / Known problems

  • log file rotation
  • control mechanism to do not send successfull arbitrage signal if connection corrupted
    • reconnects automatically and logs error but still outputs signal
  • log very verbosly if arbitrage_check is small value and profit_treshold exceed
  • ping/pong and health check not double checked. Didn't well integrated to codebase
  • program only checks triangle predefined paths. Do not automatically fetch all possible ways
    • paths could be changed/added in config file
  • Bonus section not implemented