|
1 | 1 | # Market Maker Tools
|
2 | 2 |
|
3 | 3 | ## Arby
|
4 |
| -A market making bot that allows its users to easily arbitrage between OpenDEX and centralized exchanges. |
| 4 | +Arby is a market maker bot that allows to easily arbitrage between [OpenDEX](http://opendex.network/) and centralized exchanges like [Binance](https://www.binance.com). In other words, anyone with capital to spare is able to "earn interest" on their assets by running arby and providing liquidity to the OpenDEX network. |
5 | 5 |
|
6 |
| -Arby looks for arbitrage opportunities on the OpenDEX network. It will enter active orders with the configured margin to the orderbook and updates them as soon as the price changes. |
| 6 | +The overall goal of Arby is to pull liquidity from centralized exchanges into OpenDEX and incentivize this process financially. |
| 7 | + |
| 8 | +### How it works |
| 9 | +Arby looks for arbitrage opportunities on the OpenDEX network. It issues orders on OpenDEX based on the price of a connected centralized exchange, adding the configured `margin` on top. It will update the orders as soon as the price on the centralized exchange changes. |
| 10 | + |
| 11 | +Trades on OpenDEX are settled in seconds. This allows arby to execute the counter trade on the connected centralized exchange right after an order is settled on OpenDEX. Since the order on OpenDEX was issued with an additional margin, the trade on the centralized exchange can almost always be settled for a significantly better price. The price difference between the two trades is the profit (the "interest") arby generates. |
| 12 | + |
| 13 | +Example with real numbers: |
| 14 | + |
| 15 | +- Balances before starting Arby |
| 16 | + |
| 17 | +| Currency | OpenDEX | Binance | |
| 18 | +| -------- | ------- | ------- | |
| 19 | +| BTC | 1.0 | 1.0 | |
| 20 | +| USDT | 11000 | 11000 | |
| 21 | + |
| 22 | +- Total BTC balance between OpenDEX and Binance `1.0 + 1.0 = 2.0 BTC` |
| 23 | +- Total USDT balance between OpenDEX and Binance `11000 + 11000 = 22000 USDT` |
| 24 | + |
| 25 | +--- |
| 26 | +- Arby is started for BTC/USDT trading pair with 3% margin. The configured centralized exchange is Binance. |
| 27 | +- Balance on OpenDEX is 1 BTC and 1 BTC on Binance |
| 28 | +- USDT balance on OpenDEX is 10000 USDT and 10000 USDT on Binance |
| 29 | +- Arby monitors the latest price of BTC/USDT on Binance. The latest price is $10000. |
| 30 | +- Arby creates/updates the buy order on OpenDEX for `10000 - 0.03 * 10000 = $9700`. |
| 31 | +- Arby creates/updates the sell order on OpenDEX for `10000 * 1.03 = $10300`. |
| 32 | +- Whenever the latest price on Binance changes, Arby updates the orders on OpenDEX accordingly. |
| 33 | + |
| 34 | +##### Scenario A |
| 35 | +- OpenDEX buy order is filled and settled for 1 BTC ($9700). |
| 36 | +- Arby issues a sell order on Binance for 0.97 BTC ($9700), locking in 0.03 BTC ($300) profit. |
| 37 | +- Balances after scenario A |
| 38 | + |
| 39 | +| Currency | OpenDEX | Binance | |
| 40 | +| -------- | ------- | ------- | |
| 41 | +| BTC | 2.0 | 0.03 | |
| 42 | +| USDT | 1300 | 20700 | |
| 43 | + |
| 44 | +- Total BTC balance between OpenDEX and Binance `2.0 + 0.03 = 2.03 BTC` (0.03 BTC yield) |
| 45 | +- Total USDT balance between OpenDEX and Binance `1300 + 20700 = 22000 USDT` |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +##### Scenario B |
| 50 | +- OpenDEX sell order is filled and settled for 1 BTC ($10300) |
| 51 | +- Arby issues a buy order on Binance for 1.03 ($10300), locking in 0.03 BTC ($300) profit. |
| 52 | + |
| 53 | +| Currency | OpenDEX | Binance | |
| 54 | +| -------- | ------- | ------- | |
| 55 | +| BTC | 0 | 2.03 | |
| 56 | +| USDT | 21300 | 700 | |
| 57 | + |
| 58 | +Total BTC balance between OpenDEX and Binance `2.0 + 0.03 = 2.03 BTC` (0.03 BTC yield) |
| 59 | +Total USDT balance between OpenDEX and Binance `21300 + 700 = 22000 USDT` |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +### FAQ |
| 64 | + |
| 65 | +#### Which exchanges are supported? |
| 66 | +Currently, only Binance is supported. Kraken and Bitfinex are next on the roadmap. |
| 67 | + |
| 68 | +https://github.com/ExchangeUnion/market-maker-tools/issues/59 |
| 69 | + |
| 70 | +#### What happens if I lose connectivity to Binance? |
| 71 | +Arby will automatically remove all orders on OpenDEX until connection is re-established. |
| 72 | + |
| 73 | +#### What happens if the order quantity is too big to execute on Binance? |
| 74 | +Arby will not execute trades on OpenDEX that it cannot counter-trade on Binance. |
| 75 | + |
| 76 | +#### What happens when the order quantity is too small to execute on Binance? |
| 77 | +Arby will automatically accumulate the traded quantity on OpenDEX and only execute an order on Binance when it is greater than or equal to the minimum amount on Binance. |
| 78 | + |
| 79 | +#### Is it possible to configure Arby to take profits in non-BTC assets? |
| 80 | +Support for taking profits in other assets (ETH, DAI, USDT etc.) is technically supported, but currently not enabled. |
| 81 | + |
| 82 | +#### What about rebalancing between centralized exchange and OpenDEX balances? |
| 83 | +Support for automatic rebalancing of the assets is planned in the upcoming releases. |
7 | 84 |
|
8 | 85 | ### Setup instructions
|
| 86 | +Recommended way of running Arby is by following the [market maker guide](https://docs.exchangeunion.com/start-earning/market-maker-guide). |
| 87 | + |
| 88 | +#### Development Setup |
| 89 | +The setup guide below is **only** for development purposes. Please refer to the guide above for production use. |
| 90 | + |
| 91 | +The development mode assumes a working [xud](https://github.com/ExchangeUnion/xud) setup with functioning swap clients for all currencies Arby is configured to use. |
9 | 92 |
|
10 |
| -#### Requirements |
11 |
| -- Node v12.18.0 |
| 93 | +##### Requirements |
| 94 | +- Node v12.18.0+ |
12 | 95 |
|
13 |
| -#### Install dependencies |
| 96 | +##### Install dependencies |
14 | 97 | `npm i`
|
15 | 98 |
|
16 |
| -#### Configuration |
| 99 | +##### Configuration |
17 | 100 | Copy `.env-example` to `.env`
|
18 | 101 |
|
19 |
| -#### Start in development mode |
| 102 | +##### Start in development mode |
20 | 103 | `npm run dev:arby`
|
21 | 104 |
|
22 |
| -#### Tests |
| 105 | +##### Tests |
23 | 106 | `npm run test`
|
24 | 107 | or
|
25 | 108 | `npm run test:watch` to continuously run the tests.
|
26 | 109 |
|
27 | 110 | ### Disclaimer
|
28 |
| -This is alpha software. Please be extra careful when using this on mainnet. |
| 111 | +This is alpha software. Please be extra careful when using this on the mainnet. |
0 commit comments