2021-03-09 05:32:07 -08:00
|
|
|
# Mango Liquidator
|
|
|
|
|
2021-04-18 07:08:44 -07:00
|
|
|
## Setup Partial Liquidator
|
2021-04-30 05:49:48 -07:00
|
|
|
### Prerequisites
|
|
|
|
To run the liquidator you will need:
|
|
|
|
* A Solana account with some SOL deposited to cover transaction fees
|
|
|
|
* Token accounts for each currency in the Mango Group (e.g. BTC, ETH, USDT)
|
|
|
|
* Roughly equal deposits for each token. You will need base currencies to liquidate shorts, and quote currency to liquidate longs.
|
|
|
|
* Serum Dex OpenOrders accounts associated with your account. This is required for balance wallets functionality.
|
|
|
|
* The easiest way to set these up is by placing an order on Serum Dex for each currency pair then immediately cancelling it.
|
|
|
|
### Setup
|
2021-03-09 05:32:07 -08:00
|
|
|
Make sure to edit the .env file to look something like this:
|
|
|
|
```
|
|
|
|
export CLUSTER="mainnet-beta"
|
|
|
|
export CLUSTER_URL="https://solana-api.projectserum.com"
|
|
|
|
export KEYPAIR=~/.config/solana/id.json
|
|
|
|
export NODE_ENV=production
|
2021-04-18 07:08:44 -07:00
|
|
|
export TARGETS="0.1 2"
|
2021-04-10 14:29:35 -07:00
|
|
|
export GROUP_NAME="BTC_ETH_USDT"
|
2021-04-18 07:08:44 -07:00
|
|
|
export CHECK_INTERVAL="1000.0"
|
2021-03-09 05:32:07 -08:00
|
|
|
```
|
|
|
|
|
2021-04-18 07:08:44 -07:00
|
|
|
TARGETS represents the BTC and ETH amounts the partial liquidator should try to maintain
|
|
|
|
in the liquidator's wallet. Any excess of that amount in the wallet will be market sold on Serum DEX.
|
|
|
|
|
|
|
|
CHECK_INTERVAL is the amount of milliseconds to wait between querying all margin accounts
|
|
|
|
|
2021-04-10 14:29:35 -07:00
|
|
|
### Run
|
2021-03-09 05:32:07 -08:00
|
|
|
```
|
|
|
|
yarn install
|
|
|
|
source .env
|
2021-04-18 07:08:44 -07:00
|
|
|
yarn partialLiquidate
|
2021-04-10 14:29:35 -07:00
|
|
|
```
|
|
|
|
|
2021-04-18 07:08:44 -07:00
|
|
|
## Setup Full Liquidator [DEPRECATED]
|
2021-04-10 14:29:35 -07:00
|
|
|
Make sure to edit the .env file to look something like this:
|
|
|
|
```
|
|
|
|
export CLUSTER="mainnet-beta"
|
|
|
|
export CLUSTER_URL="https://solana-api.projectserum.com"
|
|
|
|
export KEYPAIR=~/.config/solana/id.json
|
|
|
|
export NODE_ENV=production
|
|
|
|
export GROUP_NAME="BTC_ETH_USDT"
|
|
|
|
```
|
|
|
|
|
|
|
|
### Run
|
|
|
|
```
|
|
|
|
yarn install
|
|
|
|
source .env
|
2021-04-18 07:08:44 -07:00
|
|
|
yarn liquidate
|
|
|
|
```
|