For the complete documentation index, see llms.txt. This page is also available as Markdown.

Polymarket Liquidity Pool Farming Bot

Polymarket LP Farm Bot: User Documentation

1. Overview

The Polymarket LP Farm Bot is an automated trading script designed to provide liquidity (LP) on Polymarket orderbooks. Instead of directional betting, the bot acts as a short-term liquidity provider. It places passive limit orders, monitors the orderbook, and dynamically adjusts or exits its positions based on the configured strategy.


2. Core Behavior & Execution Flow

When the bot is started, it follows a continuous loop:

  1. Market Identification It either connects to a specific market directly or scans for an active market matching predefined asset and timeframe traits

  2. Order Placement It quotes a price and size on one or both sides of the market (Yes/No)

  3. Monitoring & Repositioning The bot watches the orderbook. If its orders fall too far behind or market depth drops below safe levels, it cancels and replaces the orders to maintain its target position

  4. Execution & Exit (Post-Fill) When an order is filled, the bot switches from placing passive liquidity to executing an exit strategy—either quickly escaping the position, working a limit exit, or attempting to capture the spread by merging the opposite side


3. Parameter Configuration Guide

3.1 Market Selection

How the bot knows where to trade.

  • market_slug The direct identifier of a market. If provided, the bot bypasses automatic selection and operates only here

  • asset e.g., btc, eth. Used for auto-selection to find relevant markets

  • period e.g., 15, 60 (in minutes). Defines the duration/expiry window of the market

    If market_slug is empty, the bot will scan Polymarket for a market matching the asset and period and automatically deploy there.

    ---

3.2 Strategy & Positioning

How the bot decides where to place its orders.

  • side

    • buy: Provides liquidity on the first outcome

    • sell: Provides liquidity on the second outcome

    • all: Engages in dual-sided market making (quoting both Yes and No)

  • target_price_mode

    • rank: The bot targets a specific position in the orderbook queue (e.g., 1 for the front of the queue, 2 for the second best price)

    • cents: The bot stays a fixed dollar amount away from the best price (e.g., 2 cents behind the top bid)

  • target_price_value The numerical input for the chosen mode

    The bot will constantly attempt to maintain this specific pricing requirement. If the market moves away, the bot will pull its old order and place a new one at the new target level.

    ---

3.3 Sizing and Safety Limits

How the bot protects capital and manages trade size.

  • order_size_mode

    • shares: The bot bids for a fixed amount of contract shares

    • usd: The bot places dollar-denominated orders, adjusting the share amount based on the current price

  • order_size_value The numerical size value

  • min_orderbook_size_mode Defines a required liquidity threshold in the market before the bot will participate (modes: none, shares, usd)

  • min_orderbook_size_value The minimum required liquidity

    If min_orderbook_size is not met, the bot considers the market temporarily unsafe/too thin, cancels any active LP orders at that level, and waits until the depth thickens up.

  • refresh_interval_sec Forces the bot to restart its order process after X seconds, adding activity and preventing stale orders


3.4 Post-Fill Execution (Exit Strategy)

How the bot behaves after someone takes its liquidity.

  • exit_mode

    • limit: The bot attempts a controlled exit by placing a limit order at an advantageous price, working the book until closed

    • market: The bot rushes to close the position immediately at the best available market price

    • merge: For dual-sided strategies. Instead of closing, the bot completes the market by buying the opposite outcome side, thus guaranteeing the spread without directional risk

  • exit_target_price_mode & exit_target_price_value Function identical to the entry pricing parameters, determining the strict price target when the bot places a limit exit


3.5 System (in development)

  • dry_run Set to live for real capital deployment, or dry_run for simulated actions allowing you to observe bot logs without financial risk


Last updated