← 返回
安全合规 Key 中文

Aster Spot

Aster Spot request using the Aster API. Authentication requires API key and secret key (HMAC SHA256). Supports mainnet.
使用Aster API进行Aster Spot请求。认证需API密钥和私钥(HMAC SHA256)。支持主网。
yuandiaodiaodiao
安全合规 clawhub v0.1.1 1 版本 100000 Key: 需要
★ 0
Stars
📥 769
下载
💾 7
安装
1
版本
#latest

概述

Aster Spot Skill

Spot request on Aster using authenticated API endpoints. Requires API key and secret key for certain endpoints. Return the result in JSON format.

Data Fetching Guidelines (CRITICAL)

NEVER truncate JSON responses with head -c, head -n, or similar — truncated JSON is corrupted and will produce wrong results.

Mandatory Rules

  1. Always specify symbol parameter when querying a specific trading pair. Many endpoints return ALL symbols when symbol is omitted, producing responses of 100KB+.
  2. Always use limit parameter to constrain result size. Use the smallest limit that satisfies the request (e.g., limit=5 instead of default 500).
  3. Use jq to extract fields — never parse raw mega-JSON visually. Pipe through jq to select only needed data.

Progressive Data Exploration Strategy

When the user asks a broad question (e.g., "what spot pairs are available?"), use a layered approach:

  1. Step 1 — Get lightweight summary first:

```bash

# Get just the symbol list, not full exchangeInfo

curl -s "https://sapi.asterdex.com/api/v1/exchangeInfo" | jq '[.symbols[].symbol]'

```

  1. Step 2 — Confirm scope with user before fetching detailed data for many symbols.
  1. Step 3 — Fetch details for specific symbols only:

```bash

# Get price for ONE symbol, not all

curl -s "https://sapi.asterdex.com/api/v1/ticker/price?symbol=BTCUSDT"

```

Endpoints That Return Dangerously Large Data (without symbol filter)

EndpointWithout symbolWith symbol
-------------------------------------------
/api/v1/exchangeInfoALL symbols + filters (100KB+)N/A — use jq to filter
/api/v1/ticker/24hrALL symbols (50KB+)Single object (~500B)
/api/v1/ticker/priceALL symbols (10KB+)Single object (~80B)
/api/v1/ticker/bookTickerALL symbols (20KB+)Single object (~150B)
/api/v1/depthN/A (symbol required)Varies by limit: use limit=5 for overview
/api/v1/klinesN/A (symbol required)Default 500 candles — always set limit
/api/v1/tradesN/A (symbol required)Default 500 trades — always set limit

Example: Safe vs Unsafe

# BAD — returns ALL symbols, then truncates = corrupted JSON
curl -s ".../api/v1/ticker/price" | head -c 5000

# GOOD — returns single symbol, complete JSON
curl -s ".../api/v1/ticker/price?symbol=BTCUSDT"

# BAD — 500 candles by default
curl -s ".../api/v1/klines?symbol=BTCUSDT&interval=1h"

# GOOD — only 5 candles
curl -s ".../api/v1/klines?symbol=BTCUSDT&interval=1h&limit=5"

# GOOD — extract just symbol names from exchangeInfo
curl -s ".../api/v1/exchangeInfo" | jq '[.symbols[] | {symbol, status}]'

Quick Reference

EndpointDescriptionRequiredOptionalAuthentication
-----------------------------------------------------------
/api/v1/ping (GET)Test server connectivityNoneNoneNo
/api/v1/time (GET)Get server timeNoneNoneNo
/api/v1/exchangeInfo (GET)Trading specification informationNoneNoneNo
/api/v1/depth (GET)Order book depthsymbollimitNo
/api/v1/trades (GET)Recent trades listsymbollimitNo
/api/v1/historicalTrades (GET)Query historical tradessymbollimit, fromIdYes
/api/v1/aggTrades (GET)Compressed/Aggregate trades listsymbolfromId, startTime, endTime, limitNo
/api/v1/klines (GET)K-line/Candlestick datasymbol, intervalstartTime, endTime, limitNo
/api/v1/ticker/24hr (GET)24-hour price change statisticsNonesymbolNo
/api/v1/ticker/price (GET)Latest price tickerNonesymbolNo
/api/v1/ticker/bookTicker (GET)Best bid/ask price tickerNonesymbolNo
/api/v1/commissionRate (GET)Get symbol commission ratesymbol, timestamprecvWindowYes
/api/v1/order (POST)Place new ordersymbol, side, type, timestamptimeInForce, quantity, quoteOrderQty, price, newClientOrderId, stopPrice, recvWindowYes
/api/v1/order (DELETE)Cancel ordersymbol, timestamporderId, origClientOrderId, recvWindowYes
/api/v1/order (GET)Query ordersymbol, timestamporderId, origClientOrderId, recvWindowYes
/api/v1/allOpenOrders (DELETE)Cancel all open orders on a symbolsymbol, timestamporderIdList, origClientOrderIdList, recvWindowYes
/api/v1/openOrders (GET)Current open orderstimestampsymbol, recvWindowYes
/api/v1/allOrders (GET)Query all orderssymbol, timestamporderId, startTime, endTime, limit, recvWindowYes
/api/v1/account (GET)Account informationtimestamprecvWindowYes
/api/v1/userTrades (GET)Account trade historytimestampsymbol, orderId, startTime, endTime, fromId, limit, recvWindowYes
/api/v1/asset/wallet/transfer (POST)Perp-Spot transferamount, asset, clientTranId, kindType, timestampNoneYes
/api/v1/asset/sendToAddress (POST)Transfer asset to other addressamount, asset, toAddress, timestampclientTranId, recvWindowYes
/api/v1/aster/withdraw/estimateFee (GET)Get withdrawal fee estimatechainId, assetNoneNo
/api/v1/aster/user-withdraw (POST)Withdraw fundschainId, asset, amount, fee, receiver, nonce, userSignature, timestamprecvWindowYes
/api/v1/getNonce (POST)Get nonce for API key creationaddress, userOperationTypenetworkNo
/api/v1/createApiKey (POST)Create API keyaddress, userOperationType, userSignature, desc, timestampnetwork, apikeyIP, recvWindowNo
/api/v1/listenKey (POST)Generate user data stream listen keyNoneNoneYes (API key only)
/api/v1/listenKey (PUT)Extend listen key validitylistenKeyNoneYes (API key only)
/api/v1/listenKey (DELETE)Close user data streamlistenKeyNoneYes (API key only)

Parameters

Common Parameters

  • symbol: Trading pair (e.g., BTCUSDT)
  • limit: Default 500; maximum 1000 (depth endpoint supports: 5, 10, 20, 50, 100, 500, 1000; klines max 1500)
  • fromId: Return starting from trade ID (e.g., 1)
  • startTime: Timestamp in ms to get data from INCLUSIVE (e.g., 1735693200000)
  • endTime: Timestamp in ms to get data until INCLUSIVE (e.g., 1735693200000)
  • recvWindow: The value cannot be greater than 60000. Default 5000. (e.g., 5000)
  • timestamp: Unix timestamp in milliseconds (e.g., 1735693200000)
  • quantity: Order quantity (e.g., 1)
  • quoteOrderQty: Quote order quantity (e.g., 100)
  • price: Order price (e.g., 50000)
  • stopPrice: Required for STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET orders (e.g., 49000)
  • newClientOrderId: Client-customized unique order ID. Automatically generated if not sent.
  • orderId: Order ID (e.g., 1)
  • origClientOrderId: Original client order ID
  • orderIdList: Order ID array string (for batch cancel)
  • origClientOrderIdList: Client order ID array string (for batch cancel)
  • amount: Transfer/withdrawal quantity (e.g., 1.5)
  • asset: Asset type (e.g., USDT, BTC)
  • clientTranId: Client transaction ID (minimum 20 characters if provided)
  • kindType: Transfer direction: FUTURE_SPOT or SPOT_FUTURE
  • toAddress: Target EVM address for transfers
  • chainId: Chain ID for withdrawals: 1 (ETH), 56 (BSC), 42161 (Arbi)
  • fee: Withdrawal fee
  • receiver: Current account address (for withdrawals)
  • nonce: Current time in microseconds (for withdrawals)
  • userSignature: EVM wallet signature
  • address: Wallet address (for API key creation)
  • userOperationType: Operation type: CREATE_API_KEY
  • network: Network type (SOL for Solana network only)
  • apikeyIP: Comma-separated IP addresses for whitelist
  • desc: API key description (max 20 characters; no duplicates per account)
  • listenKey: Listen key for user data streams

Enums

  • side: BUY | SELL
  • type (order type): LIMIT | MARKET | STOP | TAKE_PROFIT | STOP_MARKET | TAKE_PROFIT_MARKET
  • timeInForce: GTC | IOC | FOK | GTX
  • interval: 1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M
  • kindType: FUTURE_SPOT | SPOT_FUTURE
  • orderStatus: NEW | PARTIALLY_FILLED | FILLED | CANCELED | REJECTED | EXPIRED

Authentication

For endpoints that require authentication, you will need to provide Aster API credentials.

Required credentials:

  • apiKey: Your Aster API key (for header)
  • secretKey: Your Aster API secret (for signing)

Base URL:

  • Mainnet: https://sapi.asterdex.com

WebSocket:

  • Market Streams: wss://sstream.asterdex.com

See references/authentication.md for implementation details.

Security

Share Credentials

Users can provide Aster API credentials by sending a file where the content is in the following format:

abc123...xyz
secret123...key

Never Display Full Secrets

When showing credentials to users:

  • API Key: Show first 5 + last 4 characters: bb3b2...02ae
  • Secret Key: Always mask, show only last 5: *...ae1c

Example response when asked for credentials:

Account: main

API Key: bb3b2...02ae

Secret: *...ae1c

Environment: Mainnet

Listing Accounts

When listing accounts, show names and environment only — never keys:

Aster Accounts:

  • main (Mainnet)
  • trading (Mainnet)

Transactions in Mainnet

When performing transactions in mainnet, always confirm with the user before proceeding by asking them to write "CONFIRM" to proceed.


Aster Accounts

main

  • API Key: your_mainnet_api_key
  • Secret: your_mainnet_secret
  • Testnet: false

TOOLS.md Structure

## Aster Accounts

### main
- API Key: abc123...xyz
- Secret: secret123...key
- Testnet: false
- Description: Primary trading account

### trading
- API Key: trade456...abc
- Secret: tradesecret...xyz
- Testnet: false
- Description: Secondary trading account

Agent Behavior

  1. Credentials requested: Mask secrets (show last 5 chars only)
  2. Listing accounts: Show names and environment, never keys
  3. Account selection: Ask if ambiguous, default to main
  4. When doing a transaction in mainnet, confirm with user before by asking to write "CONFIRM" to proceed
  5. New credentials: Prompt for name, environment, signing mode

Adding New Accounts

When user provides new credentials:

  • Ask for account name
  • Ask: Mainnet?
  • Store in TOOLS.md with masked display confirmation

Signing Requests

All trading endpoints require HMAC SHA256 signature:

  1. Build query string with all params + timestamp (Unix ms)
  2. Sign query string with secretKey using HMAC SHA256
  3. Append signature to query string
  4. Include X-MBX-APIKEY header

See references/authentication.md for implementation details.

版本历史

共 1 个版本

  • v0.1.1 当前
    2026-03-30 06:11 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,699
security-compliance

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 89 📥 30,586
productivity

Opinion Skill

yuandiaodiaodiao
基于 bun 运行时的 Opinion 预测市场工具集,支持市场查询、订单簿查看及基于多签钱包的链上交易操作。
★ 0 📥 815