Polyhub-skills polyhub-account
View Polyhub portfolio stats, fee history, and place manual orders with explicit confirmation and field validation.
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/codex/skills/polyhub-account" ~/.claude/skills/hubblevision-polyhub-skills-polyhub-account && rm -rf "$T"
manifest:
codex/skills/polyhub-account/SKILL.mdsource content
Polyhub Account
Version: v0.3.8
Use this skill when the user wants account-level data or manual trading actions on Polyhub.
Requirements
is fixed toPOLYHUB_API_BASE_URL
.https://polyhub.skill-test.bedev.hubble-rpc.xyz
is set and starts withPOLYHUB_API_KEY
.phub_
is available.curl
is recommended.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:
POLYHUB_API_BASE_URLPOLYHUB_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
.POLYHUB_API_KEY - For
, repeat the full order summary and wait for explicit confirmation before calling the API.place-order - Do not accept arbitrary JSON for order placement. Ask for minimal required fields first.
- Prefer
for payload construction.jq -n
Base Setup
BASE="https://polyhub.skill-test.bedev.hubble-rpc.xyz" AUTH=(-H "Authorization: Bearer $POLYHUB_API_KEY" -H "Content-Type: application/json")
Intent Mapping
- Portfolio overview:
GET /api/v1/portfolio/stats - Fee history:
GET /api/v1/user/fees - Sell position by token ID:
POST /api/v1/positions/sell - Manual order placement:
POST /api/v1/place-order
Common Calls
Portfolio stats
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
UI alignment:
portfolio header uses this endpointpoly_copy- avatar dropdown
usesUSDC BalanceavailableBalance - avatar dropdown
usesAccount ValueavailableBalance + positionsValue
curl -sS --fail-with-body "${AUTH[@]}" \ "$BASE/api/v1/portfolio/stats"
Fee history
Validation:
must be positive.limit
must be zero or greater.offset
curl -sS --fail-with-body "${AUTH[@]}" \ "$BASE/api/v1/user/fees?limit=20&offset=0"
Place order
Always ask for:
tokenIdsizesideapiKeyapiSecretapiPassphrase
Always confirm:
organizationIdsignWithsafeAddress
Decision rules:
- If the user does not specify a price, prefer
.isMarketOrder=true - If the user specifies a target price, send a limit order with
andprice
.isMarketOrder=false - Normalize
to uppercase.side
PAYLOAD="$(jq -n \ --arg organizationId "..." \ --arg signWith "..." \ --arg safeAddress "0x..." \ --arg tokenId "..." \ --arg side "BUY" \ --arg apiKey "..." \ --arg apiSecret "..." \ --arg apiPassphrase "..." \ --argjson size 10 \ --argjson isMarketOrder true \ '{ organizationId: $organizationId, signWith: $signWith, safeAddress: $safeAddress, tokenId: $tokenId, size: $size, side: $side, isMarketOrder: $isMarketOrder, apiKey: $apiKey, apiSecret: $apiSecret, apiPassphrase: $apiPassphrase }')" curl -sS --fail-with-body "${AUTH[@]}" \ -X POST "$BASE/api/v1/place-order" \ -d "$PAYLOAD"
Sell Position
Sell the entire position for a given token ID. Partial sell is not supported.
Required field:
TokenId
Before calling: confirm with the user. This action is irreversible.
PAYLOAD="$(jq -n \ --arg TokenId "..." \ '{TokenId: $TokenId}')" curl -sS --fail-with-body "${AUTH[@]}" \ -X POST "$BASE/api/v1/positions/sell" \ -d "$PAYLOAD"
Response:
success, totalAmount, soldPositions[] (with marketTitle, outcome, amount, price, totalPnl, marketUrl), skippedPositions[] (with reason).
Use
/positions/sell when the user wants to sell a specific position directly by token ID. Use /copy-tasks/{taskId}/sell when managing positions within a copy task.
Error Handling
: invalid payload400
: missing or invalid API key401
: delegated access not registered404
: server error5xx