Activates when users want to check positions, PnL, trades, or activity for a Polymarket address. Provides commands to fetch portfolio data.
Install
npx skillscat add braindead-digital/polymarket-skills/polymarket-portfolio Install via the SkillsCat registry.
SKILL.md
Polymarket Portfolio
Position and activity tracking via Data API.
For foundational context, see
polymarket-references.
Get Positions
curl -s "https://data-api.polymarket.com/positions?user=ADDRESS&limit=100&sizeThreshold=0" | jq '.[] | {title, outcome, size, avgPrice, currentValue, cashPnl, percentPnl}'Get Portfolio Value
curl -s "https://data-api.polymarket.com/value?user=ADDRESS" | jqGet Closed Positions
curl -s "https://data-api.polymarket.com/v1/closed-positions?user=ADDRESS&limit=20" | jq '.[] | {title, outcome, realizedPnl}'Get Trade History
curl -s "https://data-api.polymarket.com/trades?user=ADDRESS&limit=50" | jq '.[] | {title, side, size, price, timestamp}'Get Activity (All Types)
curl -s "https://data-api.polymarket.com/activity?user=ADDRESS&limit=50" | jqFilter by type: TRADE, SPLIT, MERGE, REDEEM, REWARD
curl -s "https://data-api.polymarket.com/activity?user=ADDRESS&type=TRADE&limit=20" | jqGet USDC Balance
curl -s -X POST "https://polygon-rpc.com" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"to": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
"data": "0x70a08231000000000000000000000000ADDRESS_WITHOUT_0x"
}, "latest"],
"id": 1
}' | jq -r '.result' | xargs printf "%d\n" | awk '{print $1/1000000 " USDC"}'PnL Summary
ADDRESS="0x..."
echo "=== Open Positions ==="
curl -s "https://data-api.polymarket.com/positions?user=$ADDRESS&limit=100&sizeThreshold=0" | jq '[.[] | .cashPnl | tonumber] | add as $unrealized | {unrealized_pnl: $unrealized, position_count: length}'
echo "=== Closed Positions ==="
curl -s "https://data-api.polymarket.com/v1/closed-positions?user=$ADDRESS&limit=50" | jq '[.[] | .realizedPnl | tonumber] | add as $realized | {realized_pnl: $realized}'Python Alternative
import httpx
DATA = "https://data-api.polymarket.com"
def get_positions(address: str):
r = httpx.get(f"{DATA}/positions", params={"user": address, "limit": 100, "sizeThreshold": 0})
return r.json()
def get_portfolio_value(address: str):
r = httpx.get(f"{DATA}/value", params={"user": address})
return r.json()
def get_trades(address: str, limit: int = 50):
r = httpx.get(f"{DATA}/trades", params={"user": address, "limit": limit})
return r.json()
def get_activity(address: str, activity_type: str = None):
params = {"user": address, "limit": 50}
if activity_type:
params["type"] = activity_type
r = httpx.get(f"{DATA}/activity", params=params)
return r.json()
def get_pnl(address: str):
positions = get_positions(address)
unrealized = sum(float(p.get("cashPnl") or 0) for p in positions)
return {"unrealized_pnl": unrealized, "open_positions": len(positions)}Quick Portfolio Check
ADDRESS="0x..."
echo "Positions:" && curl -s "https://data-api.polymarket.com/positions?user=$ADDRESS&limit=5&sizeThreshold=1" | jq '.[] | "\(.title): \(.size) @ \(.avgPrice) = $\(.currentValue) (\(.percentPnl)%)"'