Type/to search
Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
Capability Matrix
Centralized Exchanges
Decentralized Exchanges (DEX)
Hyperliquid
Lighter
edgeX
Aster
Aevo
Pendle
WOOFi Pro
Uniswap / PancakeSwap
Aerodrome / Velodrome
KyberSwap
1inch
EVM DEX Common Commands
Jupiter
OKX DEX
DEX Strategy Examples
Prediction Markets
Securities and Futures
On-chain & Custom

Aster (Spot): Aster spot (API address https://sapi.asterdex.com). Private endpoints use wallet signatures (EIP-712): configure the main account's wallet address plus the private key of the API signer wallet authorized for that account on Aster (the signer wallet address is optional and is derived from the private key); no API Key is needed. Perpetual contracts use the Futures_Aster exchange object.

Futures_ApolloX (Futures): ApolloX has merged into and been renamed Aster. Futures_ApolloX connects to the same exchange's legacy futures API (https://fapi.apollox.finance, the v1/v2 API that mirrors Binance USDⓈ-M) with an API Key (HMAC signature); perpetual contracts only. The Futures_Aster exchange object connects to the v3 API with wallet signatures.

Futures_Aster (Futures): Aster perpetual contracts (API address https://fapi.asterdex.com, the v3 API that mirrors Binance USDⓈ-M). Private endpoints use wallet signatures (EIP-712): configure the main account's wallet address plus the private key of the API signer wallet authorized for that account on Aster (the signer wallet address is optional and is derived from the private key); no API Key is needed. The Futures_ApolloX exchange object connects to the same exchange's legacy API with an API Key (HMAC); spot uses the Aster exchange object.

Names and Configuration
exchange.GetName()TypeAliases
AsterSpotAsterDEX
Futures_ApolloXFuturesApolloX, ApolloX DEX
Futures_AsterFutures—

✓ marks the exchange objects that have the field.

FieldAsterFutures_ApolloXFutures_AsterRequiredDescription
User✓✓YesWallet address of the main account (the account holding the assets).
Signer✓✓NoAddress of the API signer wallet (agent wallet) authorized for the main account on Aster. It is optional; when blank it is derived from the signer private key below (the address of that key is the signer wallet address); when filled it is used as is and must match the private key.
Private Key✓✓YesPrivate key of the signer wallet above, used to sign private requests.
Access Key✓YesThe API Key created in the exchange's API management.
Secret Key✓YesThe Secret Key paired with the API Key, used for HMAC signing.

Trading Pairs and Contract Codes
All exchange objects

Pair examples: BTC_USDT, ETH_USDT

Futures_ApolloX (Futures), Futures_Aster (Futures)

Trading pairs are built from the exchange's base and quote assets as BASE_QUOTE; the quote currency is mostly USDT, with others such as USD1, see exchange.GetMarkets().

Contract codeDescription
swapPerpetual contract; the full symbol looks like BTC_USDT.swap.

Perpetual contracts only; any other contract code is rejected.

Aster (Spot)

Trading pairs are built from the exchange's base and quote assets as BASE_QUOTE (upper case); besides USDT there are other quote currencies such as USD1, see exchange.GetMarkets(). Spot pairs take no contract suffix.

Exchange-specific IO Commands
Aster (Spot)

No exchange-specific commands; for the common commands see exchange.IO.

Futures_ApolloX (Futures)
CommandArgumentsDescriptionReturns
crossbool[, symbol]Cross (true) / isolated (false) margin, set per contract; the current contract is used when symbol is omitted. If the same mode was already set successfully for that contract in this live trading, it returns at once without calling the exchange.Null also on success; check GetLastError() afterwards when needed. If the contract is already in the requested mode, the first call may get an exchange error (Binance-style -4046).
dualboolHedge (true) / one-way (false) position mode, an account-level setting.The boolean that was set, on success.

For the common commands api, base and currency see exchange.IO.

Futures_Aster (Futures)
CommandArgumentsDescriptionReturns
crossbool[, symbol]Cross (true) / isolated (false) margin, set per contract; the current contract is used when symbol is omitted.Null also on success; check GetLastError() afterwards when needed. The exchange reports an error (-4046) when the contract is already in the requested mode.
dualboolHedge (true) / one-way (false) position mode, an account-level setting.Null also on success; check GetLastError() afterwards when needed.

For the common commands api, base and currency see exchange.IO.

Function Support
All exchange objects

Not supported (the call fails with an error and returns null): exchange.ModifyOrder, exchange.ModifyConditionOrder.

Futures_ApolloX (Futures), Futures_Aster (Futures)

Served through a fallback:

  • exchange.GetRecords: Native periods are 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M; other periods are synthesized by the docker.
Aster (Spot)

Served through a fallback:

  • exchange.GetRecords: Native periods are 1s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M; other periods are synthesized by the docker.

Margin, Account and Simulation
Futures_ApolloX (Futures), Futures_Aster (Futures)

Position mode: Switch hedge/one-way mode with exchange.IO("dual", bool). The account's position mode is queried once before the first order and cached; in hedge mode orders carry positionSide automatically (closing orders without reduceOnly), or an explicit positionSide can be passed in the order's extra parameters. After a failed order the mode is queried again for the next order.

Futures_ApolloX (Futures)

Margin mode: Switch cross/isolated margin per contract with exchange.IO("cross", bool); set leverage per contract with exchange.SetMarginLevel().

Futures_Aster (Futures)

Margin mode: Switch cross/isolated margin per contract with exchange.IO("cross", bool); set leverage per contract with exchange.SetMarginLevel(). When the account has Multi-Assets mode enabled, the exchange rejects switching to isolated margin (-4168).

Account: In single-asset mode exchange.GetAccount() reads the row of the current quote currency (such as USDT): Balance is that currency's withdrawable balance and Equity its margin balance. In Multi-Assets mode all margin currencies share one USD-valued margin pool: Balance is the account's available margin (availableBalance), FrozenBalance the initial margin held by open orders, Equity the account margin balance (totalMarginBalance) and UPnL the account's unrealized PnL, all whole-account USD values computed by the exchange regardless of the quote currency; the account mode is queried at most once a minute and cached. exchange.GetAssets() lists each currency's own wallet balance.

Notes
Aster (Spot), Futures_Aster (Futures)
  • After exchange.IO("base", url) switches to a testnet address containing testnet, signatures automatically use the testnet chain ID.
Futures_ApolloX (Futures), Futures_Aster (Futures)
  • Order amounts are base-currency quantities (one contract is one unit of the base currency); market buy orders also use the base-currency quantity.
  • Conditional orders support take-profit and stop-loss only, not OCO; create a take-profit order and a stop-loss order separately when needed. Modifying a conditional order (exchange.ModifyConditionOrder()) is not supported; cancel and recreate it instead.
  • exchange.GetHistoryOrders() and exchange.GetHistoryConditionOrders() require a contract.
Aster (Spot)
  • The amount of a market buy order is the quote-currency amount (sent as Aster's quoteOrderQty); a market sell order uses the base-currency quantity. Conditional orders always use the base-currency quantity, for both buys and sells.
  • A market buy by quote amount is rounded down to the quantity step by the exchange; the leftover amount below one step is not used and the order ends as EXPIRED. As long as anything was filled, the queried order status is filled (ORDER_STATE_CLOSED), and both Amount and DealAmount are the base-currency quantity actually bought. A market order placed by quantity that is not fully filled for lack of liquidity is still canceled (DealAmount less than Amount).
  • Conditional orders support take-profit and stop-loss only, not OCO; create a take-profit order and a stop-loss order separately when needed. Modifying a conditional order (exchange.ModifyConditionOrder()) is not supported; cancel and recreate it instead. exchange.GetConditionOrder() with the ID of a regular order fails (that order is not conditional).
  • exchange.GetHistoryOrders() and exchange.GetHistoryConditionOrders() require a trading pair.