install
source · Clone the upstream repo
git clone https://github.com/HubbleVision/polyhub-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HubbleVision/polyhub-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/openclaw/skills/polyhub_account" ~/.claude/skills/hubblevision-polyhub-skills-polyhub-account-7dc0e2 && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HubbleVision/polyhub-skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/openclaw/skills/polyhub_account" ~/.openclaw/skills/hubblevision-polyhub-skills-polyhub-account-7dc0e2 && rm -rf "$T"
manifest:
openclaw/skills/polyhub_account/SKILL.mdsource content
Polyhub Account Skill
Version: v0.3.8
When to use
Use this skill when the user asks about:
- Portfolio overview or stats
- Selling a position by token ID
Requirements
is fixed toPOLYHUB_API_BASE_URL
.https://polyhub.skill-test.bedev.hubble-rpc.xyz
— API key (must start withPOLYHUB_API_KEY
)phub_
must be available in the runtime environment.curl
is strongly recommended for building JSON payloads safely.jq
If
POLYHUB_API_KEY is missing, guide the user to register and apply for one first at https://polyhub.hubble.xyz/.
Recommended guidance:
- Open Polyhub Web:
https://polyhub.hubble.xyz/ - Click the avatar menu.
- Open
.Skills API Key - Click
.申请 API Key - Set both
andPOLYHUB_API_BASE_URL
.POLYHUB_API_KEY
Suggested wording:
API key is not configured yet, so I can't check your account details for now. Please register first on PolyHub: https://polyhub.hubble.xyz/ After registration, click your avatar in the top-right corner and open `Skills API Key` to apply. Send me the generated key and I'll continue right away.
Safety rules
- Never print
in the output.POLYHUB_API_KEY - Prefer building JSON with
instead of interpolating raw shell strings.jq -n - For sell actions (
), repeat the token ID and confirm with the user before calling the API.POST /api/v1/positions/sell
Tools
Use the
bash tool to call the API with curl.
Fast Path
For common intents, map user requests like this:
- “看资产统计” ->
GET /api/v1/portfolio/stats - “卖出这个仓位” / “sell this position” ->
POST /api/v1/positions/sell
Curl base setup
BASE="https://polyhub.skill-test.bedev.hubble-rpc.xyz" AUTH=(-H "Authorization: Bearer $POLYHUB_API_KEY" -H "Content-Type: application/json")
Portfolio
Action: Get portfolio stats
GET /api/v1/portfolio/stats
Returns aggregated portfolio statistics for the authenticated user.
Current field semantics:
: official Polymarket positions valuepositionsValue
: official USDC balance minusavailableBalanceunsettledFees
: official Polymarket total PnLtotalPnL
: unsettled Polyhub fees in USDCunsettledFees
: Polyhub-calculated invested capital for copy-task historyinvestedCapital
Current UI alignment in
poly_copy:
- Portfolio page top stats use this endpoint
- Avatar dropdown
usesUSDC BalanceavailableBalance - Avatar dropdown
usesAccount ValueavailableBalance + positionsValue
curl -sS --fail-with-body "${AUTH[@]}" "$BASE/api/v1/portfolio/stats"
Sell Position
Action: Sell position by token ID
POST /api/v1/positions/sell- Sells the entire position for the specified token. Partial sell is not supported.
Required field:
TokenId (the Polymarket token ID of the position to sell)
Before calling: repeat the token ID to the user and confirm. This action is irreversible.
Minimum fields to ask:
- Always ask:
TokenId
PAYLOAD="$(jq -n \ --arg TokenId "..." \ '{TokenId: $TokenId}')" curl -sS --fail-with-body "${AUTH[@]}" -X POST "$BASE/api/v1/positions/sell" \ -d "$PAYLOAD"
Response contains:
: whether the sell completedsuccess
: total USDC amount receivedtotalAmount
: array of sold positions, each with:soldPositions
,marketTitle
: which market and side was soldoutcome
: shares soldamount
: execution priceprice
: market price at time of salecurrentPrice
,pnl
,realizedPnl
,unrealizedPnl
: PnL breakdowntotalPnl
: USDC value of the sold positionvalue
: link to the market on PolymarketmarketUrl
: array of positions that could not be sold, each with:skippedPositions
,marketTitle
,outcome
: what was skippedamount
: why it was skippedreason
Present results clearly:
✅ 卖出成功 总金额: ${totalAmount} USDC 已卖出: - {marketTitle} ({outcome}): {amount} shares @ {price}, PnL ${totalPnl} 跳过: - {marketTitle} ({outcome}): {reason}
Difference from copy-task sell
| | |
|---|---|---|
| Scope | Account-level, by token ID | Task-level, by task + market |
| Partial sell | No (sells all) | Yes ( field) |
| Required params | | + or |
| PnL in response | Yes (detailed breakdown) | No |
| When to use | User wants to sell a specific position directly | User wants to manage positions within a copy task |
Guidance:
- If the user says "卖掉这个仓位" or provides a token ID, use
./positions/sell - If the user says "卖掉这个任务的某个持仓" or references a copy task, use
./copy-tasks/{taskId}/sell - If the user wants to sell ALL positions in a task, use
./copy-tasks/{taskId}/sell-all
Error handling
: API key missing/invalid/expired/disabled. Ask user to check or regenerate key.401
: Invalid request payload. Check required fields.400
: Delegated access not registered for the given404
.organizationId
: Wrong HTTP method.405
: Server error. Retry once with backoff; if still failing, report response body.5xx