Skip to content

kunalabs-io/kai-liquidation-bot-example

Repository files navigation

Liquidation bot @kunalabs-io/kai

An example of TypeScript-based liquidation bot for the Kai Finance protocol (https://kai.finance). This bot monitors lp positions and executes liquidations when necessary.

Architecture Overview

The bot consists of three core components working in sequence:

  1. Rpc Position Monitor: Watches and polls the chain for liquidatable positions
  2. Liquidation Controller: Processes detected positions and makes execution decisions
  3. Flash Swap Executor: Handles the actual liquidation transactions using flash swaps

For detailed arhitecture reference, see the Kai Finance Liquidation Framework.

The implementation includes Prometheus metrics integration for monitoring

Installation

Install dependencies:

pnpm install
pnpm build

Add the environment variable PRIVATE_KEY to get a keypair by following the Mysten Labs SDK guide

Usage

Run the bot using the following command:

pnpm start

Note: Execution of first poll might be slower until cache initialization

Metrics

The bot exposes Prometheus metrics on port 9284. You can access the metrics at:

http://localhost:9284/metrics

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •