bmstar2012 / keeper-bots-v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keeper Bots for Drift Protocol v2

Docs Discord Chat License

Setting up

Setup Environment

cp .env.example .env

Update values in .env accordingly

KEEPER_PRIVATE_KEY: can be a number array (as in example), or a path to a keypair.json as generated by solana-keygen. The address of this key requires SOL since it will be the signing authority of all transactions sent by this bot.

Initialize User

A ClearingHouseUser must be created before interacting with the ClearingHouse program.

yarn run dev --init-user

Depositing Collateral

Some bots (i.e. trading, liquidator and JIT makers) require collateral in order to keep positions open, a helper function is included to help with depositing collateral. A user must be initialized first before collateral may be deposited.

# deposit 10,000 USDC
yarn run dev --force-deposit 10000

Run Bots

By default, some Prometheus metrics are exposed on localhost:9464/metrics.

Run Filler Bot

yarn
yarn run dev:filler

Run Trigger Bot

yarn
yarn run dev:filler

Run JIT Maker Bot

⚠ requires collateral (you dont want to run this as is)

yarn
yarn run dev:jitmaker

Run Liquidator Bot

Read the docs: https://docs.drift.trade/liquidators

By default the liquidator will attempt to liqudate (inherit the risk of) endangered positions in all markets. Pass --perp-markets or --spot-markets flags to restrict which markets you want to liquidate.

You can also specify which subaccountId you want to use via the --subaccount flag (the main subaccount 0 is default).

Example - default mode (liquidate all markets):

yarn run dev --liquidator

Example - default mode (liquidate SOL-PERP, BTC-PERP and SOL spot):

yarn run dev --liquidator --perp-markets 0,1 --spot-markets 0

About

License:Apache License 2.0


Languages

Language:TypeScript 99.2%Language:Shell 0.6%Language:Dockerfile 0.1%Language:JavaScript 0.1%