pub struct RestClient { /* private fields */ }Expand description
Async REST client for AsterDex Futures V3 API.
Supports both public (unsigned) and authenticated (signed) endpoints.
Use new_public for public-only access, from_env or new for authenticated access.
Implementations§
Source§impl RestClient
impl RestClient
Sourcepub fn from_env() -> Result<Self, AsterDexError>
pub fn from_env() -> Result<Self, AsterDexError>
Construct authenticated client from environment variables.
Reads: ASTERDEX_USER, ASTERDEX_SIGNER_ADDRESS, ASTERDEX_SIGNER_PRIVATE_KEY.
Optional: ASTERDEX_BASE_URL (defaults to https://fapi.asterdex.com).
§Errors
AsterDexError::ConfigErrorif any required env var is missing or invalid
Sourcepub fn new(
base_url: &str,
credentials: Credentials,
) -> Result<Self, AsterDexError>
pub fn new( base_url: &str, credentials: Credentials, ) -> Result<Self, AsterDexError>
Construct authenticated client with explicit base URL and credentials.
§Errors
AsterDexError::ConfigErrorif base URL is invalid
Sourcepub fn new_public(base_url: &str) -> Result<Self, AsterDexError>
pub fn new_public(base_url: &str) -> Result<Self, AsterDexError>
Construct unauthenticated (public) client.
Only public endpoints (unsigned GET) will work. Signed endpoints will return
AsterDexError::ConfigError.
§Errors
AsterDexError::ConfigErrorif base URL is invalid
Sourcepub async fn raw_get(
&self,
path: &str,
params: &[(&str, &str)],
) -> Result<ApiResponse<Value>, AsterDexError>
pub async fn raw_get( &self, path: &str, params: &[(&str, &str)], ) -> Result<ApiResponse<Value>, AsterDexError>
Make an unsigned GET request and return the raw JSON response.
Use when the typed response struct does not cover all fields, or for debugging.
Error mapping (429 → RateLimited, etc.) applies identically to typed methods.
§Errors
AsterDexError::ApiError— if the server returns a 4xx error with{code, msg}AsterDexError::RateLimited— if the server returns 429AsterDexError::NetworkError— if a network-level error occurs
§Examples
let resp = client.raw_get("/fapi/v3/exchangeInfo", &[]).await?;
println!("{}", resp.data);Sourcepub async fn raw_post(
&self,
path: &str,
params: &[(&str, &str)],
) -> Result<ApiResponse<Value>, AsterDexError>
pub async fn raw_post( &self, path: &str, params: &[(&str, &str)], ) -> Result<ApiResponse<Value>, AsterDexError>
Make an unsigned POST request and return the raw JSON response.
§Errors
AsterDexError::ApiError— if the server returns a 4xx error with{code, msg}AsterDexError::RateLimited— if the server returns 429AsterDexError::NetworkError— if a network-level error occurs
Sourcepub async fn raw_delete(
&self,
path: &str,
params: &[(&str, &str)],
) -> Result<ApiResponse<Value>, AsterDexError>
pub async fn raw_delete( &self, path: &str, params: &[(&str, &str)], ) -> Result<ApiResponse<Value>, AsterDexError>
Make an unsigned DELETE request and return the raw JSON response.
§Errors
AsterDexError::ApiError— if the server returns a 4xx error with{code, msg}AsterDexError::RateLimited— if the server returns 429AsterDexError::NetworkError— if a network-level error occurs
Sourcepub async fn raw_signed_get(
&self,
path: &str,
params: &[(&str, &str)],
) -> Result<ApiResponse<Value>, AsterDexError>
pub async fn raw_signed_get( &self, path: &str, params: &[(&str, &str)], ) -> Result<ApiResponse<Value>, AsterDexError>
Make a signed GET request and return the raw JSON response (EIP-712 authenticated).
Requires credentials to be set (use RestClient::from_env()).
§Errors
AsterDexError::ConfigError— if credentials are not setAsterDexError::ApiError— if the server returns a 4xx error with{code, msg}AsterDexError::RateLimited— if the server returns 429AsterDexError::NetworkError— if a network-level error occurs
Sourcepub async fn raw_signed_post(
&self,
path: &str,
params: &[(&str, &str)],
) -> Result<ApiResponse<Value>, AsterDexError>
pub async fn raw_signed_post( &self, path: &str, params: &[(&str, &str)], ) -> Result<ApiResponse<Value>, AsterDexError>
Make a signed POST request and return the raw JSON response.
Requires credentials to be set (use RestClient::from_env()).
§Errors
AsterDexError::ConfigError— if credentials are not setAsterDexError::ApiError— if the server returns a 4xx error with{code, msg}AsterDexError::RateLimited— if the server returns 429AsterDexError::NetworkError— if a network-level error occurs
Sourcepub async fn raw_signed_delete(
&self,
path: &str,
params: &[(&str, &str)],
) -> Result<ApiResponse<Value>, AsterDexError>
pub async fn raw_signed_delete( &self, path: &str, params: &[(&str, &str)], ) -> Result<ApiResponse<Value>, AsterDexError>
Make a signed DELETE request and return the raw JSON response.
Requires credentials to be set (use RestClient::from_env()).
§Errors
AsterDexError::ConfigError— if credentials are not setAsterDexError::ApiError— if the server returns a 4xx error with{code, msg}AsterDexError::RateLimited— if the server returns 429AsterDexError::NetworkError— if a network-level error occurs
Source§impl RestClient
impl RestClient
Sourcepub async fn get_server_time(
&self,
) -> Result<ApiResponse<ServerTimeResponse>, AsterDexError>
pub async fn get_server_time( &self, ) -> Result<ApiResponse<ServerTimeResponse>, AsterDexError>
Get server time in milliseconds.
Use to detect clock drift before placing orders. This is a public endpoint (no authentication required).
Sourcepub async fn ping(&self) -> Result<ApiResponse<PingResponse>, AsterDexError>
pub async fn ping(&self) -> Result<ApiResponse<PingResponse>, AsterDexError>
Ping the REST API to check connectivity.
Public endpoint — no authentication required.
Sourcepub async fn get_exchange_info(
&self,
) -> Result<ApiResponse<ExchangeInfoResponse>, AsterDexError>
pub async fn get_exchange_info( &self, ) -> Result<ApiResponse<ExchangeInfoResponse>, AsterDexError>
Get exchange information including all trading symbols.
Public endpoint — no authentication required.
Sourcepub async fn get_depth(
&self,
symbol: &str,
limit: Option<u32>,
) -> Result<ApiResponse<DepthResponse>, AsterDexError>
pub async fn get_depth( &self, symbol: &str, limit: Option<u32>, ) -> Result<ApiResponse<DepthResponse>, AsterDexError>
Get order book depth for a symbol.
Public endpoint — no authentication required.
Sourcepub async fn get_trades(
&self,
symbol: &str,
limit: Option<u32>,
) -> Result<ApiResponse<Vec<TradeRecord>>, AsterDexError>
pub async fn get_trades( &self, symbol: &str, limit: Option<u32>, ) -> Result<ApiResponse<Vec<TradeRecord>>, AsterDexError>
Get recent trades for a symbol.
Public endpoint — no authentication required.
Sourcepub async fn get_historical_trades(
&self,
symbol: &str,
limit: Option<u32>,
from_id: Option<i64>,
) -> Result<ApiResponse<Vec<TradeRecord>>, AsterDexError>
pub async fn get_historical_trades( &self, symbol: &str, limit: Option<u32>, from_id: Option<i64>, ) -> Result<ApiResponse<Vec<TradeRecord>>, AsterDexError>
Get historical (older) trades for a symbol.
Public endpoint — no authentication required.
Sourcepub async fn get_agg_trades(
&self,
symbol: &str,
from_id: Option<i64>,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> Result<ApiResponse<Vec<AggTrade>>, AsterDexError>
pub async fn get_agg_trades( &self, symbol: &str, from_id: Option<i64>, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u32>, ) -> Result<ApiResponse<Vec<AggTrade>>, AsterDexError>
Get compressed/aggregate trades for a symbol.
Public endpoint — no authentication required.
Sourcepub async fn get_klines(
&self,
symbol: &str,
interval: KlineInterval,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> Result<ApiResponse<Vec<Kline>>, AsterDexError>
pub async fn get_klines( &self, symbol: &str, interval: KlineInterval, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u32>, ) -> Result<ApiResponse<Vec<Kline>>, AsterDexError>
Get kline/candlestick data for a symbol.
Public endpoint — no authentication required.
Sourcepub async fn get_index_price_klines(
&self,
pair: &str,
interval: KlineInterval,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> Result<ApiResponse<Vec<Kline>>, AsterDexError>
pub async fn get_index_price_klines( &self, pair: &str, interval: KlineInterval, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u32>, ) -> Result<ApiResponse<Vec<Kline>>, AsterDexError>
Get kline/candlestick data for an index price.
Public endpoint — no authentication required.
Sourcepub async fn get_mark_price_klines(
&self,
symbol: &str,
interval: KlineInterval,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> Result<ApiResponse<Vec<Kline>>, AsterDexError>
pub async fn get_mark_price_klines( &self, symbol: &str, interval: KlineInterval, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u32>, ) -> Result<ApiResponse<Vec<Kline>>, AsterDexError>
Get kline/candlestick data for a mark price.
Public endpoint — no authentication required.
Sourcepub async fn get_mark_price(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<MarkPriceShape>, AsterDexError>
pub async fn get_mark_price( &self, symbol: Option<&str>, ) -> Result<ApiResponse<MarkPriceShape>, AsterDexError>
Get mark price and funding rate for a symbol (or all symbols if None).
Public endpoint — no authentication required.
Sourcepub async fn get_funding_rate(
&self,
symbol: Option<&str>,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> Result<ApiResponse<Vec<FundingRateRecord>>, AsterDexError>
pub async fn get_funding_rate( &self, symbol: Option<&str>, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u32>, ) -> Result<ApiResponse<Vec<FundingRateRecord>>, AsterDexError>
Get funding rate history for a symbol.
Public endpoint — no authentication required.
Sourcepub async fn get_funding_info(
&self,
) -> Result<ApiResponse<Vec<FundingInfoResponse>>, AsterDexError>
pub async fn get_funding_info( &self, ) -> Result<ApiResponse<Vec<FundingInfoResponse>>, AsterDexError>
Get funding rate information for all symbols.
Public endpoint — no authentication required.
Sourcepub async fn get_ticker_24hr(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<Ticker24hrShape>, AsterDexError>
pub async fn get_ticker_24hr( &self, symbol: Option<&str>, ) -> Result<ApiResponse<Ticker24hrShape>, AsterDexError>
Get 24-hour ticker price change statistics.
Public endpoint — no authentication required.
Sourcepub async fn get_ticker_price(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<TickerPriceShape>, AsterDexError>
pub async fn get_ticker_price( &self, symbol: Option<&str>, ) -> Result<ApiResponse<TickerPriceShape>, AsterDexError>
Get latest price for a symbol or all symbols.
Public endpoint — no authentication required.
Sourcepub async fn get_book_ticker(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<BookTickerShape>, AsterDexError>
pub async fn get_book_ticker( &self, symbol: Option<&str>, ) -> Result<ApiResponse<BookTickerShape>, AsterDexError>
Get best price/quantity on the order book for a symbol.
Public endpoint — no authentication required.
Sourcepub async fn get_index_references(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<Vec<IndexReferencesResponse>>, AsterDexError>
pub async fn get_index_references( &self, symbol: Option<&str>, ) -> Result<ApiResponse<Vec<IndexReferencesResponse>>, AsterDexError>
Get index price references for a symbol.
Public endpoint — no authentication required.
Source§impl RestClient
impl RestClient
Sourcepub async fn place_order(
&self,
params: PlaceOrderParams,
) -> Result<ApiResponse<OrderResponse>, AsterDexError>
pub async fn place_order( &self, params: PlaceOrderParams, ) -> Result<ApiResponse<OrderResponse>, AsterDexError>
Place a new futures order.
§Errors
ApiError { code: -1102 }— required parameter missing (e.g., price for LIMIT)ApiError { code: -1121 }— invalid symbolRateLimited— HTTP 429IpBanned— HTTP 418
Sourcepub async fn cancel_order(
&self,
params: CancelOrderParams,
) -> Result<ApiResponse<CancelOrderResponse>, AsterDexError>
pub async fn cancel_order( &self, params: CancelOrderParams, ) -> Result<ApiResponse<CancelOrderResponse>, AsterDexError>
Cancel an open order.
One of params.order_id or params.orig_client_order_id must be set.
§Errors
ApiError { code: -2011 }— order not foundApiError { code: -1102 }— neither orderId nor origClientOrderId provided
Sourcepub async fn modify_order(
&self,
params: ModifyOrderParams,
) -> Result<ApiResponse<OrderResponse>, AsterDexError>
pub async fn modify_order( &self, params: ModifyOrderParams, ) -> Result<ApiResponse<OrderResponse>, AsterDexError>
Modify an existing open LIMIT order in-place (price and/or quantity).
Calls PUT /fapi/v3/order directly. The original order_id is preserved —
this is a true amendment, not a cancel + re-place. At least one of
params.quantity or params.price must be set. Either params.order_id
or params.orig_client_order_id must be provided to identify the order.
Only LIMIT orders can be modified. If the new qty/price fails exchange filters the modification is rejected and the original order remains unchanged.
§Errors
ApiError { code: -2011 }— order not foundApiError { code: -1102 }— required parameter missing
Sourcepub async fn get_open_orders(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<Vec<OrderResponse>>, AsterDexError>
pub async fn get_open_orders( &self, symbol: Option<&str>, ) -> Result<ApiResponse<Vec<OrderResponse>>, AsterDexError>
Get all open orders. Pass None for all symbols or Some("BTCUSDT") for one symbol.
Sourcepub async fn get_position_risk(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<Vec<PositionResponse>>, AsterDexError>
pub async fn get_position_risk( &self, symbol: Option<&str>, ) -> Result<ApiResponse<Vec<PositionResponse>>, AsterDexError>
Get position risk information. Pass None for all symbols or Some("BTCUSDT") for one symbol.
Source§impl RestClient
impl RestClient
Sourcepub async fn get_balance(
&self,
) -> Result<ApiResponse<Vec<Balance>>, AsterDexError>
pub async fn get_balance( &self, ) -> Result<ApiResponse<Vec<Balance>>, AsterDexError>
Get account balance across all assets.
Requires authentication. Returns wallet, cross-wallet, and available balances for each asset held in the futures account.
§Errors
ConfigError— credentials not setApiError— exchange error (e.g. invalid timestamp)RateLimited— HTTP 429
Sourcepub async fn get_account_with_join_margin(
&self,
) -> Result<ApiResponse<AccountInfoResponse>, AsterDexError>
pub async fn get_account_with_join_margin( &self, ) -> Result<ApiResponse<AccountInfoResponse>, AsterDexError>
Get full account info with join margin details.
Requires authentication.
§Errors
ConfigError— credentials not set
Sourcepub async fn get_position_side_dual(
&self,
) -> Result<ApiResponse<PositionSideDualResponse>, AsterDexError>
pub async fn get_position_side_dual( &self, ) -> Result<ApiResponse<PositionSideDualResponse>, AsterDexError>
Get the current position side dual mode setting.
Returns dual_side_position = true when hedge mode is active, false for one-way mode.
§Errors
ConfigError— credentials not set
Sourcepub async fn set_position_side_dual(
&self,
dual_side_position: bool,
) -> Result<ApiResponse<StatusMsgResponse>, AsterDexError>
pub async fn set_position_side_dual( &self, dual_side_position: bool, ) -> Result<ApiResponse<StatusMsgResponse>, AsterDexError>
Enable or disable position side dual (hedge) mode.
Pass true to enable hedge mode, false for one-way mode.
§Errors
ConfigError— credentials not setApiError { code: -4059 }— no need to change position side
Sourcepub async fn get_leverage_bracket(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<Vec<LeverageBracket>>, AsterDexError>
pub async fn get_leverage_bracket( &self, symbol: Option<&str>, ) -> Result<ApiResponse<Vec<LeverageBracket>>, AsterDexError>
Get leverage bracket information.
Pass Some("BTCUSDT") for a specific symbol, or None for all symbols.
§Errors
ConfigError— credentials not setApiError { code: -1121 }— invalid symbol
Source§impl RestClient
impl RestClient
Sourcepub async fn place_batch_orders(
&self,
orders: Vec<PlaceOrderParams>,
) -> Result<ApiResponse<Vec<BatchOrderResult>>, AsterDexError>
pub async fn place_batch_orders( &self, orders: Vec<PlaceOrderParams>, ) -> Result<ApiResponse<Vec<BatchOrderResult>>, AsterDexError>
Place multiple orders (max 5). Returns a mixed array — check each item for order_id (success) or code/msg (error).
Sourcepub async fn cancel_batch_orders(
&self,
symbol: &str,
order_ids: Vec<i64>,
) -> Result<ApiResponse<Vec<BatchOrderResult>>, AsterDexError>
pub async fn cancel_batch_orders( &self, symbol: &str, order_ids: Vec<i64>, ) -> Result<ApiResponse<Vec<BatchOrderResult>>, AsterDexError>
Cancel multiple orders by ID list.
Sourcepub async fn cancel_all_open_orders(
&self,
symbol: &str,
) -> Result<ApiResponse<CancelAllResponse>, AsterDexError>
pub async fn cancel_all_open_orders( &self, symbol: &str, ) -> Result<ApiResponse<CancelAllResponse>, AsterDexError>
Cancel all open orders for a symbol.
Source§impl RestClient
impl RestClient
Sourcepub async fn set_leverage(
&self,
symbol: &str,
leverage: u32,
) -> Result<ApiResponse<SetLeverageResponse>, AsterDexError>
pub async fn set_leverage( &self, symbol: &str, leverage: u32, ) -> Result<ApiResponse<SetLeverageResponse>, AsterDexError>
Set leverage for a symbol.
Sourcepub async fn set_margin_type(
&self,
symbol: &str,
margin_type: &str,
) -> Result<ApiResponse<StatusMsgResponse>, AsterDexError>
pub async fn set_margin_type( &self, symbol: &str, margin_type: &str, ) -> Result<ApiResponse<StatusMsgResponse>, AsterDexError>
Set margin type (ISOLATED or CROSSED) for a symbol.
Source§impl RestClient
impl RestClient
Sourcepub async fn create_listen_key(
&self,
) -> Result<ApiResponse<ListenKeyResponse>, AsterDexError>
pub async fn create_listen_key( &self, ) -> Result<ApiResponse<ListenKeyResponse>, AsterDexError>
Create a new user data stream listen key.
The returned listen key is valid for ~60 minutes. Renew with renew_listen_key
every ~30 minutes to prevent expiry. The caller is responsible for scheduling renewal.
§Errors
ConfigError— credentials not setRateLimited— HTTP 429IpBanned— HTTP 418
Sourcepub async fn renew_listen_key(
&self,
listen_key: &str,
) -> Result<ApiResponse<EmptyResponse>, AsterDexError>
pub async fn renew_listen_key( &self, listen_key: &str, ) -> Result<ApiResponse<EmptyResponse>, AsterDexError>
Extend the validity of an existing listen key by ~60 minutes.
Call every ~30 minutes to prevent expiry. The caller is responsible for scheduling this renewal — the SDK does not auto-renew (ADR-010).
§Errors
ConfigError— credentials not setApiError { code: -1125 }— listen key not found or already expired
Sourcepub async fn delete_listen_key(
&self,
listen_key: &str,
) -> Result<ApiResponse<EmptyResponse>, AsterDexError>
pub async fn delete_listen_key( &self, listen_key: &str, ) -> Result<ApiResponse<EmptyResponse>, AsterDexError>
Delete/invalidate a listen key.
After deletion, the WebSocket user data stream using this key will be closed by the server.
§Errors
ConfigError— credentials not setApiError { code: -1125 }— listen key not found
Source§impl RestClient
impl RestClient
Sourcepub async fn get_order(
&self,
params: GetOrderParams,
) -> Result<ApiResponse<OrderResponse>, AsterDexError>
pub async fn get_order( &self, params: GetOrderParams, ) -> Result<ApiResponse<OrderResponse>, AsterDexError>
Query a specific order by ID or client order ID.
Sourcepub async fn get_open_order(
&self,
params: GetOrderParams,
) -> Result<ApiResponse<OrderResponse>, AsterDexError>
pub async fn get_open_order( &self, params: GetOrderParams, ) -> Result<ApiResponse<OrderResponse>, AsterDexError>
Query a specific open order by ID or client order ID.
Sourcepub async fn get_all_orders(
&self,
params: AllOrdersParams,
) -> Result<ApiResponse<Vec<OrderResponse>>, AsterDexError>
pub async fn get_all_orders( &self, params: AllOrdersParams, ) -> Result<ApiResponse<Vec<OrderResponse>>, AsterDexError>
Get all orders (open + historical) for a symbol.
Sourcepub async fn get_user_trades(
&self,
params: UserTradesParams,
) -> Result<ApiResponse<Vec<UserTrade>>, AsterDexError>
pub async fn get_user_trades( &self, params: UserTradesParams, ) -> Result<ApiResponse<Vec<UserTrade>>, AsterDexError>
Get user trade history for a symbol.
Sourcepub async fn get_income(
&self,
params: IncomeParams,
) -> Result<ApiResponse<Vec<IncomeRecord>>, AsterDexError>
pub async fn get_income( &self, params: IncomeParams, ) -> Result<ApiResponse<Vec<IncomeRecord>>, AsterDexError>
Get income history (funding fees, realized PnL, etc.).
Sourcepub async fn set_position_margin(
&self,
params: PositionMarginParams,
) -> Result<ApiResponse<PositionMarginResponse>, AsterDexError>
pub async fn set_position_margin( &self, params: PositionMarginParams, ) -> Result<ApiResponse<PositionMarginResponse>, AsterDexError>
Add or reduce isolated position margin (type 1 = add, type 2 = reduce).
Sourcepub async fn get_position_margin_history(
&self,
symbol: &str,
margin_type: Option<u8>,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> Result<ApiResponse<Vec<PositionMarginHistoryRecord>>, AsterDexError>
pub async fn get_position_margin_history( &self, symbol: &str, margin_type: Option<u8>, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u32>, ) -> Result<ApiResponse<Vec<PositionMarginHistoryRecord>>, AsterDexError>
Get position margin change history.
Sourcepub async fn get_adl_quantile(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<Vec<AdlQuantileResponse>>, AsterDexError>
pub async fn get_adl_quantile( &self, symbol: Option<&str>, ) -> Result<ApiResponse<Vec<AdlQuantileResponse>>, AsterDexError>
Get auto-deleverage quantile for positions.
Sourcepub async fn get_force_orders(
&self,
symbol: Option<&str>,
auto_close_type: Option<&str>,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> Result<ApiResponse<Vec<OrderResponse>>, AsterDexError>
pub async fn get_force_orders( &self, symbol: Option<&str>, auto_close_type: Option<&str>, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u32>, ) -> Result<ApiResponse<Vec<OrderResponse>>, AsterDexError>
Get forced liquidation order history.
Sourcepub async fn get_commission_rate(
&self,
symbol: &str,
) -> Result<ApiResponse<CommissionRateResponse>, AsterDexError>
pub async fn get_commission_rate( &self, symbol: &str, ) -> Result<ApiResponse<CommissionRateResponse>, AsterDexError>
Get user commission rate for a symbol.
Sourcepub async fn get_multi_assets_margin(
&self,
) -> Result<ApiResponse<MultiAssetsModeResponse>, AsterDexError>
pub async fn get_multi_assets_margin( &self, ) -> Result<ApiResponse<MultiAssetsModeResponse>, AsterDexError>
Get multi-assets margin mode status.
Sourcepub async fn set_multi_assets_margin(
&self,
enabled: bool,
) -> Result<ApiResponse<StatusMsgResponse>, AsterDexError>
pub async fn set_multi_assets_margin( &self, enabled: bool, ) -> Result<ApiResponse<StatusMsgResponse>, AsterDexError>
Change multi-assets margin mode.
Sourcepub async fn countdown_cancel_all(
&self,
params: CountdownParams,
) -> Result<ApiResponse<CountdownResponse>, AsterDexError>
pub async fn countdown_cancel_all( &self, params: CountdownParams, ) -> Result<ApiResponse<CountdownResponse>, AsterDexError>
Set countdown to auto-cancel all orders. countdown_time = 0 disables.
Sourcepub async fn noop(&self) -> Result<ApiResponse<EmptyResponse>, AsterDexError>
pub async fn noop(&self) -> Result<ApiResponse<EmptyResponse>, AsterDexError>
No-operation signed endpoint — useful for testing auth.
Source§impl RestClient
impl RestClient
Sourcepub async fn get_mmp(
&self,
symbol: Option<&str>,
) -> Result<ApiResponse<Vec<MmpResponse>>, AsterDexError>
pub async fn get_mmp( &self, symbol: Option<&str>, ) -> Result<ApiResponse<Vec<MmpResponse>>, AsterDexError>
Get MMP (Market Maker Protection) configuration.
Pass Some("BTCUSDT") to query a specific symbol, or None to query all symbols.
§Errors
ConfigError— credentials not setApiError { code: -1121 }— invalid or unknown symbolRateLimited— HTTP 429
Sourcepub async fn update_mmp(
&self,
params: MmpUpdateParams,
) -> Result<ApiResponse<bool>, AsterDexError>
pub async fn update_mmp( &self, params: MmpUpdateParams, ) -> Result<ApiResponse<bool>, AsterDexError>
Create or update MMP configuration for a symbol (POST /fapi/v3/mmp).
§Errors
ConfigError— credentials not setApiError— invalid parameters or symbolRateLimited— HTTP 429
Sourcepub async fn delete_mmp(
&self,
symbol: &str,
) -> Result<ApiResponse<bool>, AsterDexError>
pub async fn delete_mmp( &self, symbol: &str, ) -> Result<ApiResponse<bool>, AsterDexError>
Delete MMP configuration for a symbol (DELETE /fapi/v3/mmp).
§Errors
ConfigError— credentials not setApiError— no MMP configured for the symbolRateLimited— HTTP 429
Sourcepub async fn reset_mmp(
&self,
symbol: &str,
) -> Result<ApiResponse<bool>, AsterDexError>
pub async fn reset_mmp( &self, symbol: &str, ) -> Result<ApiResponse<bool>, AsterDexError>
Reset (unfreeze) a frozen MMP for a symbol (POST /fapi/v3/mmpReset).
§Errors
ConfigError— credentials not setApiError— no frozen MMP for the symbolRateLimited— HTTP 429
Source§impl RestClient
impl RestClient
Sourcepub async fn wallet_transfer(
&self,
params: WalletTransferParams,
) -> Result<ApiResponse<WalletTransferResponse>, AsterDexError>
pub async fn wallet_transfer( &self, params: WalletTransferParams, ) -> Result<ApiResponse<WalletTransferResponse>, AsterDexError>
Transfer assets between wallets.
The transfer_type field identifies the wallet pair (e.g. spot→futures, futures→spot).
Consult the API docs for valid values.
§Errors
ConfigError— credentials not setApiError— invalid asset, amount, or transfer typeRateLimited— HTTP 429IpBanned— HTTP 418
Sourcepub async fn sub_account_bind(
&self,
sub_uid: &str,
) -> Result<ApiResponse<Value>, AsterDexError>
pub async fn sub_account_bind( &self, sub_uid: &str, ) -> Result<ApiResponse<Value>, AsterDexError>
Bind a sub-account to the current account.
The response structure is not yet documented — returned as raw JSON until API docs are clarified. Refactor to a typed struct in a follow-up story.
§Errors
ConfigError— credentials not setApiError— invalid sub-account UID or binding already existsRateLimited— HTTP 429IpBanned— HTTP 418
Auto Trait Implementations§
impl !Freeze for RestClient
impl !RefUnwindSafe for RestClient
impl !UnwindSafe for RestClient
impl Send for RestClient
impl Sync for RestClient
impl Unpin for RestClient
impl UnsafeUnpin for RestClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more