$npx -y skills add draguris/dragonclaw --skill asterTrade perpetual futures and spot on Aster Finance (asterdex.com). Place/cancel orders, check positions, balances, leverage, market data, klines, funding rates, orderbook depth, and WebSocket streams. Supports both V1 (HMAC) and V3 (EIP-712 wallet) authentication. Use when user as
| 1 | # Aster Finance — Futures & Spot Trading |
| 2 | |
| 3 | ## When to Use |
| 4 | |
| 5 | - User wants to trade perpetual futures or spot on Aster |
| 6 | - User asks about Aster DEX, Aster Finance, or asterdex |
| 7 | - User wants to check positions, balances, PnL, or funding rates on Aster |
| 8 | - User asks to place/cancel/query orders on Aster |
| 9 | - User wants market data, klines, orderbook, or ticker from Aster |
| 10 | - User wants to set leverage or margin type on Aster |
| 11 | - User mentions perps, perpetual futures, or DEX trading |
| 12 | |
| 13 | ## Overview |
| 14 | |
| 15 | Aster Finance is a decentralized perpetual futures and spot exchange. The API is Binance-compatible in structure but uses EVM wallet-based authentication (V3) or HMAC (V1). Supports BTCUSDT, ETHUSDT, and 100+ perpetual pairs. Spot trading available on testnet and mainnet. |
| 16 | |
| 17 | ## API Base URLs |
| 18 | |
| 19 | | Service | REST | WebSocket | |
| 20 | |---------|------|-----------| |
| 21 | | Futures | https://fapi.asterdex.com | wss://fstream.asterdex.com | |
| 22 | | Spot | https://sapi.asterdex.com | wss://sstream.asterdex.com | |
| 23 | |
| 24 | ## Authentication |
| 25 | |
| 26 | ### V1 — HMAC SHA256 (simpler) |
| 27 | |
| 28 | Like Binance. API key + secret, HMAC-SHA256 signature on query string. |
| 29 | |
| 30 | ``` |
| 31 | Header: X-MBX-APIKEY: <api_key> |
| 32 | Signature: HMAC-SHA256(queryString, apiSecret) |
| 33 | ``` |
| 34 | |
| 35 | ### V3 — EIP-712 Wallet Signing (recommended) |
| 36 | |
| 37 | Uses EVM wallet address + signer + private key. Nonce-based signatures. |
| 38 | |
| 39 | Credentials needed: |
| 40 | - `user`: wallet address (0x...) |
| 41 | - `signer`: signer address (0x...) |
| 42 | - `privateKey`: private key for signing |
| 43 | |
| 44 | The agent computes: nonce (microsecond timestamp), sorts params, builds EIP-712 typed data, signs with private key. |
| 45 | |
| 46 | ## Credentials Setup |
| 47 | |
| 48 | ``` |
| 49 | ASTER_API_KEY=your_api_key # V1 HMAC |
| 50 | ASTER_API_SECRET=your_api_secret # V1 HMAC |
| 51 | ASTER_USER=0x... # V3 wallet address |
| 52 | ASTER_SIGNER=0x... # V3 signer address |
| 53 | ASTER_PRIVATE_KEY=0x... # V3 private key |
| 54 | ``` |
| 55 | |
| 56 | If not configured, tell user: |
| 57 | "需要配置 Aster API 凭证。前往 https://pro.asterdex.com 创建 API Key,然后设置环境变量。" |
| 58 | |
| 59 | ## Futures Endpoints |
| 60 | |
| 61 | ### Public (no auth) |
| 62 | |
| 63 | #### Ping |
| 64 | ```tool |
| 65 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/ping'"} |
| 66 | ``` |
| 67 | |
| 68 | #### Server Time |
| 69 | ```tool |
| 70 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/time'"} |
| 71 | ``` |
| 72 | |
| 73 | #### Exchange Info (symbols, filters, rate limits) |
| 74 | ```tool |
| 75 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/exchangeInfo' | head -c 3000"} |
| 76 | ``` |
| 77 | |
| 78 | #### Orderbook Depth |
| 79 | ```tool |
| 80 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/depth?symbol=BTCUSDT&limit=20'"} |
| 81 | ``` |
| 82 | |
| 83 | #### Recent Trades |
| 84 | ```tool |
| 85 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/trades?symbol=BTCUSDT&limit=10'"} |
| 86 | ``` |
| 87 | |
| 88 | #### Klines / Candlesticks |
| 89 | ```tool |
| 90 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/klines?symbol=BTCUSDT&interval=1h&limit=24'"} |
| 91 | ``` |
| 92 | |
| 93 | Intervals: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M |
| 94 | |
| 95 | #### 24h Ticker |
| 96 | ```tool |
| 97 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/ticker/24hr?symbol=BTCUSDT'"} |
| 98 | ``` |
| 99 | |
| 100 | #### Price Ticker |
| 101 | ```tool |
| 102 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/ticker/price?symbol=BTCUSDT'"} |
| 103 | ``` |
| 104 | |
| 105 | #### Book Ticker (best bid/ask) |
| 106 | ```tool |
| 107 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/ticker/bookTicker?symbol=BTCUSDT'"} |
| 108 | ``` |
| 109 | |
| 110 | #### Funding Rate |
| 111 | ```tool |
| 112 | {"tool": "shell", "command": "curl -s 'https://fapi.asterdex.com/fapi/v1/premiumIndex?symbol=BTCUSDT'"} |
| 113 | ``` |
| 114 | |
| 115 | ### Signed (requires auth) |
| 116 | |
| 117 | #### Place Order |
| 118 | ```tool |
| 119 | {"tool": "aster", "action": "placeOrder", "params": { |
| 120 | "symbol": "BTCUSDT", |
| 121 | "side": "BUY", |
| 122 | "type": "LIMIT", |
| 123 | "quantity": "0.001", |
| 124 | "price": "60000", |
| 125 | "timeInForce": "GTC" |
| 126 | }} |
| 127 | ``` |
| 128 | |
| 129 | Order types: LIMIT, MARKET, STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET |
| 130 | |
| 131 | #### Cancel Order |
| 132 | ```tool |
| 133 | {"tool": "aster", "action": "cancelOrder", "params": { |
| 134 | "symbol": "BTCUSDT", |
| 135 | "orderId": "ORDER_ID" |
| 136 | }} |
| 137 | ``` |
| 138 | |
| 139 | #### Query Order |
| 140 | ```tool |
| 141 | {"tool": "aster", "action": "queryOrder", "params": { |
| 142 | "symbol": "BTCUSDT", |
| 143 | "orderId": "ORDER_ID" |
| 144 | }} |
| 145 | ``` |
| 146 | |
| 147 | #### Open Orders |
| 148 | ```tool |
| 149 | {"tool": "aster", "action": "openOrders", "params": {"symbol": "BTCUSDT"}} |
| 150 | ``` |
| 151 | |
| 152 | #### Account Balance |
| 153 | ```tool |
| 154 | {"tool": "aster", "action": "getBalance", "params": {}} |
| 155 | ``` |
| 156 | |
| 157 | #### Positions |
| 158 | ```tool |
| 159 | {"tool": "aster", "action": "getPositions", "params": {}} |
| 160 | ``` |
| 161 | |
| 162 | #### Set Leverage |
| 163 | ```tool |
| 164 | {"tool": "aster", "action": "setLeverage", "params": { |
| 165 | "symbol": "BTCUSDT", |
| 166 | "leverage": 10 |
| 167 | }} |
| 168 | ``` |
| 169 | |
| 170 | #### Set Margin Type |
| 171 | ```tool |
| 172 | {"tool": "a |