4min
Liquidation Bot
Overview
- This bot is designed to perform liquidations on RageTrade perpetual protocol.
- Liquidator gets 1.5% (protocol parameter, can change) of the liquidated trader or liquidity position in USDC.
- RageTrade will be initially deployed on arbitrum, so some ETH is required to run the bot for paying network gas fees.
Strategy
- Query all created accounts on RageTrade
- For each account, check if the account has an open trader/liquidity position. If there is an open position and If account market value is less than the required margin, make a transaction to liquidate the position!
- Multiple addresses might be running bots, so it is likely that your liquidation transaction can revert if someone else liquidates before your transaction lands.
Setup
- Add WebSocket RPC URL and API key.
- Add your account's private key in PK_LIQUIDATTION in the config file.
- Edit LIQUIDATION_WEBHOOK_URL to receive notifications for bot events.
- Run yarn clean && yarn build & follow docker-compose.yml to build and deploy the container.