Intra-Exchange Arbitrage Analysis for Arbitrum (ARB) on Binance (NanoSec Case Study)
| cmd | ||
| internal | ||
| .gitignore | ||
| config.json | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
binance-arbitrage
Intra-Exchange Arbitrage Analysis for Arbitrum (ARB) on Binance
Program Flow
-
All configurations read from
config.jsonfile- Default values are defined in
internal/utils/config.go
- Default values are defined in
-
Creates a new logger instance
-
Creates OrderBook channel to store values of symbols and OrderBookManager to store all values of all symbols (concurrent)
-
Connects to Binance WSS
- And checks connection status, ensure stability (concurrent)
-
Waits until all symbol values get from WSS
-
Starts Arbitrage Detector and checks for triangular arbitrage opportunities (concurrent)
- Outputs a signal when configured threshold exceed
-
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.gofrom 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_checkis small value andprofit_tresholdexceed - 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