Aster Futures Skill
Futures request on Aster using authenticated API endpoints. Authentication uses EIP-712 ECDSA signing with API wallet (main wallet + signer wallet). 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
- Always specify
symbol parameter when querying a specific trading pair. Many endpoints return ALL symbols when symbol is omitted, producing responses of 100KB+.
- Always use
limit parameter to constrain result size. Use the smallest limit that satisfies the request (e.g., limit=5 instead of default 500).
- 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 futures are available?"), use a layered approach:
Step 1 — Get lightweight summary first:
# Get just the symbol list, not full exchangeInfo
curl -s "https://fapi.asterdex.com/fapi/v3/exchangeInfo" | jq '[.symbols[].symbol]'
Step 2 — Confirm scope with user before fetching detailed data for many symbols.
Step 3 — Fetch details for specific symbols only:
# Get price for ONE symbol, not all
curl -s "https://fapi.asterdex.com/fapi/v3/ticker/price?symbol=BTCUSDT"
Endpoints That Return Dangerously Large Data (without symbol filter)
| Endpoint |
Without symbol |
With symbol |
/fapi/v3/exchangeInfo |
ALL symbols + filters (100KB+) |
N/A — use jq to filter |
/fapi/v3/ticker/24hr |
ALL symbols (50KB+) |
Single object (~500B) |
/fapi/v3/ticker/price |
ALL symbols (10KB+) |
Single object (~80B) |
/fapi/v3/ticker/bookTicker |
ALL symbols (20KB+) |
Single object (~150B) |
/fapi/v3/premiumIndex |
ALL symbols (30KB+) |
Single object (~300B) |
/fapi/v3/depth |
N/A (symbol required) |
Varies by limit: use limit=5 for overview |
/fapi/v3/klines |
N/A (symbol required) |
Default 500 candles — always set limit |
/fapi/v3/trades |
N/A (symbol required) |
Default 500 trades — always set limit |
Example: Safe vs Unsafe
# BAD — returns ALL symbols, then truncates = corrupted JSON
curl -s ".../fapi/v3/ticker/price" | head -c 5000
# GOOD — returns single symbol, complete JSON
curl -s ".../fapi/v3/ticker/price?symbol=BTCUSDT"
# BAD — 500 candles by default
curl -s ".../fapi/v3/klines?symbol=BTCUSDT&interval=1h"
# GOOD — only 5 candles
curl -s ".../fapi/v3/klines?symbol=BTCUSDT&interval=1h&limit=5"
# GOOD — extract just symbol names from exchangeInfo
curl -s ".../fapi/v3/exchangeInfo" | jq '[.symbols[] | {symbol, status}]'
Quick Reference
| Endpoint |
Description |
Required |
Optional |
Authentication |
/fapi/v3/ping (GET) |
Test connectivity |
None |
None |
No |
/fapi/v3/time (GET) |
Check server time |
None |
None |
No |
/fapi/v3/exchangeInfo (GET) |
Exchange information |
None |
None |
No |
/fapi/v3/depth (GET) |
Order book |
symbol |
limit |
No |
/fapi/v3/trades (GET) |
Recent trades list |
symbol |
limit |
No |
/fapi/v3/historicalTrades (GET) |
Old trades lookup |
symbol |
limit, fromId |
Yes |
/fapi/v3/aggTrades (GET) |
Compressed/Aggregate trades list |
symbol |
fromId, startTime, endTime, limit |
No |
/fapi/v3/klines (GET) |
Kline/Candlestick data |
symbol, interval |
startTime, endTime, limit |
No |
/fapi/v3/indexPriceKlines (GET) |
Index price kline data |
pair, interval |
startTime, endTime, limit |
No |
/fapi/v3/markPriceKlines (GET) |
Mark price kline data |
symbol, interval |
startTime, endTime, limit |
No |
/fapi/v3/premiumIndex (GET) |
Mark price and funding rate |
None |
symbol |
No |
/fapi/v3/fundingRate (GET) |
Funding rate history |
None |
symbol, startTime, endTime, limit |
No |
/fapi/v3/ticker/24hr (GET) |
24hr ticker price change statistics |
None |
symbol |
No |
/fapi/v3/ticker/price (GET) |
Symbol price ticker |
None |
symbol |
No |
/fapi/v3/ticker/bookTicker (GET) |
Symbol order book ticker |
None |
symbol |
No |
/fapi/v3/order (POST) |
New order |
symbol, side, type, timestamp |
positionSide, timeInForce, quantity, reduceOnly, price, newClientOrderId, stopPrice, closePosition, activationPrice, callbackRate, workingType, priceProtect, newOrderRespType, recvWindow |
Yes |
/fapi/v3/batchOrders (POST) |
Place multiple orders |
batchOrders, timestamp |
recvWindow |
Yes |
/fapi/v3/order (GET) |
Query order |
symbol, timestamp |
orderId, origClientOrderId, recvWindow |
Yes |
/fapi/v3/order (DELETE) |
Cancel order |
symbol, timestamp |
orderId, origClientOrderId, recvWindow |
Yes |
/fapi/v3/allOpenOrders (DELETE) |
Cancel all open orders |
symbol, timestamp |
recvWindow |
Yes |
/fapi/v3/batchOrders (DELETE) |
Cancel multiple orders |
symbol, timestamp |
orderIdList, origClientOrderIdList, recvWindow |
Yes |
/fapi/v3/countdownCancelAll (POST) |
Auto-cancel all open orders (countdown) |
symbol, countdownTime, timestamp |
recvWindow |
Yes |
/fapi/v3/openOrder (GET) |
Query current open order |
symbol, timestamp |
orderId, origClientOrderId, recvWindow |
Yes |
/fapi/v3/openOrders (GET) |
Current all open orders |
timestamp |
symbol, recvWindow |
Yes |
/fapi/v3/allOrders (GET) |
All orders |
symbol, timestamp |
orderId, startTime, endTime, limit, recvWindow |
Yes |
/fapi/v3/balance (GET) |
Futures account balance |
timestamp |
recvWindow |
Yes |
/fapi/v3/account (GET) |
Account information |
timestamp |
recvWindow |
Yes |
/fapi/v3/leverage (POST) |
Change initial leverage |
symbol, leverage, timestamp |
recvWindow |
Yes |
/fapi/v3/marginType (POST) |
Change margin type |
symbol, marginType, timestamp |
recvWindow |
Yes |
/fapi/v3/positionMargin (POST) |
Modify isolated position margin |
symbol, amount, type, timestamp |
positionSide, recvWindow |
Yes |
/fapi/v3/positionMargin/history (GET) |
Position margin change history |
symbol, timestamp |
type, startTime, endTime, limit, recvWindow |
Yes |
/fapi/v3/positionRisk (GET) |
Position information |
timestamp |
symbol, recvWindow |
Yes |
/fapi/v3/positionSide/dual (POST) |
Change position mode |
dualSidePosition, timestamp |
recvWindow |
Yes |
/fapi/v3/positionSide/dual (GET) |
Get current position mode |
timestamp |
recvWindow |
Yes |
/fapi/v3/multiAssetsMargin (POST) |
Change multi-assets mode |
multiAssetsMargin, timestamp |
recvWindow |
Yes |
/fapi/v3/multiAssetsMargin (GET) |
Get current multi-assets mode |
timestamp |
recvWindow |
Yes |
/fapi/v3/asset/wallet/transfer (POST) |
Transfer between futures and spot |
amount, asset, clientTranId, kindType, timestamp |
None |
Yes |
/fapi/v3/userTrades (GET) |
Account trade list |
symbol, timestamp |
startTime, endTime, fromId, limit, recvWindow |
Yes |
/fapi/v3/income (GET) |
Get income history |
timestamp |
symbol, incomeType, startTime, endTime, limit, recvWindow |
Yes |
/fapi/v3/leverageBracket (GET) |
Notional and leverage brackets |
timestamp |
symbol, recvWindow |
Yes |
/fapi/v3/adlQuantile (GET) |
Position ADL quantile estimation |
timestamp |
symbol, recvWindow |
Yes |
/fapi/v3/forceOrders (GET) |
User's force orders |
timestamp |
symbol, autoCloseType, startTime, endTime, limit, recvWindow |
Yes |
/fapi/v3/commissionRate (GET) |
User commission rate |
symbol, timestamp |
recvWindow |
Yes |
/fapi/v3/listenKey (POST) |
Start user data stream |
None |
None |
Yes |
/fapi/v3/listenKey (PUT) |
Keepalive user data stream |
None |
None |
Yes |
/fapi/v3/listenKey (DELETE) |
Close user data stream |
None |
None |
Yes |
GET /bapi/futures/v1/public/future/aster/deposit/assets |
Get all deposit assets |
chainIds, accountType |
networks |
No |
GET /bapi/futures/v1/public/future/aster/withdraw/assets |
Get all withdraw assets |
chainIds, accountType |
networks |
No |
GET /bapi/futures/v1/public/future/aster/estimate-withdraw-fee |
Estimate withdraw fee |
chainId, network, currency, accountType |
None |
No |
POST /fapi/aster/user-withdraw |
Withdraw by API (EVM Futures) |
chainId, asset, amount, fee, receiver, nonce, userSignature, timestamp, signature |
recvWindow |
Yes |
POST /fapi/aster/user-solana-withdraw |
Withdraw by API (Solana Futures) |
chainId, asset, amount, fee, receiver, timestamp, signature |
recvWindow |
Yes |
Parameters
Common Parameters
- symbol: Trading pair symbol (e.g., BTCUSDT)
- pair: Trading pair for index price endpoints (e.g., BTCUSDT)
- side: Order side BUY or SELL
- type: Order type (LIMIT, MARKET, STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET)
- positionSide: Position side; default BOTH for One-way Mode; LONG/SHORT for Hedge Mode
- timeInForce: Time in force (GTC, IOC, FOK, GTX)
- quantity: Order quantity (e.g., 0.1)
- price: Order price (e.g., 50000)
- stopPrice: Stop price for STOP/STOP_MARKET/TAKE_PROFIT/TAKE_PROFIT_MARKET orders
- closePosition: Close-All flag; "true" or "false"; cannot be used with quantity
- activationPrice: Activation price for TRAILING_STOP_MARKET orders
- callbackRate: Callback rate for TRAILING_STOP_MARKET; range 0.1-5
- workingType: Stop price trigger type; "MARK_PRICE" or "CONTRACT_PRICE"
- priceProtect: Price protection flag; "TRUE" or "FALSE"
- reduceOnly: Reduce-only flag; default "false"
- newClientOrderId: Unique client order ID
- newOrderRespType: Response type; "ACK" or "RESULT"
- orderId: Order ID (e.g., 22542179)
- origClientOrderId: Original client order ID
- orderIdList: List of order IDs to cancel (max 10)
- origClientOrderIdList: List of client order IDs to cancel (max 10)
- batchOrders: List of order objects (max 5)
- countdownTime: Countdown time in milliseconds; set to 0 to cancel countdown
- leverage: Leverage value; range 1-125
- marginType: Margin type; ISOLATED or CROSSED
- amount: Margin amount for position margin modification
- dualSidePosition: Position mode; "true" = Hedge Mode; "false" = One-way Mode
- multiAssetsMargin: Multi-assets mode; "true" = Multi-Assets Mode; "false" = Single-Asset Mode
- asset: Asset name (e.g., USDT)
- clientTranId: Client transfer ID (unique within 7 days)
- kindType: Transfer direction; FUTURE_SPOT or SPOT_FUTURE
- incomeType: Income type filter (TRANSFER, WELCOME_BONUS, REALIZED_PNL, FUNDING_FEE, COMMISSION, INSURANCE_CLEAR, MARKET_MERCHANT_RETURN_REWARD)
- autoCloseType: Force order type; LIQUIDATION or ADL
- fromId: ID to get trades from INCLUSIVE (e.g., 1)
- startTime: Timestamp in ms to filter from INCLUSIVE (e.g., 1735693200000)
- endTime: Timestamp in ms to filter until INCLUSIVE (e.g., 1735693200000)
- limit: Result limit; varies per endpoint (e.g., 500)
- interval: Kline interval (e.g., 1h)
- recvWindow: Request validity window; cannot be greater than 60000 (e.g., 5000)
- timestamp: Request timestamp in milliseconds (e.g., 1735693200000)
- chainIds: Chain ID(s), comma-separated (for deposit/withdraw asset queries)
- chainId: Chain ID (for withdraw operations)
- networks: Network type (EVM, SOLANA), comma-separated
- network: Network type (EVM, SOL)
- currency: Currency name (e.g., ASTER)
- accountType: Account type (spot, perp)
- fee: Withdraw fee in token units
- receiver: Receipt address for withdrawals
- nonce: Unique number for signing (microsecond timestamp for API auth; milliseconds x 1000 for EIP712 withdraw)
- userSignature: EIP712 signature for EVM withdrawals
- signature: ECDSA API signature
Enums
- side: BUY | SELL
- positionSide: BOTH | LONG | SHORT
- type (order): LIMIT | MARKET | STOP | STOP_MARKET | TAKE_PROFIT | TAKE_PROFIT_MARKET | TRAILING_STOP_MARKET
- timeInForce: GTC | IOC | FOK | GTX
- workingType: MARK_PRICE | CONTRACT_PRICE
- marginType: ISOLATED | CROSSED
- newOrderRespType: ACK | RESULT
- interval: 1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M
- orderStatus: NEW | PARTIALLY_FILLED | FILLED | CANCELED | REJECTED | EXPIRED
- contractStatus: PENDING_TRADING | TRADING | PRE_SETTLE | SETTLING | CLOSE
- incomeType: TRANSFER | WELCOME_BONUS | REALIZED_PNL | FUNDING_FEE | COMMISSION | INSURANCE_CLEAR | MARKET_MERCHANT_RETURN_REWARD
- autoCloseType: LIQUIDATION | ADL
- kindType: FUTURE_SPOT | SPOT_FUTURE
- positionMarginType: 1 (add margin) | 2 (reduce margin)
Authentication
For endpoints that require authentication, you will need to provide Aster API credentials.
Required credentials:
- Main Wallet Address (user): Your Aster main wallet address
- API Wallet Address (signer): Your API wallet address (obtained via Pro API registration at asterdex.com)
- API Wallet Private Key: Your API wallet private key (for ECDSA signing)
Base URLs:
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:
0x1234...abcd
0x5678...efgh
private_key_hex...
Line 1: Main wallet address (user)
Line 2: API wallet address (signer)
Line 3: API wallet private key
Never Display Full Secrets
When showing credentials to users:
- Main Wallet: Show first 6 + last 4 characters:
0x1234...abcd
- API Wallet: Show first 6 + last 4 characters:
0x5678...efgh
- Private Key: Always mask, show only last 5:
***...f1a2b
Example response when asked for credentials:
Account: main
Main Wallet: 0x1234...abcd
API Wallet: 0x5678...efgh
Private Key: ***...f1a2b
Environment: Mainnet
Listing Accounts
When listing accounts, show names and environment only -- never keys:
Aster Accounts:
- main (Mainnet)
- trading-01 (Mainnet)
- arb-bot (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
- Main Wallet: your_main_wallet_address
- API Wallet: your_api_wallet_address
- Private Key: your_api_wallet_private_key
- Description: Primary trading account
TOOLS.md Structure
## Aster Accounts
### main
- Main Wallet: 0x1234...abcd
- API Wallet: 0x5678...efgh
- Private Key: private_key_hex...
- Description: Primary trading account
### trading-01
- Main Wallet: 0xaaaa...1111
- API Wallet: 0xbbbb...2222
- Private Key: private_key_hex...
- Description: Automated trading
### arb-bot
- Main Wallet: 0xcccc...3333
- API Wallet: 0xdddd...4444
- Private Key: private_key_hex...
- Description: Arbitrage bot account
Agent Behavior
- Credentials requested: Mask private keys (show last 5 chars only), mask wallet addresses (show first 6 + last 4)
- Listing accounts: Show names and environment, never keys
- Account selection: Ask if ambiguous, default to main
- When doing a transaction in mainnet, confirm with user before by asking to write "CONFIRM" to proceed
- New credentials: Prompt for name, main wallet, API wallet, private key
Adding New Accounts
When user provides new credentials:
- Ask for account name
- Ask for main wallet address (user)
- Ask for API wallet address (signer)
- Ask for API wallet private key
- Store in
TOOLS.md with masked display confirmation
Signing Requests
All authenticated endpoints require EIP-712 ECDSA signature:
- Collect all API parameters as key-value pairs (all values as strings)
- Sort parameters by ASCII key order
- Combine sorted parameters with
user (main wallet address), signer (API wallet address), and nonce (microsecond timestamp) using Web3 ABI encoding
- Generate Keccak256 hash of the ABI-encoded data
- Sign the hash with the API wallet's private key via ECDSA
- Include
user, signer, nonce, and signature in the request
- Timestamp must be current milliseconds; request valid within recvWindow (default 5000ms)
See references/authentication.md for implementation details.
1---2name: aster-futures3description: Aster Futures request using the Aster API. Authentication uses EIP-712 ECDSA signing with API wallet. Supports mainnet.4metadata:5 source: https://skillmd.com/skills/leoyeai-openclaw-master-skills/aster-futures6 version: 1.0.07 author: Aster8license: MIT9---1011# Aster Futures Skill1213Futures request on Aster using authenticated API endpoints. Authentication uses EIP-712 ECDSA signing with API wallet (main wallet + signer wallet). Return the result in JSON format.1415## Data Fetching Guidelines (CRITICAL)1617**NEVER truncate JSON responses** with `head -c`, `head -n`, or similar — truncated JSON is corrupted and will produce wrong results.1819### Mandatory Rules20211. **Always specify `symbol` parameter** when querying a specific trading pair. Many endpoints return ALL symbols when `symbol` is omitted, producing responses of 100KB+.222. **Always use `limit` parameter** to constrain result size. Use the smallest limit that satisfies the request (e.g., `limit=5` instead of default 500).233. **Use `jq` to extract fields** — never parse raw mega-JSON visually. Pipe through `jq` to select only needed data.2425### Progressive Data Exploration Strategy2627When the user asks a broad question (e.g., "what futures are available?"), use a **layered approach**:28291. **Step 1 — Get lightweight summary first:**30 ```bash31 # Get just the symbol list, not full exchangeInfo32 curl -s "https://fapi.asterdex.com/fapi/v3/exchangeInfo" | jq '[.symbols[].symbol]'33 ```34352. **Step 2 — Confirm scope with user** before fetching detailed data for many symbols.36373. **Step 3 — Fetch details for specific symbols only:**38 ```bash39 # Get price for ONE symbol, not all40 curl -s "https://fapi.asterdex.com/fapi/v3/ticker/price?symbol=BTCUSDT"41 ```4243### Endpoints That Return Dangerously Large Data (without symbol filter)4445| Endpoint | Without `symbol` | With `symbol` |46|----------|------------------|---------------|47| `/fapi/v3/exchangeInfo` | ALL symbols + filters (100KB+) | N/A — use `jq` to filter |48| `/fapi/v3/ticker/24hr` | ALL symbols (50KB+) | Single object (~500B) |49| `/fapi/v3/ticker/price` | ALL symbols (10KB+) | Single object (~80B) |50| `/fapi/v3/ticker/bookTicker` | ALL symbols (20KB+) | Single object (~150B) |51| `/fapi/v3/premiumIndex` | ALL symbols (30KB+) | Single object (~300B) |52| `/fapi/v3/depth` | N/A (symbol required) | Varies by `limit`: use `limit=5` for overview |53| `/fapi/v3/klines` | N/A (symbol required) | Default 500 candles — always set `limit` |54| `/fapi/v3/trades` | N/A (symbol required) | Default 500 trades — always set `limit` |5556### Example: Safe vs Unsafe5758```bash59# BAD — returns ALL symbols, then truncates = corrupted JSON60curl -s ".../fapi/v3/ticker/price" | head -c 50006162# GOOD — returns single symbol, complete JSON63curl -s ".../fapi/v3/ticker/price?symbol=BTCUSDT"6465# BAD — 500 candles by default66curl -s ".../fapi/v3/klines?symbol=BTCUSDT&interval=1h"6768# GOOD — only 5 candles69curl -s ".../fapi/v3/klines?symbol=BTCUSDT&interval=1h&limit=5"7071# GOOD — extract just symbol names from exchangeInfo72curl -s ".../fapi/v3/exchangeInfo" | jq '[.symbols[] | {symbol, status}]'73```7475---7677## Quick Reference7879| Endpoint | Description | Required | Optional | Authentication |80|----------|-------------|----------|----------|----------------|81| `/fapi/v3/ping` (GET) | Test connectivity | None | None | No |82| `/fapi/v3/time` (GET) | Check server time | None | None | No |83| `/fapi/v3/exchangeInfo` (GET) | Exchange information | None | None | No |84| `/fapi/v3/depth` (GET) | Order book | symbol | limit | No |85| `/fapi/v3/trades` (GET) | Recent trades list | symbol | limit | No |86| `/fapi/v3/historicalTrades` (GET) | Old trades lookup | symbol | limit, fromId | Yes |87| `/fapi/v3/aggTrades` (GET) | Compressed/Aggregate trades list | symbol | fromId, startTime, endTime, limit | No |88| `/fapi/v3/klines` (GET) | Kline/Candlestick data | symbol, interval | startTime, endTime, limit | No |89| `/fapi/v3/indexPriceKlines` (GET) | Index price kline data | pair, interval | startTime, endTime, limit | No |90| `/fapi/v3/markPriceKlines` (GET) | Mark price kline data | symbol, interval | startTime, endTime, limit | No |91| `/fapi/v3/premiumIndex` (GET) | Mark price and funding rate | None | symbol | No |92| `/fapi/v3/fundingRate` (GET) | Funding rate history | None | symbol, startTime, endTime, limit | No |93| `/fapi/v3/ticker/24hr` (GET) | 24hr ticker price change statistics | None | symbol | No |94| `/fapi/v3/ticker/price` (GET) | Symbol price ticker | None | symbol | No |95| `/fapi/v3/ticker/bookTicker` (GET) | Symbol order book ticker | None | symbol | No |96| `/fapi/v3/order` (POST) | New order | symbol, side, type, timestamp | positionSide, timeInForce, quantity, reduceOnly, price, newClientOrderId, stopPrice, closePosition, activationPrice, callbackRate, workingType, priceProtect, newOrderRespType, recvWindow | Yes |97| `/fapi/v3/batchOrders` (POST) | Place multiple orders | batchOrders, timestamp | recvWindow | Yes |98| `/fapi/v3/order` (GET) | Query order | symbol, timestamp | orderId, origClientOrderId, recvWindow | Yes |99| `/fapi/v3/order` (DELETE) | Cancel order | symbol, timestamp | orderId, origClientOrderId, recvWindow | Yes |100| `/fapi/v3/allOpenOrders` (DELETE) | Cancel all open orders | symbol, timestamp | recvWindow | Yes |101| `/fapi/v3/batchOrders` (DELETE) | Cancel multiple orders | symbol, timestamp | orderIdList, origClientOrderIdList, recvWindow | Yes |102| `/fapi/v3/countdownCancelAll` (POST) | Auto-cancel all open orders (countdown) | symbol, countdownTime, timestamp | recvWindow | Yes |103| `/fapi/v3/openOrder` (GET) | Query current open order | symbol, timestamp | orderId, origClientOrderId, recvWindow | Yes |104| `/fapi/v3/openOrders` (GET) | Current all open orders | timestamp | symbol, recvWindow | Yes |105| `/fapi/v3/allOrders` (GET) | All orders | symbol, timestamp | orderId, startTime, endTime, limit, recvWindow | Yes |106| `/fapi/v3/balance` (GET) | Futures account balance | timestamp | recvWindow | Yes |107| `/fapi/v3/account` (GET) | Account information | timestamp | recvWindow | Yes |108| `/fapi/v3/leverage` (POST) | Change initial leverage | symbol, leverage, timestamp | recvWindow | Yes |109| `/fapi/v3/marginType` (POST) | Change margin type | symbol, marginType, timestamp | recvWindow | Yes |110| `/fapi/v3/positionMargin` (POST) | Modify isolated position margin | symbol, amount, type, timestamp | positionSide, recvWindow | Yes |111| `/fapi/v3/positionMargin/history` (GET) | Position margin change history | symbol, timestamp | type, startTime, endTime, limit, recvWindow | Yes |112| `/fapi/v3/positionRisk` (GET) | Position information | timestamp | symbol, recvWindow | Yes |113| `/fapi/v3/positionSide/dual` (POST) | Change position mode | dualSidePosition, timestamp | recvWindow | Yes |114| `/fapi/v3/positionSide/dual` (GET) | Get current position mode | timestamp | recvWindow | Yes |115| `/fapi/v3/multiAssetsMargin` (POST) | Change multi-assets mode | multiAssetsMargin, timestamp | recvWindow | Yes |116| `/fapi/v3/multiAssetsMargin` (GET) | Get current multi-assets mode | timestamp | recvWindow | Yes |117| `/fapi/v3/asset/wallet/transfer` (POST) | Transfer between futures and spot | amount, asset, clientTranId, kindType, timestamp | None | Yes |118| `/fapi/v3/userTrades` (GET) | Account trade list | symbol, timestamp | startTime, endTime, fromId, limit, recvWindow | Yes |119| `/fapi/v3/income` (GET) | Get income history | timestamp | symbol, incomeType, startTime, endTime, limit, recvWindow | Yes |120| `/fapi/v3/leverageBracket` (GET) | Notional and leverage brackets | timestamp | symbol, recvWindow | Yes |121| `/fapi/v3/adlQuantile` (GET) | Position ADL quantile estimation | timestamp | symbol, recvWindow | Yes |122| `/fapi/v3/forceOrders` (GET) | User's force orders | timestamp | symbol, autoCloseType, startTime, endTime, limit, recvWindow | Yes |123| `/fapi/v3/commissionRate` (GET) | User commission rate | symbol, timestamp | recvWindow | Yes |124| `/fapi/v3/listenKey` (POST) | Start user data stream | None | None | Yes |125| `/fapi/v3/listenKey` (PUT) | Keepalive user data stream | None | None | Yes |126| `/fapi/v3/listenKey` (DELETE) | Close user data stream | None | None | Yes |127| `GET /bapi/futures/v1/public/future/aster/deposit/assets` | Get all deposit assets | chainIds, accountType | networks | No |128| `GET /bapi/futures/v1/public/future/aster/withdraw/assets` | Get all withdraw assets | chainIds, accountType | networks | No |129| `GET /bapi/futures/v1/public/future/aster/estimate-withdraw-fee` | Estimate withdraw fee | chainId, network, currency, accountType | None | No |130| `POST /fapi/aster/user-withdraw` | Withdraw by API (EVM Futures) | chainId, asset, amount, fee, receiver, nonce, userSignature, timestamp, signature | recvWindow | Yes |131| `POST /fapi/aster/user-solana-withdraw` | Withdraw by API (Solana Futures) | chainId, asset, amount, fee, receiver, timestamp, signature | recvWindow | Yes |132133---134135## Parameters136137### Common Parameters138139* **symbol**: Trading pair symbol (e.g., BTCUSDT)140* **pair**: Trading pair for index price endpoints (e.g., BTCUSDT)141* **side**: Order side BUY or SELL142* **type**: Order type (LIMIT, MARKET, STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET)143* **positionSide**: Position side; default BOTH for One-way Mode; LONG/SHORT for Hedge Mode144* **timeInForce**: Time in force (GTC, IOC, FOK, GTX)145* **quantity**: Order quantity (e.g., 0.1)146* **price**: Order price (e.g., 50000)147* **stopPrice**: Stop price for STOP/STOP_MARKET/TAKE_PROFIT/TAKE_PROFIT_MARKET orders148* **closePosition**: Close-All flag; "true" or "false"; cannot be used with quantity149* **activationPrice**: Activation price for TRAILING_STOP_MARKET orders150* **callbackRate**: Callback rate for TRAILING_STOP_MARKET; range 0.1-5151* **workingType**: Stop price trigger type; "MARK_PRICE" or "CONTRACT_PRICE"152* **priceProtect**: Price protection flag; "TRUE" or "FALSE"153* **reduceOnly**: Reduce-only flag; default "false"154* **newClientOrderId**: Unique client order ID155* **newOrderRespType**: Response type; "ACK" or "RESULT"156* **orderId**: Order ID (e.g., 22542179)157* **origClientOrderId**: Original client order ID158* **orderIdList**: List of order IDs to cancel (max 10)159* **origClientOrderIdList**: List of client order IDs to cancel (max 10)160* **batchOrders**: List of order objects (max 5)161* **countdownTime**: Countdown time in milliseconds; set to 0 to cancel countdown162* **leverage**: Leverage value; range 1-125163* **marginType**: Margin type; ISOLATED or CROSSED164* **amount**: Margin amount for position margin modification165* **dualSidePosition**: Position mode; "true" = Hedge Mode; "false" = One-way Mode166* **multiAssetsMargin**: Multi-assets mode; "true" = Multi-Assets Mode; "false" = Single-Asset Mode167* **asset**: Asset name (e.g., USDT)168* **clientTranId**: Client transfer ID (unique within 7 days)169* **kindType**: Transfer direction; FUTURE_SPOT or SPOT_FUTURE170* **incomeType**: Income type filter (TRANSFER, WELCOME_BONUS, REALIZED_PNL, FUNDING_FEE, COMMISSION, INSURANCE_CLEAR, MARKET_MERCHANT_RETURN_REWARD)171* **autoCloseType**: Force order type; LIQUIDATION or ADL172* **fromId**: ID to get trades from INCLUSIVE (e.g., 1)173* **startTime**: Timestamp in ms to filter from INCLUSIVE (e.g., 1735693200000)174* **endTime**: Timestamp in ms to filter until INCLUSIVE (e.g., 1735693200000)175* **limit**: Result limit; varies per endpoint (e.g., 500)176* **interval**: Kline interval (e.g., 1h)177* **recvWindow**: Request validity window; cannot be greater than 60000 (e.g., 5000)178* **timestamp**: Request timestamp in milliseconds (e.g., 1735693200000)179* **chainIds**: Chain ID(s), comma-separated (for deposit/withdraw asset queries)180* **chainId**: Chain ID (for withdraw operations)181* **networks**: Network type (EVM, SOLANA), comma-separated182* **network**: Network type (EVM, SOL)183* **currency**: Currency name (e.g., ASTER)184* **accountType**: Account type (spot, perp)185* **fee**: Withdraw fee in token units186* **receiver**: Receipt address for withdrawals187* **nonce**: Unique number for signing (microsecond timestamp for API auth; milliseconds x 1000 for EIP712 withdraw)188* **userSignature**: EIP712 signature for EVM withdrawals189* **signature**: ECDSA API signature190191### Enums192193* **side**: BUY | SELL194* **positionSide**: BOTH | LONG | SHORT195* **type** (order): LIMIT | MARKET | STOP | STOP_MARKET | TAKE_PROFIT | TAKE_PROFIT_MARKET | TRAILING_STOP_MARKET196* **timeInForce**: GTC | IOC | FOK | GTX197* **workingType**: MARK_PRICE | CONTRACT_PRICE198* **marginType**: ISOLATED | CROSSED199* **newOrderRespType**: ACK | RESULT200* **interval**: 1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M201* **orderStatus**: NEW | PARTIALLY_FILLED | FILLED | CANCELED | REJECTED | EXPIRED202* **contractStatus**: PENDING_TRADING | TRADING | PRE_SETTLE | SETTLING | CLOSE203* **incomeType**: TRANSFER | WELCOME_BONUS | REALIZED_PNL | FUNDING_FEE | COMMISSION | INSURANCE_CLEAR | MARKET_MERCHANT_RETURN_REWARD204* **autoCloseType**: LIQUIDATION | ADL205* **kindType**: FUTURE_SPOT | SPOT_FUTURE206* **positionMarginType**: 1 (add margin) | 2 (reduce margin)207208## Authentication209210For endpoints that require authentication, you will need to provide Aster API credentials.211Required credentials:212213* **Main Wallet Address (user)**: Your Aster main wallet address214* **API Wallet Address (signer)**: Your API wallet address (obtained via Pro API registration at asterdex.com)215* **API Wallet Private Key**: Your API wallet private key (for ECDSA signing)216217Base URLs:218* Mainnet REST: https://fapi.asterdex.com219* Mainnet WebSocket: wss://fstream.asterdex.com220* Deposit/Withdraw Portal: https://www.asterdex.com221222See [`references/authentication.md`](./references/authentication.md) for implementation details.223224## Security225226### Share Credentials227228Users can provide Aster API credentials by sending a file where the content is in the following format:229230```bash2310x1234...abcd2320x5678...efgh233private_key_hex...234```235236Line 1: Main wallet address (user)237Line 2: API wallet address (signer)238Line 3: API wallet private key239240### Never Display Full Secrets241242When showing credentials to users:243- **Main Wallet:** Show first 6 + last 4 characters: `0x1234...abcd`244- **API Wallet:** Show first 6 + last 4 characters: `0x5678...efgh`245- **Private Key:** Always mask, show only last 5: `***...f1a2b`246247Example response when asked for credentials:248Account: main249Main Wallet: 0x1234...abcd250API Wallet: 0x5678...efgh251Private Key: ***...f1a2b252Environment: Mainnet253254### Listing Accounts255256When listing accounts, show names and environment only -- never keys:257Aster Accounts:258* main (Mainnet)259* trading-01 (Mainnet)260* arb-bot (Mainnet)261262### Transactions in Mainnet263264When performing transactions in mainnet, always confirm with the user before proceeding by asking them to write "CONFIRM" to proceed.265266---267268## Aster Accounts269270### main271- Main Wallet: your_main_wallet_address272- API Wallet: your_api_wallet_address273- Private Key: your_api_wallet_private_key274- Description: Primary trading account275276### TOOLS.md Structure277278```bash279## Aster Accounts280281### main282- Main Wallet: 0x1234...abcd283- API Wallet: 0x5678...efgh284- Private Key: private_key_hex...285- Description: Primary trading account286287### trading-01288- Main Wallet: 0xaaaa...1111289- API Wallet: 0xbbbb...2222290- Private Key: private_key_hex...291- Description: Automated trading292293### arb-bot294- Main Wallet: 0xcccc...3333295- API Wallet: 0xdddd...4444296- Private Key: private_key_hex...297- Description: Arbitrage bot account298```299300## Agent Behavior3013021. Credentials requested: Mask private keys (show last 5 chars only), mask wallet addresses (show first 6 + last 4)3032. Listing accounts: Show names and environment, never keys3043. Account selection: Ask if ambiguous, default to main3054. When doing a transaction in mainnet, confirm with user before by asking to write "CONFIRM" to proceed3065. New credentials: Prompt for name, main wallet, API wallet, private key307308## Adding New Accounts309310When user provides new credentials:311312* Ask for account name313* Ask for main wallet address (user)314* Ask for API wallet address (signer)315* Ask for API wallet private key316* Store in `TOOLS.md` with masked display confirmation317318## Signing Requests319320All authenticated endpoints require EIP-712 ECDSA signature:3213221. Collect all API parameters as key-value pairs (all values as strings)3232. Sort parameters by ASCII key order3243. Combine sorted parameters with `user` (main wallet address), `signer` (API wallet address), and `nonce` (microsecond timestamp) using Web3 ABI encoding3254. Generate Keccak256 hash of the ABI-encoded data3265. Sign the hash with the API wallet's private key via ECDSA3276. Include `user`, `signer`, `nonce`, and `signature` in the request3287. Timestamp must be current milliseconds; request valid within recvWindow (default 5000ms)329330See [`references/authentication.md`](./references/authentication.md) for implementation details.