> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/drift-labs/protocol-v2/llms.txt
> Use this file to discover all available pages before exploring further.

# Keeper Instructions

> Keeper bot instructions in Drift Protocol

Keeper instructions are permissionless operations that maintain protocol health.

## Core Keeper Operations

### fill\_perp\_order

Fills a maker order against a taker.

```rust theme={null}
pub fn fill_perp_order(
    ctx: Context<FillOrder>,
    order_id: Option<u32>,
    // ... fill params
) -> Result<()>
```

### liquidate\_perp

Liquidates an undercollateralized position.

```rust theme={null}
pub fn liquidate_perp(
    ctx: Context<LiquidatePerp>,
    market_index: u16,
    // ... liquidation params
) -> Result<()>
```

### update\_funding\_rate

Updates funding rate for a market.

```rust theme={null}
pub fn update_funding_rate(
    ctx: Context<UpdateFundingRate>,
    market_index: u16,
) -> Result<()>
```

### settle\_pnl

Settles realized PnL for a position.

## Keeper Rewards

Keepers earn rewards for performing these operations:

* Order fills: Maker rebates
* Liquidations: Liquidation fees
* Funding updates: Protocol rewards

<Info>
  Anyone can run a keeper bot. See [keeper-bots-v2](https://github.com/drift-labs/keeper-bots-v2) for examples.
</Info>

<CardGroup cols={2}>
  <Card title="Liquidation Bot Example" href="/examples/liquidation-bot">
    Build a liquidation bot
  </Card>

  <Card title="Keeper Bots Repo" href="https://github.com/drift-labs/keeper-bots-v2">
    Example bot implementations
  </Card>
</CardGroup>
