Skip to content

Trading

Buy, sell, and redeem Polymarket prediction market shares.

Prerequisites

Trading requires a trade server URL and an access token.

  • Trade server URL resolves in this order: --trade-server-url flag > trade_server_url in ~/.bullpen/config.toml > environment default (production or staging).
  • Access token resolves in this order: --access-token flag > stored credentials from bullpen auth login.

For most users, logging in with bullpen auth login is sufficient -- the CLI will use your stored credentials and the default trade server automatically.

Buy

Buy shares on a prediction market outcome.

bullpen prediction polymarket buy <MARKET_SLUG> <OUTCOME> <AMOUNT_USD> \
  --address 0xABC... --yes

Example:

bullpen prediction polymarket buy will-btc-reach-100k "Yes" 10.00 \
  --address 0xABC... --yes

The command first shows a trade preview, then executes if --yes is set:

Buy Yes on "Will BTC reach $100K by March?"
Price: 65¢  |  Amount: $10.00
Est. shares: 15.38  |  Potential: $15.38
Spread: 1.2¢

Order submitted successfully (ID: abc123)
Filled: 15.38 @ 65¢

Without --yes, the preview is shown and you are prompted to confirm interactively (Confirm trade? [y/N]:). Entering anything other than y cancels the trade.

Sell

Sell shares on a prediction market outcome.

bullpen prediction polymarket sell <MARKET_SLUG> <OUTCOME> <SHARES> \
  --address 0xABC... --yes

Example:

bullpen prediction polymarket sell will-btc-reach-100k "Yes" 15.38 \
  --address 0xABC... --yes

Preview output:

Sell Yes on "Will BTC reach $100K by March?"
Price: 68¢  |  Amount: $10.46

Redeem

Redeem resolved prediction market positions. Collect winnings for markets that have settled.

bullpen prediction polymarket redeem \
  --address 0xABC... \
  --condition-ids id1,id2,id3 \
  --yes
Flag Description
--address Wallet address (required)
--condition-ids Comma-separated condition IDs to redeem (required)
--yes Skip confirmation prompt
--trade-server-url Override trade server URL
--access-token Override access token

Without --yes, the CLI lists the condition IDs and prompts for confirmation (Confirm redeem? [y/N]:).

To find redeemable condition IDs, check your positions:

bullpen prediction polymarket positions --address 0xABC... --redeemable --output json

Limit Buy

Place a limit buy order at a specific price.

bullpen prediction polymarket limit-buy <MARKET_SLUG> <OUTCOME> \
  --price 0.45 --shares 20 --address 0xABC... --yes
Flag Description
--price Limit price between 0.01 and 0.99 (e.g., 0.45 for 45 cents) (required)
--shares Number of shares (required)
--expiration Order expiration: gtc (good-til-cancelled, default) or eod (end-of-day)
--address Wallet address (required)
--yes Skip confirmation prompt
--trade-server-url Override trade server URL
--access-token Override access token

Example:

bullpen prediction polymarket limit-buy will-btc-reach-100k "Yes" \
  --price 0.55 --shares 50 --expiration gtc --address 0xABC... --yes

Limit Sell

Place a limit sell order at a specific price.

bullpen prediction polymarket limit-sell <MARKET_SLUG> <OUTCOME> \
  --price 0.65 --shares 15 --address 0xABC... --yes
Flag Description
--price Limit price between 0.01 and 0.99 (e.g., 0.65 for 65 cents) (required)
--shares Number of shares (required)
--expiration Order expiration: gtc (good-til-cancelled, default) or eod (end-of-day)
--address Wallet address (required)
--yes Skip confirmation prompt
--trade-server-url Override trade server URL
--access-token Override access token

Example:

bullpen prediction polymarket limit-sell will-btc-reach-100k "Yes" \
  --price 0.70 --shares 15 --expiration eod --address 0xABC... --yes

Trade Preview

Every buy, sell, limit-buy, and limit-sell command shows a preview before executing. The preview includes:

Field Description
Side Buy or Sell
Outcome The outcome being traded (e.g., "Yes")
Market The market question
Price Current price in cents
Amount USD value of the trade
Est. shares Estimated shares to receive (buy only)
Potential Potential payout if outcome wins (buy only)
Spread Bid-ask spread in cents (buy only)

Exit Codes

Code Meaning
0 Success
1 General error (invalid args, network, etc.)
3 Trade failed (order rejected by exchange)

JSON Output

All trading commands support --output json for programmatic consumption:

bullpen prediction polymarket buy will-btc-reach-100k "Yes" 10.00 \
  --address 0xABC... --yes --output json