Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/deniszidbaev-cmyk/polyclaw-cmyk/llms.txt

Use this file to discover all available pages before exploring further.

PolyClaw records every trade in a local JSON file at ~/.openclaw/polyclaw/positions.json. The positions commands read that file, fetch current prices from the Gamma API, and compute live profit/loss for each entry. You can also add positions manually (for importing legacy trades), close them, or delete records.

polyclaw positions

Lists your positions with live P&L fetched from the Gamma API. Usage
polyclaw positions [--all] [--json]
Flags
--all
boolean
Include closed positions in the output. By default only open positions are shown.
--json
boolean
Output as a JSON array instead of a formatted table.
Example — table output
polyclaw positions
ID         Side  Entry    Now    P&L        Market
--------------------------------------------------------------------------------
a1b2c3d4   YES   $0.68   $0.72  +$2.00    Will X happen by end of year?...
e5f6g7h8   NO    $0.32   $0.28  +$1.14    Will Y be announced in Q3?...
--------------------------------------------------------------------------------
Total: 2 positions | Value: $71.14 | P&L: +$3.14

1 resolved position(s) pending redemption — run `polyclaw redeem list`.
The table columns are:
ColumnDescription
IDFirst 8 characters of the position UUID
SideYES or NO
EntryEffective entry price after accounting for CLOB sell recovery
NowCurrent market price from Gamma API
P&LAbsolute profit/loss in USD
MarketTruncated market question (first 35 chars)
At the bottom, totals show position count, total current value, and aggregate P&L. If any resolved markets have unredeemed winning tokens, a reminder to run polyclaw redeem list is shown.

polyclaw position <position_id>

Shows full details for a single position, including all stored fields and a live P&L breakdown. Usage
polyclaw position <position_id>
Parameters
position_id
string
required
Position ID prefix. As few as 8 characters are sufficient as long as the prefix is unambiguous. The full UUID is shown in polyclaw positions output.
Example
polyclaw position a1b2c3d4
{
  "position_id": "a1b2c3d4-...",
  "market_id": "abc123...",
  "question": "Will X happen by end of year?",
  "position": "YES",
  "token_id": "0x111...",
  "entry_time": "2025-06-01T14:32:00+00:00",
  "entry_amount": 50.0,
  "entry_price": 0.65,
  "split_tx": "0xabc...",
  "clob_order_id": "0xc93d...",
  "clob_filled": true,
  "status": "open",
  "condition_id": "0xdef...",
  "redeem_tx": null,
  "pnl_info": {
    "current_price": 0.72,
    "entry_price": 0.65,
    "effective_entry": 0.682,
    "current_value": 36.0,
    "cost_basis": 34.0,
    "pnl": 2.0,
    "pnl_pct": 5.88,
    "market_active": true,
    "market_resolved": false,
    "market_outcome": null
  }
}

How P&L is calculated

Token count equals entry_amount because the CTF split always mints 1 token per $1 deposited.
1

Determine actual cost basis

If the CLOB sell filled (clob_filled: true), the cost is reduced by the approximate recovery: actual_cost = entry_amount − (token_count × unwanted_price × 0.9). The 0.9 factor models approximately 10% slippage from the FOK discount.If the CLOB sell did not fill, actual_cost = entry_amount (full split amount).
2

Calculate current value

current_value = token_count × current_pricecurrent_price is the live YES or NO price from the Gamma API, depending on your position side.
3

Compute P&L

pnl = current_value − actual_costpnl_pct = (pnl / actual_cost) × 100

Position data

Positions are stored locally in ~/.openclaw/polyclaw/positions.json. Each entry contains:
FieldTypeDescription
position_idstringUUID assigned at trade time
market_idstringPolymarket market ID
questionstringMarket question text
positionstring"YES" or "NO"
token_idstringERC-1155 token ID for the purchased outcome
entry_timestringISO 8601 timestamp of trade execution
entry_amountfloatUSD amount deposited in the split
entry_pricefloatMarket price at entry
split_txstringOn-chain splitPosition transaction hash
clob_order_idstring | nullCLOB order identifier (off-chain)
clob_filledboolWhether the FOK sell was matched
statusstring"open", "closed", or "resolved"
condition_idstringCTF condition ID (used for redemption)
redeem_txstring | nullTransaction hash once redeemed, or null

Advanced subcommands

positions add

Manually add a position record. Useful for importing trades executed outside of PolyClaw.
polyclaw positions add <market_id> YES|NO <amount> <price> [--question Q] [--token-id T] [--tx H]
market_id
string
required
Market ID.
YES|NO
string
required
Position side.
amount
float
required
Entry amount in USD.
price
float
required
Entry price (0–1).
--question
string
Market question text (defaults to "Manual entry").
--token-id
string
ERC-1155 token ID for the outcome.
--tx
string
Transaction hash (defaults to "manual").

positions close

Mark a position as closed without deleting the record.
polyclaw positions close <position_id>

positions delete

Permanently delete a position record from local storage. Prompts for confirmation unless --force is used.
polyclaw positions delete <position_id> [--force]
--force
boolean
Skip the [y/N] confirmation prompt. Also accepts -f.

Build docs developers (and LLMs) love