Polyhub-skills polyhub-copy
Manage Polyhub copy-trading tasks, positions, trades, signals, sell flows, batch operations, and TPSL rules with an API key.
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-copy" ~/.claude/skills/hubblevision-polyhub-skills-polyhub-copy && rm -rf "$T"
manifest:
codex/skills/polyhub-copy/SKILL.mdsource content
Polyhub Copy
Version: v0.3.9
Use this skill when the user wants to manage copy-trading tasks 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 run copy-trading or account actions 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 - Treat IDs and user-provided JSON-like input as untrusted.
- For write actions, restate the full action summary and wait for explicit confirmation before calling the API.
- Prefer
instead of interpolating raw JSON.jq -n - Validate
withtaskId
.^[0-9a-fA-F]{24}$
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
- List tasks:
GET /api/v1/copy-tasks - Get one task:
GET /api/v1/copy-tasks/{taskId} - Create task:
POST /api/v1/copy-tasks - Update task:
PATCH /api/v1/copy-tasks/{taskId} - Delete one task: check
; if active positions exist, runGET /api/v1/copy-tasks/{taskId}/positions?status=active
first, thenPOST /api/v1/copy-tasks/{taskId}/sell-allDELETE /api/v1/copy-tasks/{taskId} - Batch delete tasks: for each task, check active positions and run
where needed beforesell-allPOST /api/v1/copy-tasks/batch-delete - View signals:
GET /api/v1/copy-signals - View signal stats:
GET /api/v1/copy-signals/stats - View positions or trades: use the task-specific positions or trades endpoints requested by the user
- Sell one position or all positions: use
orsell
flows after confirmationsell-all
Validation Helpers
if [[ ! "$TASK_ID" =~ ^[0-9a-fA-F]{24}$ ]]; then echo "Invalid taskId" exit 2 fi
Common Calls
List copy tasks
curl -sS --fail-with-body "${AUTH[@]}" \ "$BASE/api/v1/copy-tasks?includeDeleted=true"
Guidance:
- Use
for history or deleted tasks.includeDeleted=true - Use
for active tasks only.includeDeleted=false
Create copy task
Always ask for:
targetTrader
Ask only when needed:
targetUsernamefilteredByTagtaskConfigtpslRules
PAYLOAD="$(jq -n --arg targetTrader "0x..." '{targetTrader: $targetTrader}')" curl -sS --fail-with-body "${AUTH[@]}" \ -X POST "$BASE/api/v1/copy-tasks" \ -d "$PAYLOAD"
Update copy task
Common fields:
statustaskConfigfilteredByTagtargetUsernametpslRules
PAYLOAD="$(jq -n --arg status "PAUSED" '{status: $status}')" curl -sS --fail-with-body "${AUTH[@]}" \ -X PATCH "$BASE/api/v1/copy-tasks/$TASK_ID" \ -d "$PAYLOAD"
Copy mode guidance:
ONE_TO_ONE
, which should includeFIXED_SIZEtaskConfig.fixedAmount
Example: switch to fixed-size copy
PAYLOAD="$(jq -n \ --argjson fixedAmount 5 \ '{taskConfig: {copyMode: "FIXED_SIZE", fixedAmount: $fixedAmount}}')"
Delete copy task
Required flow:
- Validate
.taskId - Check active positions:
curl -sS --fail-with-body "${AUTH[@]}" \ "$BASE/api/v1/copy-tasks/$TASK_ID/positions?status=active"
- If active positions exist, confirm the cleanup step, then clear them first:
curl -sS --fail-with-body "${AUTH[@]}" \ -X POST "$BASE/api/v1/copy-tasks/$TASK_ID/sell-all"
- Delete the task:
curl -sS --fail-with-body "${AUTH[@]}" \ -X DELETE "$BASE/api/v1/copy-tasks/$TASK_ID"
Guidance:
- There is no direct position-delete endpoint in the current API. Position cleanup before delete should use
.sell-all - If the active positions list is empty, delete the task directly after confirmation.
Batch delete tasks
Required flow:
- Validate all
.taskIds - For each task, check active positions and run
first when needed.sell-all - After the cleanup step finishes, batch delete:
TASK_IDS=("64f0c7e7b8e4f8c1a1b2c3d4" "64f0c7e7b8e4f8c1a1b2c3d5") PAYLOAD="$(jq -n \ --argjson taskIds "$(printf '%s\n' "${TASK_IDS[@]}" | jq -R . | jq -s .)" \ '{taskIds: $taskIds}')" curl -sS --fail-with-body "${AUTH[@]}" \ -X POST "$BASE/api/v1/copy-tasks/batch-delete" \ -d "$PAYLOAD"
Error Handling
: invalid payload400
: missing or invalid API key401
: resource not found404
: server error5xx