Go to file
dd 1c16de7171 Send partial liquidate instruction just to force settle borrow 2021-06-22 09:36:15 -04:00
src Send partial liquidate instruction just to force settle borrow 2021-06-22 09:36:15 -04:00
.gitignore add notification webhook 2021-03-14 00:24:23 +01:00
LICENSE Initial commit 2021-03-09 08:20:27 -05:00
README.md Add better error handling for missing openOrders accounts, make readme more helpful 2021-04-30 13:49:48 +01:00
crank.sh crank.sh logs now to a logfile 2021-04-28 17:09:03 +00:00
package-lock.json add 1% bias to liquidator, to allow third parties to step in first, also improve discord logs 2021-03-16 12:35:07 +01:00
package.json Improve serum dex account management (#4) 2021-05-14 05:10:46 +03:00
tsconfig.json separated liquidator from mango repo 2021-03-09 08:32:07 -05:00
yarn.lock Improve serum dex account management (#4) 2021-05-14 05:10:46 +03:00

README.md

Mango Liquidator

Setup Partial Liquidator

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

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 TARGETS="0.1 2"
export GROUP_NAME="BTC_ETH_USDT"
export CHECK_INTERVAL="1000.0"

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

Run

yarn install
source .env
yarn partialLiquidate

Setup Full Liquidator [DEPRECATED]

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
yarn liquidate