Skip to Content
DevelopersTrading AutomationKeeper BotsKeeper Bots

Keeper Bots

Keeper bots keep Velocity operational by performing automated actions as off-chain agents. Keepers are rewarded depending on the duties they perform.

Bot TypeDifficultyCapital RequiredRewardsLink
Matching BotBasicNoTBDTutorial: Order Matching Bot
Order TriggerBasicNoTBDTutorial: Order Trigger Bot
LiquidatorAdvancedYesTBDTutorial: Liquidation Bot
JIT Maker BotAdvancedYesTBDTutorial: JIT Maker Bot

Note: all bots require some SOL for rent and transaction fees.

The reference implementation lives at apps/keeper-bots-v2 inside the velocity-v1 monorepo — unlike Drift’s standalone keeper-bots-v2 repo, there is no separate devnet/mainnet-beta branch split; the app’s ENV config value selects the cluster.

Clone the monorepo and install

git clone https://github.com/velocity-exchange/velocity-v1.git cd velocity-v1 bun install # run once, at the repo root — this is a Bun workspace

Configure environment + YAML config

From apps/keeper-bots-v2, copy the env template and set required values:

cd apps/keeper-bots-v2 cp .env.example .env

Required env vars:

  • KEEPER_PRIVATE_KEY: keypair array or path to keypair.json
  • ENDPOINT: RPC endpoint
  • ENV: devnet or mainnet-beta

The app uses a YAML config for bot selection and per-bot settings. Start from example.config.yaml and set:

  • global.endpoint
  • global.keeperPrivateKey (or env var)
  • enabledBots + botConfigs

Initialize a Velocity user (if needed)

Bots that place orders or manage positions require a Velocity user account. The app provides a helper flag:

bun run dev --init-user
if (!(await velocityClient.getUser().exists())) { logger.info(`Creating User for ${wallet.publicKey}`); const [txSig] = await velocityClient.initializeUserAccount(); logger.info(`Initialized user account in transaction: ${txSig}`); }

Deposit collateral (if needed)

Required for liquidators and JIT makers that keep open positions:

# deposit 10,000 of spot market 0's quote asset (USDC on mainnet-beta; dUSDT on devnet) bun run dev --force-deposit 10000

Run the bots

bun run dev --config-file=example.config.yaml
Last updated on