← 返回 Skills 市场
connectcoinw

Coinw Contract Skill

作者 connectCoinw · GitHub ↗ · v1.5.0 · MIT-0
cross-platform ⚠ suspicious
148
总下载
1
收藏
0
当前安装
6
版本数
在 OpenClaw 中安装
/install coinw-contract-skill
功能描述
Coinw Contract REST API skill: covers market data, order placement/cancellation, TP/SL, position and order queries, account assets, position modes, and lever...
使用说明 (SKILL.md)

Coinw Contract Skill

Coinw Contract REST API skill: covers market data, order placement/cancellation, TP/SL, position and order queries, account assets, position modes, and leverage.

Setup Credentials

CoinW private endpoints require api_key and a request signature (sign).

Signing note: Contract endpoints must use Contract signing (HMAC-SHA256 + Base64 + timestamp headers). Do not use Spot MD5 signing for Contract APIs.

  1. Environment variables:
export COINW_API_KEY="your_api_key"
export COINW_SECRET_KEY="your_secret_key"
  1. In chat: provide api_key/secret_key (and an account name). The agent will mask secrets when showing them back and store them securely in OpenClaw's credential storage (not inside skill markdown files).

Key Features

  • Market data: contract instruments, order book, K-line data, trades, margin requirements
  • Trading and risk control: place orders, close/reverse positions, TP/SL (including trailing)
  • Queries and positions: order history, TP/SL info, margin rate, and position queries
  • Account and general: transferable balance, deal records, account assets and fee rates, almighty-gold, unit conversion, position mode, user available size, leverage query

Quick Reference

Market Information

No. name Endpoint Description Method Authentication Input Parameters Output Parameters
1.1 Get instrument info /v1/perpum/instruments Queries basic information for all instruments, including leverage, margin, TP/SL ratios, maker/taker fee, funding rate, max position size, etc. GET Public name base, defaultLeverage, defaultStopLossRate, defaultStopProfitRate, indexId, leverage, makerFee, maxLeverage, minLeverage, and 37 total fields
1.2 Get batch instrument info /v1/perpum/instrumentList Batch query basic information for multiple instruments in one request, including leverage, margin requirements, fee parameters, and max position size. GET Public symbols base, defaultLeverage, defaultStopLossRate, defaultStopProfitRate, indexId, leverage, makerFee, maxLeverage, minLeverage, and 38 total fields
1.3 Get latest ticker for one instrument /v1/perpumPublic/ticker Returns latest ticker summary for one instrument, including high/low, max leverage, volume, last price, and contract size. GET Public instrument contract_id, name, base_coin, quote_coin, price_coin, max_leverage, contract_size, last_price, high, and 13 total fields
1.4 Get latest ticker summary in batch /v1/perpumPublic/ticker/list Batch query latest ticker summary for multiple instruments. GET Public symbols contract_id, name, base_coin, quote_coin, price_coin, max_leverage, contract_size, last_price, high, and 13 total fields
1.5 Get latest ticker summary for all instruments /v1/perpumPublic/tickers Returns latest ticker summary for all instruments on the exchange. GET Public contract_id, name, base_coin, quote_coin, price_coin, max_leverage, contract_size, last_price, high, and 13 total fields
1.6 Get historical K-line data by instrument /v1/perpumPublic/klines Queries historical and latest K-line data for one instrument, including OHLC, timestamp, and volume. GET Public See api-doc 1.6 (for example granularity, klineType, limit, reporting coin, and time-range params) K-line array: each item includes timestamp, high/open/low/close, and volume
1.7 Get latest settled funding rate /v1/perpum/fundingRate Returns the funding rate at the most recent settlement time. It is not necessarily related to the next settlement rate. GET Public instrument data
1.8 Get order book by instrument /v1/perpumPublic/depth Queries order book depth for a specified instrument, including bids and asks. GET Public base asks, bids, m, p, n
1.9 Get trade data by instrument /v1/perpumPublic/trades Queries recent trade data for a specified instrument, including size, side, ID, timestamp, and price. Returns the latest 20 trades by default. GET Public base createdDate, piece, direction, price, quantity, id
1.10 Get margin requirements for all instruments /v1/perpum/ladders Queries tiered margin requirements for all instruments, including initial/maintenance margin and max leverage. GET Private api_key, sign id, instrument, ladder, lastLadder, marginKeepRate, maxLeverage, marginStartRate, maxPiece
1.11 Get historical public trades /v1/perpum/orders/trades Queries historical public trade records for a specified instrument. Historical public trades are available via RESTful API only. GET Private api_key, sign, instrument, pageSize closedPiece, createdDate, dealPrice, direction, id

Place Orders

No. name Endpoint Description Method Authentication Input Parameters Output Parameters
2.1 Place order /v1/perpum/order Places a contract order. Supports market, limit, and trigger order types. POST Private api_key, sign, instrument, direction, leverage, quantityUnit, quantity, positionModel, positionType, openPrice, stopProfitPrice, stopLossPrice, thirdOrderId code, data
2.2 Batch place orders /v1/perpum/batchOrders Batch places contract orders with support for market, limit, and trigger order types. POST Private api_key, sign, instrument, direction, leverage, quantityUnit, quantity, positionModel, positionType, openPrice, stopProfitPrice, stopLossPrice, triggerPrice, triggerType, thirdOrderId code, openId, thirdOrderId
2.3 Close position /v1/perpum/positions Partially or fully closes an open contract position (filled order). Supports closing by fixed size or by position percentage. DELETE Private api_key, sign, id, positionType, closeNum, orderPrice data
2.4 Batch close positions /v1/perpum/batchClose Closes multiple positions at market price in batch using thirdOrderId values. DELETE Private api_key, sign, thirdOrderId openId, thirdOrderId
2.5 Market close all positions /v1/perpum/allpositions Closes all positions for the specified instrument at market price. DELETE Private api_key, sign
2.6 Reverse position /v1/perpum/positions/reverse Instantly reverses an existing perpetual position by closing it and opening the same size in the opposite direction. POST Private api_key, sign, id data
2.7 Adjust margin /v1/perpum/positions/margin Adjusts margin for an existing position (filled order) by increasing or decreasing margin amount. POST Private api_key, sign, id, addMargin msg
2.8 Set TP/SL /v1/perpum/TPSL Sets take-profit (TP) and stop-loss (SL) for filled or unfilled orders. POST Private api_key, sign, id, instrument, stopProfitPrice, stopLossPrice msg
2.9 Set trailing TP/SL /v1/perpum/moveTPSL Configures trailing TP/SL by callback rate. Applies to filled orders only. POST Private api_key, sign, openId, callbackRate, quantity, quantityUnit
2.10 Batch set TP/SL /v1/perpum/addTpsl Batch sets TP/SL for contract trading orders. POST Private api_key, sign, id, instrument, stopLossPrice, stopProfitPrice, priceType, stopFrom, stopType, closePiece msg
2.11 Batch update TP/SL /v1/perpum/updateTpsl Batch modifies TP/SL orders for contract trading. POST Private api_key, sign, id, instrument, stopLossPrice, stopProfitPrice, priceType, stopFrom, stopType, closePiece msg
2.12 Modify order /v1/perpum/order Modifies an unfilled order. Some fields (for example margin and leverage) cannot be changed via this endpoint. PUT Private api_key, sign, id, instrument, direction, leverage, quantityUnit, quantity, positionModel, positionType, openPrice, stopProfitPrice, stopLossPrice, triggerPrice, triggerType originId, editId
2.13 Cancel order /v1/perpum/order Cancels an unfilled order by order ID. DELETE Private api_key, sign, id msg
2.14 Cancel batch orders /v1/perpum/batchOrders Cancels multiple unfilled orders in batch. DELETE Private api_key, sign, sourceIds

Query Orders

No. name Endpoint Description Method Authentication Input Parameters Output Parameters
3.1 Get open orders /v1/perpum/orders/open Queries unfilled orders by instrument and order type, including direction, quantity, margin, leverage, fees, and timestamps. GET Private api_key, sign, instrument, positionType id, userId, baseSize, createdDate, currentPiece, direction, frozenFee, indexPrice, instrument, and 28 total fields
3.2 Get open order count /v1/perpum/orders/openQuantity Returns total number of unfilled (pending) orders. Pending order data is available via RESTful API only. GET Private api_key, sign data
3.3 Get TP/SL info /v1/perpum/TPSL Queries TP/SL information for both filled and unfilled contract orders. GET Private api_key, sign, openId, stopFrom currentPiece, closePiece, direction, createdDate, updatedDate, id, indexPrice, instrument, leverage, and 24 total fields
3.4 Get trailing TP/SL info /v1/perpum/moveTPSL Queries trailing TP/SL details for contract trading. GET Private api_key, sign baseSize, callbackRate, createdDate, currentPiece, direction, fee, instrument, leverage, margin, and 31 total fields
3.5 Get history orders (7 days) /v1/perpum/orders/history Returns historical order records from the last 7 days with pagination and filters. GET Private api_key, sign, page, pageSize, originType, instrument userId, baseSize, completeUsdt, createdDate, currentPiece, direction, entrustUsdt, havShortfall, hedgeId, and 37 total fields
3.6 Batch get history orders (7 days) /v1/perpum/orders/batchInsHistory Returns historical order records from the last 7 days with batch query via symbols. GET Private api_key, sign, page, pageSize, originType, symbols userId, baseSize, completeUsdt, createdDate, currentPiece, direction, entrustUsdt, havShortfall, hedgeId, and 37 total fields
3.7 Get history orders (3 months) /v1/perpum/orders/archive Returns historical order records from the last 3 months with pagination and filters. GET Private api_key, sign, page, pageSize, originType, instrument userId, baseSize, completeUsdt, createdDate, currentPiece, direction, entrustUsdt, havShortfall, hedgeId, and 37 total fields
3.8 Batch get history orders (3 months) /v1/perpum/orders/batchInsArchive Returns historical order records from the last 3 months with batch query via symbols. GET Private api_key, sign, page, pageSize, originType, symbols userId, baseSize, completeUsdt, createdDate, currentPiece, direction, entrustUsdt, havShortfall, hedgeId, and 37 total fields
3.9 Get order info /v1/perpum/order Returns current unfilled order information. You can query by order ID list; if no instrument/order IDs are specified, all orders under the given order type are returned. GET Private api_key, sign, positionType, sourceIds id, baseSize, contractType, userId, fee, createdDate, currentPiece, direction, frozenFee, and 35 total fields

Position Information

No. name Endpoint Description Method Authentication Input Parameters Output Parameters
4.1 Get current positions /v1/perpum/positions Queries currently open positions (filled orders) by instrument. You can also query specific positions using one or more position IDs. GET Private api_key, sign, instrument id, base, baseSize, createdDate, currentPiece, direction, fee, fundingSettle, indexPrice, and 37 total fields
4.2 Get historical positions /v1/perpum/positions/history Queries all historical positions (filled orders), with optional filtering by base/instrument and position margin mode. GET Private api_key, sign, instrument, positionModel avgOpenPrice, completeUsdt, direction, entrustUsdt, fee, havShortfall, indexPrice, instrument, leverage, and 22 total fields
4.3 Get position margin rate /v1/perpum/positions/marginRate Queries margin rate for a position (filled order) by position ID. GET Private api_key, sign, positionId data
4.4 Get max contract size /v1/perpum/orders/maxSize Queries max available contract size (long/short) by instrument, leverage, and position mode. Optional opening price can be provided. GET Private api_key, sign, leverage, instrument, positionModel, orderPrice maxBuy, maxSell
4.5 Get all current positions /v1/perpum/positions/all Queries all currently open positions (filled orders). GET Private api_key, sign id, base, baseSize, createdDate, currentPiece, closedPiece, direction, fee, fundingSettle, and 30 total fields

Account and Assets

No. name Endpoint Description Method Authentication Input Parameters Output Parameters
5.1 Get max transferable balance /v1/perpum/account/available Queries max amount transferable out from the contract account. GET Private api_key, sign data.value
5.2 Get deal details (3 days) /v1/perpum/orders/deals Deal/funding details for the recent 3 days (see api-doc notes). GET Private api_key, sign, instrument, page, pageSize, originType, positionModel data.rows, nextId, prevId, total
5.3 Get deal details (3 months) /v1/perpum/orders/deals/history Deal/funding details for the recent 3 months (same fields as 5.2). GET Private api_key, sign, instrument, page, pageSize, originType, positionModel data.rows, nextId, prevId, total
5.4 Get contract account assets /v1/perpum/account/getUserAssets Returns available margin, USDT, frozen amounts, almighty-gold, and related fields (note meaning of availableMargin). GET Private api_key, sign availableMargin, availableUsdt, alMargin, alFreeze, almightyGold, userId, time
5.5 Get contract account fees /v1/perpum/account/fees Queries maker/taker fee rates. GET Private api_key, sign makerFee, takerFee, userId
5.6 Get almighty-gold balance /v1/perpum/account/almightyGoldInfo Filters almighty-gold records by status and other criteria (GET). GET Private api_key, sign, type, startTime?, endTime? data[] (id, currentAmount, totalAmount, type, etc.)
5.7 Unit conversion /v1/perpum/pieceConvert Converts between contract pieces and coin amount. POST Private api_key, sign, convertType, faceValue, dealPiece?/baseSize? data.value
5.8 Get position mode /v1/perpum/positions/type Queries isolated/cross mode and merged/split layout (GET). GET Private api_key, sign layout, positionModel
5.9 Set position mode /v1/perpum/positions/type Sets isolated/cross mode and layout (POST); there must be no open orders before switching. POST Private api_key, sign, positionModel, layout data (TRANSACTION_SUCCESS)
5.10 Enable/disable almighty-gold /v1/perpum/account/almightyGoldInfo Enables or disables almighty-gold (POST on same path as 5.6). POST Private api_key, sign, status code, msg
5.11 Get user max available contract size /v1/perpum/orders/availSize Returns available buy/sell size from the filled-position perspective (different from 4.4 maxSize use case). GET Private api_key, sign, instrument availBuy, availSell

General

No. name Endpoint Description Method Authentication Input Parameters Output Parameters
6.1 Get leverage info /v1/perpum/positions/leverage Queries leverage for one filled position (positionId) or one unfilled order (orderId), choose one. GET Private api_key, sign, positionId or orderId data.value

Common Parameters and Enums

Auth and URL

  • Base URL: https://api.coinw.com.
  • Public market endpoints are mostly GET https://api.coinw.com/v1/perpum/... or .../v1/perpumPublic/....
  • Private endpoints require header-based auth: api_key, timestamp, sign (HMAC-SHA256 then Base64, see Reference).

Common request fields

  • instrument / name: contract identifier (often mixed in docs; means underlying/contract name).
  • symbols: comma-separated list for batch endpoints.
  • layout: 0 merged positions, 1 split positions (used with positionModel on /v1/perpum/positions/type GET/POST).
  • convertType: 1 piece -> coin, 2 coin -> piece (pieceConvert).
  • almighty-gold type (GET almightyGoldInfo): 0 pending to effective through 4 issuance failed; status (POST): 1 on / 0 off.

Standard response wrapper (common in REST)

  • Common top-level fields: code, msg / message, success, failed, data (actual response varies by endpoint).

Common enums and values

  • contractType: common value 1: USDT-margined perpetual contract (see api-doc).
  • positionModel: position mode: 0 isolated, 1 cross (follow api-doc wording).
  • quantityUnit: quantity unit for orders: 0 = quote currency (for example USDT); 1 = contract piece; 2 = base currency (for example BTC).
  • status: contract status examples: offline, online, pretest, settlement, preOffline.
  • priceType: TP/SL trigger price type: 1 = index price, 2 = last price, 3 = mark price.
  • processStatus: matching-engine process status: 0 = waiting, 1 = processing, 2 = success, 3 = failed.
  • selected: default selected status: 0 = no, 1 = yes.
  • stopType: TP/SL order type: 1 = limit, 2 = market, 3 = planned order.
  • triggerStatus: TP/SL trigger status: 0 = not triggered, 1 = triggered, 2 = canceled.
  • triggerType: order type when triggerPrice condition is met: 0 = limit, 1 = market.

Examples

GET (public endpoint)

curl "https://api.coinw.com/v1/perpumPublic/tickers"

Auth required (private endpoint)

timestamp=$(($(date +%s%N)/1000000))
method="DELETE"
api_url="/v1/perpum/allpositions"
payload="${timestamp}${method}${api_url}"
sign=$(printf "%s" "$payload" | openssl dgst -sha256 -hmac "$COINW_SECRET_KEY" -binary | openssl base64)
curl -X DELETE "https://api.coinw.com${api_url}" \
  -H "api_key: $COINW_API_KEY" \
  -H "timestamp: ${timestamp}" \
  -H "sign: ${sign}" \
  -H "Content-type: application/json"

Security

When showing credentials to users:

  • API Key: Show first 4 + last 5 characters: 12&*1...198I
  • Secret Key: Always mask, show only last 4: ***...isf1
  • Ask for user confirmation before any trade action.
  • Store user api_key and secret_key in a secure location.

Agent Behavior

  1. Credentials requested: Mask secrets (show last 5 chars only)
  2. Listing accounts: Show names never keys
  3. New credentials: Prompt for name, signing mode

Adding New Accounts

When user provides new credentials:

  • Ask for account name, api_key, secret_key
  • Store the provided credentials in OpenClaw's secure credential store with masked display confirmation

Reference

  • Authentication./references/Authentication.md
  • errorcode: ./references/error-codes.md
  • notes: ./references/notes.md
  • api-key create steps: ./references/api-key-creation-steps.md
安全使用建议
This skill otherwise looks coherent for interacting with CoinW, but the 'always: true' privilege is the main concern. Before installing: 1) Confirm you trust the skill's publisher and origin (no homepage/source is listed). 2) Avoid pasting high-privilege API secrets into chat — prefer storing them via the platform's secure credential UI. 3) If you must provide an API key, create a scoped key with the minimum permissions needed (prefer read-only or trading without withdrawal) and enable IP whitelisting and 2FA where possible. 4) Do not use a primary account key — create a separate test/trading key and fund it minimally. 5) Ask the vendor why 'always: true' is necessary; if not needed, decline installation or request a version without that flag. 6) Monitor account activity and rotate keys after testing. These steps reduce risk from a force-enabled skill that can access your exchange credentials.
功能分析
Type: OpenClaw Skill Name: coinw-contract-skill Version: 1.5.0 The Coinw Contract Skill bundle is a standard integration for the CoinW exchange's perpetual contract REST API. The documentation (SKILL.md) and reference files provide comprehensive details for market data, trading, and account management. Notably, the instructions explicitly direct the AI agent to mask sensitive API keys and require user confirmation before executing any trade actions, which are strong indicators of benign intent. No evidence of data exfiltration, unauthorized remote execution, or malicious prompt injection was found across the analyzed files.
能力标签
cryptocan-make-purchasesrequires-sensitive-credentials
能力评估
Purpose & Capability
Name/description (CoinW contract REST API) aligns with requested environment variables (COINW_API_KEY, COINW_SECRET_KEY) and the SKILL.md content. No unrelated binaries, credentials, or config paths are requested.
Instruction Scope
SKILL.md contains API usage, signing instructions, and examples limited to CoinW endpoints. It instructs the agent to collect API keys in chat and store them in OpenClaw credential storage, which is consistent with a trading API skill. It does not instruct the agent to read unrelated files or exfiltrate data to third-party endpoints.
Install Mechanism
Instruction-only skill with no install spec and no code files—nothing is downloaded or written to disk by an installer. This is the lowest-risk install mechanism.
Credentials
The two required env vars (API key and secret) are appropriate and expected for a contract trading API. There are no extra or unrelated secrets requested. The SKILL.md also documents standard signing and key-creation steps.
Persistence & Privilege
The skill is marked always: true, meaning it will be force-included in every agent run. Combined with its need for API credentials and the instruction to accept/store secrets from chat, this creates a high blast radius if the skill is compromised or malicious. The 'always' flag is not justified in the documentation.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install coinw-contract-skill
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /coinw-contract-skill 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.5.0
- Updated version to 1.5.0. - Added an explicit signing note in the setup credentials section clarifying that contract endpoints require HMAC-SHA256 + Base64 + `timestamp` headers (not spot MD5 signing). - No functional or endpoint changes; documentation clarification only.
v1.0.4
- Added explicit setup instructions for API credentials, supporting both environment variables and OpenClaw's secure credential storage. - Updated metadata to define environment variable requirements (`COINW_API_KEY`, `COINW_SECRET_KEY`) and indicate OpenClaw integration. - Credential guidance clarifies secrets are not stored inside skill markdown files and are masked in chat. - No changes to API endpoints or main functionality.
v1.0.3
No user-facing changes in this release (1.0.3). - Documentation only: The "Quick Start" credential setup instructions were removed from the README. - No code or functionality changes detected.
v1.0.2
- Added a new "Quick Start" section with step-by-step instructions for setting up API credentials via environment variables or interactive chat. - Provided security reminders about handling API secrets. - No changes to API endpoints, features, or overall functionality.
v1.0.1
add Disclaimer
v1.0.0
init
元数据
Slug coinw-contract-skill
版本 1.5.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 6
常见问题

Coinw Contract Skill 是什么?

Coinw Contract REST API skill: covers market data, order placement/cancellation, TP/SL, position and order queries, account assets, position modes, and lever... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 148 次。

如何安装 Coinw Contract Skill?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install coinw-contract-skill」即可一键安装,无需额外配置。

Coinw Contract Skill 是免费的吗?

是的,Coinw Contract Skill 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Coinw Contract Skill 支持哪些平台?

Coinw Contract Skill 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Coinw Contract Skill?

由 connectCoinw(@connectcoinw)开发并维护,当前版本 v1.5.0。

💬 留言讨论