Skip to content

Commit

Permalink
arbs
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mk committed Jan 18, 2024
1 parent 4202735 commit e2291d8
Show file tree
Hide file tree
Showing 4 changed files with 356 additions and 14 deletions.
43 changes: 30 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,36 @@ Getting prices...
[ binance-RPLUSDT] 29.94
```

You can also check arbitrages - same ticker traded on different exchanges. `pri` will report highest and lowest price and spread.
```
./pri a! btc-usdt
coinbase-BTC-USDT
huobi-btcusdt
kucoin-BTC-USDT
binance-BTCUSDT
gateio-BTC_USDT
bitfinex-BTCUST
bybit-BTCUSDT
kraken-XBTUSDT
okx-BTC-USDT
Getting prices...
[bitfinex-BTCUST] 41,893.00
[coinbase-BTC-USDT] 41,883.71
[ bybit-BTCUSDT] 41,894.25
[ kraken-XBTUSDT] 41,889.45
[ okx-BTC-USDT] 41,887.95
[ huobi-btcusdt] 41,894.04
[kucoin-BTC-USDT] 41,891.95
[gateio-BTC_USDT] 41,892.05
[binance-BTCUSDT] 41,892.10
name: btc-usdt
min: [coinbase-BTC-USDT] 41,883.71
max: [ bybit-BTCUSDT] 41,894.25
spread: 0.025%
```




## TODO
- automate asset list compilation
- make arbitrage groups, like
```golang
var btcUsdtTickers = []ExTick{
{"coinbase", "BTC-USD"},
{"binance", "BTCUSDT"},
{"kraken", "XBTUSDT"},
{"bitstamp", "btcusdt"},
{"huobi", "btcusdt"},
{"kucoin", "BTC-USDT"},
{"gateio", "BTC_USDT"},
{"bitfinex", "btcust"},
}
```
129 changes: 129 additions & 0 deletions arbs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package main

import (
"fmt"
"strings"
)

func ExTicksFromSlice(ticks []string) ([]ExTick, error) {
var exTicks []ExTick
for _, tick := range ticks {
split := strings.SplitN(tick, "-", 2)
if len(split) != 2 {
return nil, fmt.Errorf("invalid tick: %s", tick)
}
exchange := split[0]
ticker := split[1]
exTick := ExTick{Exchange(exchange), ticker}
exTicks = append(exTicks, exTick)
}
return exTicks, nil
}


var arbs = map[string][]string{
"eth-btc": {
"binance-ETHBTC",
"bitfinex-ETHBTC",
"coinbase-ETH-BTC",
"gateio-ETH_BTC",
"huobi-ethbtc",
"kraken-XETHXXBT",
"kucoin-ETH-BTC",
"okx-ETH-BTC",
//"bitstamp-ETH/BTC",
},
"btc-usdt": {
"coinbase-BTC-USDT",
//"bitstamp-BTC/USDT",
"huobi-btcusdt",
"kucoin-BTC-USDT",
"binance-BTCUSDT",
"gateio-BTC_USDT",
"bitfinex-BTCUST",
"bybit-BTCUSDT",
"kraken-XBTUSDT",
"okx-BTC-USDT",
},
"eth-usdt": {
"binance-ETHUSDT",
"bitfinex-ETHUST",
// bitstamp-ETH/USDT,
"bybit-ETHUSDT",
"coinbase-ETH-USDT",
"gateio-ETH_USDT",
"huobi-ethusdt",
"kraken-ETHUSDT",
"kucoin-ETH-USDT",
"okx-ETH-USDT",
},
"bnb-btc": {
"binance-BNBBTC",
"kucoin-BNB-BTC",
"gateio-BNB_BTC",
},
"bnb-usdt": {
"kucoin-BNB-USDT",
"bybit-BNBUSDT",
"okx-BNB-USDT",
"binance-BNBUSDT",
"huobi-bnbusdt",
"gateio-BNB_USDT",
},
"sol-btc": {
"coinbase-SOL-BTC",
"huobi-solbtc",
"binance-SOLBTC",
"bitfinex-SOLBTC",
"okx-SOL-BTC",
},
"sol-usdt": {
"kraken-SOLUSDT",
"kucoin-SOL-USDT",
"gateio-SOL_USDT",
"okx-SOL-USDT",
"bitfinex-SOLUST",
"bybit-SOLUSDT",
"coinbase-SOL-USDT",
"binance-SOLUSDT",
"huobi-solusdt",
},
"sol-eth": {
"coinbase-SOL-ETH",
"kraken-SOLETH",
"okx-SOL-ETH",
"binance-SOLETH",
},
"xrp-btc": {
//"bitstamp-XRP/BTC",
"huobi-xrpbtc",
"kucoin-XRP-BTC",
"gateio-XRP_BTC",
"bitfinex-XRPBTC",
"binance-XRPBTC",
"okx-XRP-BTC",
},
"xrp-usdt": {
"binance-XRPUSDT",
"huobi-xrpusdt",
"kucoin-XRP-USDT",
"okx-XRP-USDT",
"coinbase-XRP-USDT",
//"bitstamp-XRP/USDT",
"gateio-XRP_USDT",
"bitfinex-XRPUST",
"bybit-XRPUSDT",
"kraken-XRPUSDT",
},
"btc-usdc": {},
"ada-btc": {},
"ada-usdt": {},
"avax-btc": {},
"avax-usdt": {},
"doge-btc": {},
"doge-usdt": {},
"trx-btc": {},
"trx-usdt": {},
"dot-btc": {},
"dot-usdt": {},
}
4 changes: 4 additions & 0 deletions consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ package main
var findCommands = []string{
"f", "fi", "fin", "find", "f!", "fi!", "fin!", "find!",
}

var arbitrageCommands = []string{
"a", "ar", "arb", "a!", "ar!", "arb!",
}
Loading

0 comments on commit e2291d8

Please sign in to comment.