Skip to Content
DevelopersTrading Automation

Trading Automation

Trading Automation covers both trading workflows (SDK-first integrations) and bots (automation and keepers). It’s the single home for the trader/bot target group.

  • Keeper bots: protocol maintenance (matching, triggers, liquidations).
  • Trading bots: profit-seeking strategies (e.g. JIT market making).

The reference implementation for keeper bots is apps/keeper-bots-v2 in the velocity-v1 monorepo, and most examples below follow that app’s config + entrypoint pattern. 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.

Pick your path

Trading workflows (SDK-first):

Keeper bots (protocol-critical):

Bot TypeDifficultyCapital RequiredLink
Matching BotBasicNoTutorial: Order Matching Bot
Order TriggerBasicNoTutorial: Order Trigger Bot
LiquidatorAdvancedYesTutorial: Liquidation Bot

Trading bots (strategy-driven):

Bot TypeDifficultyCapital RequiredLink
JIT Maker BotAdvancedYesTutorial: JIT Maker Bot

Rewards vary by bot and duty performed — see each bot’s tutorial page, or Keeper Incentives for how the protocol compensates keepers.

Prepare environment + wallet

All bots require a funded wallet for fees, and some require collateral. See Bot wallet below to set one up, and pick an RPC provider that supports what bots need.

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 the bot

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

cd apps/keeper-bots-v2 cp .env.example .env
  • KEEPER_PRIVATE_KEY: keypair array or path to keypair.json
  • ENDPOINT: RPC endpoint
  • ENV: devnet or mainnet-beta

The app also uses a YAML config (see example.config.yaml in the app directory). At minimum, set:

  • global.endpoint (RPC URL)
  • global.keeperPrivateKey (keypair or env var)
  • enabledBots + corresponding botConfigs

Initialize a Velocity user (if needed)

Bots that place orders or manage positions require a Velocity user account. From apps/keeper-bots-v2, you can use the built-in flag:

bun run dev --init-user

Or do the same from your own SDK code:

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 (USDT on mainnet-beta; dUSDT on devnet) bun run dev --force-deposit 10000

Run and monitor

Start the process with your config:

bun run dev --config-file=example.config.yaml

Monitor logs for resubscribe messages and track your RPC latency. Some deployments also expose Prometheus metrics.

Troubleshoot common issues

Common issues (missing USDT ATA, user not initialized, RPC limits) are covered in:

Bot wallet

Bots require a private key in order to sign transactions. The private key is stored in a wallet file and can either be in base58 format, or a numbers array format.

Generate a fresh keypair

  1. Download and install the Solana CLI .

  2. Create a new keypair file named new_keypair.json:

    solana-keygen new -o new_keypair.json

    This will contain a new keypair in JSON format.

Export a keypair from a browser wallet

Alternatively you may export the private key from an existing browser wallet such as Phantom.

Key security

Treat a bot’s private key like any other production secret:

  • Never commit a keypair file or raw private key to version control.
  • Prefer loading the key from an environment variable or a secret manager rather than a plaintext file on disk.
  • Use a dedicated hot wallet for the bot, funded only with what it needs for fees (and collateral, if required), rather than reusing a wallet that holds other funds.

RPC providers

Solana utilizes a network of RPC Nodes  to serve data to users. These nodes require a lot of resources to run and therefore can be quite expensive to operate.

Some of the commonly used free RPC providers are insufficient for operating Velocity bots because we require some functions that are commonly disabled (i.e. websockets and getProgramAccounts). Helius  has a generous free plan that is sufficient for getting started. But consider upgrading to a paid plan as you get more serious with operating bots on Velocity or Solana in general.

Bots also rely on programSubscribe and websocket subscriptions to receive timely account updates (for example, the JIT maker bot uses programSubscribe to find fillable orders — see JIT Maker Bot); confirm your provider supports these before committing to a plan.

A more complete list of providers is available here .

Last updated on