4

GitHub - lbkolev/arbitrage-gossip: Monitor cryptocurrency exchanges and alert on...

 1 year ago
source link: https://github.com/lbkolev/arbitrage-gossip
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Arbitrage-gossip

Monitor cryptocurrency exchanges and alert on different platforms whenever price discrepancy occurs.

Monitored exchanges:

  • Binance
  • ByBit
  • Huobi
  • KuCoin
  • Bitfinex

Supported platforms for sending notification:

  • Twitter

Implemented Example

https://twitter.com/voices89394387

Table of contents

1)What's that and how does it work?
2)Can i run one myself?
3)Examples
4)Troubleshooting

What's that and how does it work?

Arbitrage-gossip is a bot that asynchronously fetches the prices from 6(for now) centralized cryptocurrency exchanges for a certain pair pair and reports to twitter when big enough price difference Z occurs between the exchanges, given that you have twitter api access, else it only logs the information to the server.

Can i run one myself?

Sure. Clone the repository

$ git clone https://github.com/lbkolev/arbitrage-gossip
$ cd arbitrage-gossip

Setup a virtual environment.

$ python -m venv .venv && . .venv/bin/activate

Install all the necessary packages.

$ pip install -r requirements.txt

If you intend to report the information to twitter, put your api keys in .env file in the program's root directory, as shown in .env-sample.

Check the possible program parameters:

$ python arbitrage-gossip/main.py --help
usage: Arbitrage Gossiper [-h] -b BASE -q QUOTE [-t THRESHOLD] [--log-level {debug,info,warning,error}] [--log-file LOG_FILE] [--report-to REPORT_TO] [--cooldown COOLDOWN]

options:
  -h, --help            show this help message and exit
  -b BASE, --base BASE  Base asset. ETHUSDT, ETH is base asset
  -q QUOTE, --quote QUOTE
                        Quote asset. ETHUSDT, USDT is quote asset
  -t THRESHOLD, --threshold THRESHOLD
                        The threshold specifies the discrepancy in percentage, after which the information will be reported to --report-to platforms. Defaults to 1 percent.
  --log-level {debug,info,warning,error}
                        Logging level. Defaults to info
  --log-file LOG_FILE   Specify a filename to log into. Defaults to {pair}.log. Log directory is by default /var/log/arbitrage-gossip
  --report-to REPORT_TO
                        Comma separated list of the platforms we'll notify. **For now only twitter is supported**.
  --cooldown COOLDOWN   Report to the platforms every cooldown seconds. Defaults to 60 seconds

Examples

  1. Monitor pair BTCUSDT on each exchange that offers it, and report to twitter whenever a price difference of atleast 1% occurs between any of the exchanges. Reports no more often than 180 seconds. The information is logged by default to /var/log/arbitrage-gossip/btcusdt.log.
$ python arbitrage-gossip/main.py --base btc --quote usdt --report-to=twitter --cooldown=180 --threshold=1
  1. Monitor pair LUNAUSDT on each exchange that offers it, and report to twitter whenever a price difference of atleast 0.3% occurs between any of the exchanges. Reports no more often than 60 seconds. The information is logged by default to /var/log/arbitrage-gossip/lunausdt.log
$ python arbitrage-gossip/main.py --base luna --quote usdt --report-to=twitter --cooldown=60 --threshold=0.3
  1. Monitor pair DOGEBUSD on each exchange that offers it and log everything that happens into /tmp/dogebusd.log (You should be careful with storage since debug level logging outputs a lot of information). Doesn't report to twitter.
$ python arbitrage-gossip/main.py --base doge --quote busd --log-file=/tmp/dogebusd.log --log-level=debug
  1. Monitor pair CAKEDAI on each exchange that offers it, and report to twitter whenever a price difference of atleast 3% occurs between any of the exchanges. Reports no more often than 10 seconds. Only errors are logged, as specified by --log-level. The information is logged in /root/cake.log, as specified by --log-file.
$ python arbitrage-gossip/main.py --base cake --quote dai --log-level=error --log-file=/root/cake.log --report-to=twitter --threshold=3 --cooldown=10

Troubleshooting

The program supports 4 levels of logging, in ascending order - debug, info, warning and error, as per the python's logging library.

  1. Use debug if you want to drown in information.
  2. Info is the default level, outputs everything necessary(recommended). Generally everything important is logged by default(info level), so that reading the log should give you a good idea of what the issue is.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK