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.4license: MIT5---67# Aster Futures Skill89Futures 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.1011## Data Fetching Guidelines (CRITICAL)1213**NEVER truncate JSON responses** with `head -c`, `head -n`, or similar — truncated JSON is corrupted and will produce wrong results.1415### Mandatory Rules16171. **Always specify `symbol` parameter** when querying a specific trading pair. Many endpoints return ALL symbols when `symbol` is omitted, producing responses of 100KB+.182. **Always use `limit` parameter** to constrain result size. Use the smallest limit that satisfies the request (e.g., `limit=5` instead of default 500).193. **Use `jq` to extract fields** — never parse raw mega-JSON visually. Pipe through `jq` to select only needed data.2021### Progressive Data Exploration Strategy2223When the user asks a broad question (e.g., "what futures are available?"), use a **layered approach**:24251. **Step 1 — Get lightweight summary first:**26 ```bash27 # Get just the symbol list, not full exchangeInfo28 curl -s "https://fapi.asterdex.com/fapi/v3/exchangeInfo" | jq '[.symbols[].symbol]'29 ```30312. **Step 2 — Confirm scope with user** before fetching detailed data for many symbols.32333. **Step 3 — Fetch details for specific symbols only:**34 ```bash35 # Get price for ONE symbol, not all36 curl -s "https://fapi.asterdex.com/fapi/v3/ticker/price?symbol=BTCUSDT"37 ```3839### Endpoints That Return Dangerously Large Data (without symbol filter)4041| Endpoint | Without `symbol` | With `symbol` |42|----------|------------------|---------------|43| `/fapi/v3/exchangeInfo` | ALL symbols + filters (100KB+) | N/A — use `jq` to filter |44| `/fapi/v3/ticker/24hr` | ALL symbols (50KB+) | Single object (~500B) |45| `/fapi/v3/ticker/price` | ALL symbols (10KB+) | Single object (~80B) |46| `/fapi/v3/ticker/bookTicker` | ALL symbols (20KB+) | Single object (~150B) |47| `/fapi/v3/premiumIndex` | ALL symbols (30KB+) | Single object (~300B) |48| `/fapi/v3/depth` | N/A (symbol required) | Varies by `limit`: use `limit=5` for overview |49| `/fapi/v3/klines` | N/A (symbol required) | Default 500 candles — always set `limit` |50| `/fapi/v3/trades` | N/A (symbol required) | Default 500 trades — always set `limit` |5152### Example: Safe vs Unsafe5354```bash55# BAD — returns ALL symbols, then truncates = corrupted JSON56curl -s ".../fapi/v3/ticker/price" | head -c 50005758# GOOD — returns single symbol, complete JSON59curl -s ".../fapi/v3/ticker/price?symbol=BTCUSDT"6061# BAD — 500 candles by default62curl -s ".../fapi/v3/klines?symbol=BTCUSDT&interval=1h"6364# GOOD — only 5 candles65curl -s ".../fapi/v3/klines?symbol=BTCUSDT&interval=1h&limit=5"6667# GOOD — extract just symbol names from exchangeInfo68curl -s ".../fapi/v3/exchangeInfo" | jq '[.symbols[] | {symbol, status}]'69```7071---7273## Quick Reference7475| Endpoint | Description | Required | Optional | Authentication |76|----------|-------------|----------|----------|----------------|77| `/fapi/v3/ping` (GET) | Test connectivity | None | None | No |78| `/fapi/v3/time` (GET) | Check server time | None | None | No |79| `/fapi/v3/exchangeInfo` (GET) | Exchange information | None | None | No |80| `/fapi/v3/depth` (GET) | Order book | symbol | limit | No |81| `/fapi/v3/trades` (GET) | Recent trades list | symbol | limit | No |82| `/fapi/v3/historicalTrades` (GET) | Old trades lookup | symbol | limit, fromId | Yes |83| `/fapi/v3/aggTrades` (GET) | Compressed/Aggregate trades list | symbol | fromId, startTime, endTime, limit | No |84| `/fapi/v3/klines` (GET) | Kline/Candlestick data | symbol, interval | startTime, endTime, limit | No |85| `/fapi/v3/indexPriceKlines` (GET) | Index price kline data | pair, interval | startTime, endTime, limit | No |86| `/fapi/v3/markPriceKlines` (GET) | Mark price kline data | symbol, interval | startTime, endTime, limit | No |87| `/fapi/v3/premiumIndex` (GET) | Mark price and funding rate | None | symbol | No |88| `/fapi/v3/fundingRate` (GET) | Funding rate history | None | symbol, startTime, endTime, limit | No |89| `/fapi/v3/ticker/24hr` (GET) | 24hr ticker price change statistics | None | symbol | No |90| `/fapi/v3/ticker/price` (GET) | Symbol price ticker | None | symbol | No |91| `/fapi/v3/ticker/bookTicker` (GET) | Symbol order book ticker | None | symbol | No |92| `/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 |93| `/fapi/v3/batchOrders` (POST) | Place multiple orders | batchOrders, timestamp | recvWindow | Yes |94| `/fapi/v3/order` (GET) | Query order | symbol, timestamp | orderId, origClientOrderId, recvWindow | Yes |95| `/fapi/v3/order` (DELETE) | Cancel order | symbol, timestamp | orderId, origClientOrderId, recvWindow | Yes |96| `/fapi/v3/allOpenOrders` (DELETE) | Cancel all open orders | symbol, timestamp | recvWindow | Yes |97| `/fapi/v3/batchOrders` (DELETE) | Cancel multiple orders | symbol, timestamp | orderIdList, origClientOrderIdList, recvWindow | Yes |98| `/fapi/v3/countdownCancelAll` (POST) | Auto-cancel all open orders (countdown) | symbol, countdownTime, timestamp | recvWindow | Yes |99| `/fapi/v3/openOrder` (GET) | Query current open order | symbol, timestamp | orderId, origClientOrderId, recvWindow | Yes |100| `/fapi/v3/openOrders` (GET) | Current all open orders | timestamp | symbol, recvWindow | Yes |101| `/fapi/v3/allOrders` (GET) | All orders | symbol, timestamp | orderId, startTime, endTime, limit, recvWindow | Yes |102| `/fapi/v3/balance` (GET) | Futures account balance | timestamp | recvWindow | Yes |103| `/fapi/v3/account` (GET) | Account information | timestamp | recvWindow | Yes |104| `/fapi/v3/leverage` (POST) | Change initial leverage | symbol, leverage, timestamp | recvWindow | Yes |105| `/fapi/v3/marginType` (POST) | Change margin type | symbol, marginType, timestamp | recvWindow | Yes |106| `/fapi/v3/positionMargin` (POST) | Modify isolated position margin | symbol, amount, type, timestamp | positionSide, recvWindow | Yes |107| `/fapi/v3/positionMargin/history` (GET) | Position margin change history | symbol, timestamp | type, startTime, endTime, limit, recvWindow | Yes |108| `/fapi/v3/positionRisk` (GET) | Position information | timestamp | symbol, recvWindow | Yes |109| `/fapi/v3/positionSide/dual` (POST) | Change position mode | dualSidePosition, timestamp | recvWindow | Yes |110| `/fapi/v3/positionSide/dual` (GET) | Get current position mode | timestamp | recvWindow | Yes |111| `/fapi/v3/multiAssetsMargin` (POST) | Change multi-assets mode | multiAssetsMargin, timestamp | recvWindow | Yes |112| `/fapi/v3/multiAssetsMargin` (GET) | Get current multi-assets mode | timestamp | recvWindow | Yes |113| `/fapi/v3/asset/wallet/transfer` (POST) | Transfer between futures and spot | amount, asset, clientTranId, kindType, timestamp | None | Yes |114| `/fapi/v3/userTrades` (GET) | Account trade list | symbol, timestamp | startTime, endTime, fromId, limit, recvWindow | Yes |115| `/fapi/v3/income` (GET) | Get income history | timestamp | symbol, incomeType, startTime, endTime, limit, recvWindow | Yes |116| `/fapi/v3/leverageBracket` (GET) | Notional and leverage brackets | timestamp | symbol, recvWindow | Yes |117| `/fapi/v3/adlQuantile` (GET) | Position ADL quantile estimation | timestamp | symbol, recvWindow | Yes |118| `/fapi/v3/forceOrders` (GET) | User's force orders | timestamp | symbol, autoCloseType, startTime, endTime, limit, recvWindow | Yes |119| `/fapi/v3/commissionRate` (GET) | User commission rate | symbol, timestamp | recvWindow | Yes |120| `/fapi/v3/listenKey` (POST) | Start user data stream | None | None | Yes |121| `/fapi/v3/listenKey` (PUT) | Keepalive user data stream | None | None | Yes |122| `/fapi/v3/listenKey` (DELETE) | Close user data stream | None | None | Yes |123| `GET /bapi/futures/v1/public/future/aster/deposit/assets` | Get all deposit assets | chainIds, accountType | networks | No |124| `GET /bapi/futures/v1/public/future/aster/withdraw/assets` | Get all withdraw assets | chainIds, accountType | networks | No |125| `GET /bapi/futures/v1/public/future/aster/estimate-withdraw-fee` | Estimate withdraw fee | chainId, network, currency, accountType | None | No |126| `POST /fapi/aster/user-withdraw` | Withdraw by API (EVM Futures) | chainId, asset, amount, fee, receiver, nonce, userSignature, timestamp, signature | recvWindow | Yes |127| `POST /fapi/aster/user-solana-withdraw` | Withdraw by API (Solana Futures) | chainId, asset, amount, fee, receiver, timestamp, signature | recvWindow | Yes |128129---130131## Parameters132133### Common Parameters134135* **symbol**: Trading pair symbol (e.g., BTCUSDT)136* **pair**: Trading pair for index price endpoints (e.g., BTCUSDT)137* **side**: Order side BUY or SELL138* **type**: Order type (LIMIT, MARKET, STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET)139* **positionSide**: Position side; default BOTH for One-way Mode; LONG/SHORT for Hedge Mode140* **timeInForce**: Time in force (GTC, IOC, FOK, GTX)141* **quantity**: Order quantity (e.g., 0.1)142* **price**: Order price (e.g., 50000)143* **stopPrice**: Stop price for STOP/STOP_MARKET/TAKE_PROFIT/TAKE_PROFIT_MARKET orders144* **closePosition**: Close-All flag; "true" or "false"; cannot be used with quantity145* **activationPrice**: Activation price for TRAILING_STOP_MARKET orders146* **callbackRate**: Callback rate for TRAILING_STOP_MARKET; range 0.1-5147* **workingType**: Stop price trigger type; "MARK_PRICE" or "CONTRACT_PRICE"148* **priceProtect**: Price protection flag; "TRUE" or "FALSE"149* **reduceOnly**: Reduce-only flag; default "false"150* **newClientOrderId**: Unique client order ID151* **newOrderRespType**: Response type; "ACK" or "RESULT"152* **orderId**: Order ID (e.g., 22542179)153* **origClientOrderId**: Original client order ID154* **orderIdList**: List of order IDs to cancel (max 10)155* **origClientOrderIdList**: List of client order IDs to cancel (max 10)156* **batchOrders**: List of order objects (max 5)157* **countdownTime**: Countdown time in milliseconds; set to 0 to cancel countdown158* **leverage**: Leverage value; range 1-125159* **marginType**: Margin type; ISOLATED or CROSSED160* **amount**: Margin amount for position margin modification161* **dualSidePosition**: Position mode; "true" = Hedge Mode; "false" = One-way Mode162* **multiAssetsMargin**: Multi-assets mode; "true" = Multi-Assets Mode; "false" = Single-Asset Mode163* **asset**: Asset name (e.g., USDT)164* **clientTranId**: Client transfer ID (unique within 7 days)165* **kindType**: Transfer direction; FUTURE_SPOT or SPOT_FUTURE166* **incomeType**: Income type filter (TRANSFER, WELCOME_BONUS, REALIZED_PNL, FUNDING_FEE, COMMISSION, INSURANCE_CLEAR, MARKET_MERCHANT_RETURN_REWARD)167* **autoCloseType**: Force order type; LIQUIDATION or ADL168* **fromId**: ID to get trades from INCLUSIVE (e.g., 1)169* **startTime**: Timestamp in ms to filter from INCLUSIVE (e.g., 1735693200000)170* **endTime**: Timestamp in ms to filter until INCLUSIVE (e.g., 1735693200000)171* **limit**: Result limit; varies per endpoint (e.g., 500)172* **interval**: Kline interval (e.g., 1h)173* **recvWindow**: Request validity window; cannot be greater than 60000 (e.g., 5000)174* **timestamp**: Request timestamp in milliseconds (e.g., 1735693200000)175* **chainIds**: Chain ID(s), comma-separated (for deposit/withdraw asset queries)176* **chainId**: Chain ID (for withdraw operations)177* **networks**: Network type (EVM, SOLANA), comma-separated178* **network**: Network type (EVM, SOL)179* **currency**: Currency name (e.g., ASTER)180* **accountType**: Account type (spot, perp)181* **fee**: Withdraw fee in token units182* **receiver**: Receipt address for withdrawals183* **nonce**: Unique number for signing (microsecond timestamp for API auth; milliseconds x 1000 for EIP712 withdraw)184* **userSignature**: EIP712 signature for EVM withdrawals185* **signature**: ECDSA API signature186187### Enums188189* **side**: BUY | SELL190* **positionSide**: BOTH | LONG | SHORT191* **type** (order): LIMIT | MARKET | STOP | STOP_MARKET | TAKE_PROFIT | TAKE_PROFIT_MARKET | TRAILING_STOP_MARKET192* **timeInForce**: GTC | IOC | FOK | GTX193* **workingType**: MARK_PRICE | CONTRACT_PRICE194* **marginType**: ISOLATED | CROSSED195* **newOrderRespType**: ACK | RESULT196* **interval**: 1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M197* **orderStatus**: NEW | PARTIALLY_FILLED | FILLED | CANCELED | REJECTED | EXPIRED198* **contractStatus**: PENDING_TRADING | TRADING | PRE_SETTLE | SETTLING | CLOSE199* **incomeType**: TRANSFER | WELCOME_BONUS | REALIZED_PNL | FUNDING_FEE | COMMISSION | INSURANCE_CLEAR | MARKET_MERCHANT_RETURN_REWARD200* **autoCloseType**: LIQUIDATION | ADL201* **kindType**: FUTURE_SPOT | SPOT_FUTURE202* **positionMarginType**: 1 (add margin) | 2 (reduce margin)203204## Authentication205206For endpoints that require authentication, you will need to provide Aster API credentials.207Required credentials:208209* **Main Wallet Address (user)**: Your Aster main wallet address210* **API Wallet Address (signer)**: Your API wallet address (obtained via Pro API registration at asterdex.com)211* **API Wallet Private Key**: Your API wallet private key (for ECDSA signing)212213Base URLs:214* Mainnet REST: https://fapi.asterdex.com215* Mainnet WebSocket: wss://fstream.asterdex.com216* Deposit/Withdraw Portal: https://www.asterdex.com217218See [`references/authentication.md`](./references/authentication.md) for implementation details.219220## Security221222### Share Credentials223224Users can provide Aster API credentials by sending a file where the content is in the following format:225226```bash2270x1234...abcd2280x5678...efgh229private_key_hex...230```231232Line 1: Main wallet address (user)233Line 2: API wallet address (signer)234Line 3: API wallet private key235236### Never Display Full Secrets237238When showing credentials to users:239- **Main Wallet:** Show first 6 + last 4 characters: `0x1234...abcd`240- **API Wallet:** Show first 6 + last 4 characters: `0x5678...efgh`241- **Private Key:** Always mask, show only last 5: `***...f1a2b`242243Example response when asked for credentials:244Account: main245Main Wallet: 0x1234...abcd246API Wallet: 0x5678...efgh247Private Key: ***...f1a2b248Environment: Mainnet249250### Listing Accounts251252When listing accounts, show names and environment only -- never keys:253Aster Accounts:254* main (Mainnet)255* trading-01 (Mainnet)256* arb-bot (Mainnet)257258### Transactions in Mainnet259260When performing transactions in mainnet, always confirm with the user before proceeding by asking them to write "CONFIRM" to proceed.261262---263264## Aster Accounts265266### main267- Main Wallet: your_main_wallet_address268- API Wallet: your_api_wallet_address269- Private Key: your_api_wallet_private_key270- Description: Primary trading account271272### TOOLS.md Structure273274```bash275## Aster Accounts276277### main278- Main Wallet: 0x1234...abcd279- API Wallet: 0x5678...efgh280- Private Key: private_key_hex...281- Description: Primary trading account282283### trading-01284- Main Wallet: 0xaaaa...1111285- API Wallet: 0xbbbb...2222286- Private Key: private_key_hex...287- Description: Automated trading288289### arb-bot290- Main Wallet: 0xcccc...3333291- API Wallet: 0xdddd...4444292- Private Key: private_key_hex...293- Description: Arbitrage bot account294```295296## Agent Behavior2972981. Credentials requested: Mask private keys (show last 5 chars only), mask wallet addresses (show first 6 + last 4)2992. Listing accounts: Show names and environment, never keys3003. Account selection: Ask if ambiguous, default to main3014. When doing a transaction in mainnet, confirm with user before by asking to write "CONFIRM" to proceed3025. New credentials: Prompt for name, main wallet, API wallet, private key303304## Adding New Accounts305306When user provides new credentials:307308* Ask for account name309* Ask for main wallet address (user)310* Ask for API wallet address (signer)311* Ask for API wallet private key312* Store in `TOOLS.md` with masked display confirmation313314## Signing Requests315316All authenticated endpoints require EIP-712 ECDSA signature:3173181. Collect all API parameters as key-value pairs (all values as strings)3192. Sort parameters by ASCII key order3203. Combine sorted parameters with `user` (main wallet address), `signer` (API wallet address), and `nonce` (microsecond timestamp) using Web3 ABI encoding3214. Generate Keccak256 hash of the ABI-encoded data3225. Sign the hash with the API wallet's private key via ECDSA3236. Include `user`, `signer`, `nonce`, and `signature` in the request3247. Timestamp must be current milliseconds; request valid within recvWindow (default 5000ms)325326See [`references/authentication.md`](./references/authentication.md) for implementation details.