pub struct Client { /* private fields */ }Expand description
Client for Monaco Protocol API
REST API for the Monaco Protocol hybrid CLOB exchange.
Version: 1.0.0
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(baseurl: &str) -> Self
pub fn new(baseurl: &str) -> Self
Create a new client.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Sourcepub fn new_with_client(baseurl: &str, client: Client) -> Self
pub fn new_with_client(baseurl: &str, client: Client) -> Self
Construct a new client with an existing reqwest::Client,
allowing more control over its configuration.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Source§impl Client
impl Client
Sourcepub async fn get_user_balances<'a>(
&'a self,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
) -> Result<ResponseValue<GetBalancesResponse>, Error<()>>
pub async fn get_user_balances<'a>( &'a self, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, ) -> Result<ResponseValue<GetBalancesResponse>, Error<()>>
Get user balances
Get user balances.
Get the current user’s token balances with pagination support. Returns available, locked, and total balance for each token.
Sends a GET request to /api/v1/accounts/balances
Arguments:
page: Page number (1-indexed)page_size: Items per page (max 100)
Sourcepub async fn get_user_balance_by_asset<'a>(
&'a self,
asset_id: &'a str,
) -> Result<ResponseValue<GetBalanceByAssetResponse>, Error<()>>
pub async fn get_user_balance_by_asset<'a>( &'a self, asset_id: &'a str, ) -> Result<ResponseValue<GetBalanceByAssetResponse>, Error<()>>
Get user balance by asset
Get user balance by asset.
Get the current user’s balance for a specific asset. Returns available, locked, and total balance. If no balance exists for a valid asset, returns zero balances. If the asset ID is invalid or not found, returns 404.
Sends a GET request to /api/v1/accounts/balances/{assetId}
Sourcepub async fn list_funding_payments<'a>(
&'a self,
margin_account_id: Option<&'a str>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
position_id: Option<&'a str>,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListFundingPaymentsResponse>, Error<()>>
pub async fn list_funding_payments<'a>( &'a self, margin_account_id: Option<&'a str>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, position_id: Option<&'a str>, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListFundingPaymentsResponse>, Error<()>>
List funding payments
List funding payment history.
Get the current user’s private funding payment history with pagination and optional filters by market, margin account, and position.
Sends a GET request to /api/v1/accounts/funding-payments
Arguments:
margin_account_idpage: Page number (1-indexed)page_size: Items per page (max 100)position_idtrading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn get_user_profile<'a>(
&'a self,
) -> Result<ResponseValue<GetProfileResponse>, Error<()>>
pub async fn get_user_profile<'a>( &'a self, ) -> Result<ResponseValue<GetProfileResponse>, Error<()>>
Get user profile
Get user profile.
Get the current user’s profile with token balances, recent movements,
and recent orders. Use source to control data source: hot_storage
(fast, real-time), cold_storage (historical), or both (hybrid).
Sends a GET request to /api/v1/accounts/me
Sourcepub async fn get_portfolio_stats<'a>(
&'a self,
period: Option<&'a str>,
) -> Result<ResponseValue<GetPortfolioStatsResponse>, Error<()>>
pub async fn get_portfolio_stats<'a>( &'a self, period: Option<&'a str>, ) -> Result<ResponseValue<GetPortfolioStatsResponse>, Error<()>>
Get portfolio stats
Get portfolio stats.
Get aggregate portfolio statistics for the authenticated user, scoped by time period. Includes volume, PnL, fees, equity, and win/loss metrics.
Sends a GET request to /api/v1/accounts/me/portfolio
Sourcepub async fn get_portfolio_chart<'a>(
&'a self,
metric: Option<&'a str>,
period: Option<&'a str>,
) -> Result<ResponseValue<GetPortfolioChartResponse>, Error<()>>
pub async fn get_portfolio_chart<'a>( &'a self, metric: Option<&'a str>, period: Option<&'a str>, ) -> Result<ResponseValue<GetPortfolioChartResponse>, Error<()>>
Get portfolio chart time series
Get portfolio chart time series.
Get bucketed time series data for portfolio charts. Supports volume and PnL metrics with configurable time periods and automatic bucket sizing.
Sends a GET request to /api/v1/accounts/me/portfolio/chart
Sourcepub async fn get_user_movements<'a>(
&'a self,
asset_id: Option<&'a Uuid>,
entry_type: Option<GetUserMovementsEntryType>,
order_by: Option<GetUserMovementsOrderBy>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
transaction_type: Option<GetUserMovementsTransactionType>,
) -> Result<ResponseValue<GetMovementsResponse>, Error<()>>
pub async fn get_user_movements<'a>( &'a self, asset_id: Option<&'a Uuid>, entry_type: Option<GetUserMovementsEntryType>, order_by: Option<GetUserMovementsOrderBy>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, transaction_type: Option<GetUserMovementsTransactionType>, ) -> Result<ResponseValue<GetMovementsResponse>, Error<()>>
Get user movements
Get user movements.
Get the current user’s ledger movements (transaction history) with pagination and filtering support.
Sends a GET request to /api/v1/accounts/movements
Arguments:
asset_id: Asset identifier (UUID)entry_type: Ledger entry typeorder_by: Sort direction for createdAtpage: Page number (1-indexed)page_size: Items per page (max 100)transaction_type: Transaction type
Sourcepub async fn list_sub_accounts_with_balances<'a>(
&'a self,
) -> Result<ResponseValue<ListSubAccountsResponse>, Error<()>>
pub async fn list_sub_accounts_with_balances<'a>( &'a self, ) -> Result<ResponseValue<ListSubAccountsResponse>, Error<()>>
List sub-accounts with balances
List sub-accounts with balances.
List all sub-accounts with their token balances for a master account. Only returns sub-accounts that belong to the same application as the requesting user.
Sends a GET request to /api/v1/accounts/sub-accounts
Sourcepub async fn create_sub_account_limit<'a>(
&'a self,
body: &'a CreateLimitRequest,
) -> Result<ResponseValue<CreateLimitResponse>, Error<()>>
pub async fn create_sub_account_limit<'a>( &'a self, body: &'a CreateLimitRequest, ) -> Result<ResponseValue<CreateLimitResponse>, Error<()>>
Create sub-account limit
Create sub-account limit.
Create a new limit for a sub-account. Only master accounts can create limits for their sub-accounts.
Sends a POST request to /api/v1/accounts/sub-accounts/limits
Sourcepub async fn get_sub_account_limits<'a>(
&'a self,
sub_account_id: &'a str,
) -> Result<ResponseValue<GetLimitsResponse>, Error<()>>
pub async fn get_sub_account_limits<'a>( &'a self, sub_account_id: &'a str, ) -> Result<ResponseValue<GetLimitsResponse>, Error<()>>
Get sub-account limits
Get sub-account limits.
Get all limits for a sub-account. Users can only view limits for their own accounts or their sub-accounts.
Sends a GET request to /api/v1/accounts/sub-accounts/{subAccountId}/limits
Sourcepub async fn update_sub_account_limit<'a>(
&'a self,
sub_account_id: &'a str,
asset_id: &'a str,
body: &'a UpdateLimitRequest,
) -> Result<ResponseValue<UpdateLimitResponse>, Error<()>>
pub async fn update_sub_account_limit<'a>( &'a self, sub_account_id: &'a str, asset_id: &'a str, body: &'a UpdateLimitRequest, ) -> Result<ResponseValue<UpdateLimitResponse>, Error<()>>
Update sub-account limit
Update sub-account limit.
Update an existing limit for a sub-account. Only master accounts can update limits for their sub-accounts.
Sends a PUT request to /api/v1/accounts/sub-accounts/{subAccountId}/limits/{assetId}
Sourcepub async fn delete_sub_account_limit<'a>(
&'a self,
sub_account_id: &'a str,
asset_id: &'a str,
limit_id: Option<&'a Uuid>,
) -> Result<ResponseValue<DeleteLimitResponse>, Error<()>>
pub async fn delete_sub_account_limit<'a>( &'a self, sub_account_id: &'a str, asset_id: &'a str, limit_id: Option<&'a Uuid>, ) -> Result<ResponseValue<DeleteLimitResponse>, Error<()>>
Delete sub-account limit
Delete sub-account limit.
Delete a limit for a sub-account. Only master accounts can delete limits for their sub-accounts.
Sends a DELETE request to /api/v1/accounts/sub-accounts/{subAccountId}/limits/{assetId}
Arguments:
sub_account_idasset_idlimit_id: Limit identifier (UUID)
Sourcepub async fn get_user_trades<'a>(
&'a self,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<GetUserTradesResponse>, Error<()>>
pub async fn get_user_trades<'a>( &'a self, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<GetUserTradesResponse>, Error<()>>
Get user trade history
Get user trades.
Get the authenticated user’s trade history with pagination. Returns trades where the user was either maker or taker, with user-specific side and fee information.
Sends a GET request to /api/v1/accounts/trades
Arguments:
page: Page number (1-indexed)page_size: Items per page (max 100)trading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn list_application_balances<'a>(
&'a self,
asset_id: Option<&'a Uuid>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
user_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListAppBalancesResponse>, Error<()>>
pub async fn list_application_balances<'a>( &'a self, asset_id: Option<&'a Uuid>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, user_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListAppBalancesResponse>, Error<()>>
List application balances
List application balances.
Returns a paginated list of all user balances for this application. Requires backend authentication via secret key.
Sends a GET request to /api/v1/applications/balances
Arguments:
asset_id: Asset identifier (UUID)page: Page number (1-indexed)page_size: Items per page (max 100)user_id: User identifier (UUID)
Sourcepub async fn get_application_config<'a>(
&'a self,
) -> Result<ResponseValue<GetConfigResponse>, Error<()>>
pub async fn get_application_config<'a>( &'a self, ) -> Result<ResponseValue<GetConfigResponse>, Error<()>>
Get application configuration
Get application configuration.
Returns the configuration for the authenticated application including allowed origins, webhook URL, and vault contract address.
Sends a GET request to /api/v1/applications/config
Sourcepub async fn list_application_movements<'a>(
&'a self,
asset_id: Option<&'a Uuid>,
entry_type: Option<ListApplicationMovementsEntryType>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
transaction_type: Option<ListApplicationMovementsTransactionType>,
user_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListAppMovementsResponse>, Error<()>>
pub async fn list_application_movements<'a>( &'a self, asset_id: Option<&'a Uuid>, entry_type: Option<ListApplicationMovementsEntryType>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, transaction_type: Option<ListApplicationMovementsTransactionType>, user_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListAppMovementsResponse>, Error<()>>
List application movements
List application movements.
Returns a paginated list of all ledger movements (deposits, withdrawals, trades, etc.) for this application. Requires backend authentication via secret key.
Sends a GET request to /api/v1/applications/movements
Arguments:
asset_id: Asset identifier (UUID)entry_type: Ledger entry typepage: Page number (1-indexed)page_size: Items per page (max 100)transaction_type: Transaction typeuser_id: User identifier (UUID)
Sourcepub async fn list_application_orders<'a>(
&'a self,
order_type: Option<ListApplicationOrdersOrderType>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
side: Option<ListApplicationOrdersSide>,
status: Option<&'a ListApplicationOrdersStatus>,
trading_pair_id: Option<&'a Uuid>,
user_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListAppOrdersResponse>, Error<()>>
pub async fn list_application_orders<'a>( &'a self, order_type: Option<ListApplicationOrdersOrderType>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, side: Option<ListApplicationOrdersSide>, status: Option<&'a ListApplicationOrdersStatus>, trading_pair_id: Option<&'a Uuid>, user_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListAppOrdersResponse>, Error<()>>
List application orders
List application orders.
Returns a paginated list of all orders for this application. Requires backend authentication via secret key.
Sends a GET request to /api/v1/applications/orders
Arguments:
order_type: Order typepage: Page number (1-indexed)page_size: Items per page (max 100)side: Order sidestatus: Order status (single value or comma-separated list)trading_pair_id: Trading pair identifier (UUID)user_id: User identifier (UUID)
Sourcepub async fn get_application_stats<'a>(
&'a self,
since: Option<&'a str>,
) -> Result<ResponseValue<GetAppStatsResponse>, Error<()>>
pub async fn get_application_stats<'a>( &'a self, since: Option<&'a str>, ) -> Result<ResponseValue<GetAppStatsResponse>, Error<()>>
Get application stats
Get application stats.
Returns aggregate volume and fee stats for this application. Stats are scoped to trades where the application’s users were the taker. Requires backend authentication via secret key.
Sends a GET request to /api/v1/applications/stats
Sourcepub async fn list_application_users<'a>(
&'a self,
account_type: Option<ListApplicationUsersAccountType>,
address: &'a ListApplicationUsersAddress,
is_active: Option<bool>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
) -> Result<ResponseValue<ListAppUsersResponse>, Error<()>>
pub async fn list_application_users<'a>( &'a self, account_type: Option<ListApplicationUsersAccountType>, address: &'a ListApplicationUsersAddress, is_active: Option<bool>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, ) -> Result<ResponseValue<ListAppUsersResponse>, Error<()>>
List application users
List application users.
Returns a paginated list of all users for this application. Requires backend authentication via secret key.
Sends a GET request to /api/v1/applications/users
Arguments:
account_type: Account type filteraddress: Wallet addressis_activepage: Page number (1-indexed)page_size: Items per page (max 100)
Sourcepub async fn authenticate_backend<'a>(
&'a self,
body: &'a BackendAuthRequest,
) -> Result<ResponseValue<BackendAuthResponse>, Error<()>>
pub async fn authenticate_backend<'a>( &'a self, body: &'a BackendAuthRequest, ) -> Result<ResponseValue<BackendAuthResponse>, Error<()>>
Backend service authentication
Backend service authentication.
Authenticate a backend service using a secret key. Returns a long-lived access token for server-to-server API access.
Sends a POST request to /api/v1/auth/backend
Sourcepub async fn create_challenge<'a>(
&'a self,
body: &'a ChallengeRequest,
) -> Result<ResponseValue<ChallengeResponse>, Error<()>>
pub async fn create_challenge<'a>( &'a self, body: &'a ChallengeRequest, ) -> Result<ResponseValue<ChallengeResponse>, Error<()>>
Create authentication challenge
Create authentication challenge.
Generate a cryptographic challenge (nonce) for wallet-based authentication. The user must sign the returned message with their private key to prove ownership of the wallet.
Sends a POST request to /api/v1/auth/challenge
Sourcepub async fn refresh_session<'a>(
&'a self,
body: &'a RefreshRequest,
) -> Result<ResponseValue<RefreshResponse>, Error<()>>
pub async fn refresh_session<'a>( &'a self, body: &'a RefreshRequest, ) -> Result<ResponseValue<RefreshResponse>, Error<()>>
Refresh session expiry
Refresh session expiry.
Extends the expiration of the current session. The request must be signed by the session private key (standard X-Monaco-* headers); no body is required.
Sends a POST request to /api/v1/auth/refresh
Sourcepub async fn revoke_session<'a>(
&'a self,
body: &'a RevokeRequest,
) -> Result<ResponseValue<RevokeResponse>, Error<()>>
pub async fn revoke_session<'a>( &'a self, body: &'a RevokeRequest, ) -> Result<ResponseValue<RevokeResponse>, Error<()>>
Revoke current session
Revoke current session.
Revoke the current authenticated session. The request must be signed by the session private key (standard X-Monaco-* headers). The user will need to authenticate again to obtain a new session.
Sends a POST request to /api/v1/auth/revoke
Sourcepub async fn verify_signature<'a>(
&'a self,
body: &'a VerifyRequest,
) -> Result<ResponseValue<VerifyResponse>, Error<()>>
pub async fn verify_signature<'a>( &'a self, body: &'a VerifyRequest, ) -> Result<ResponseValue<VerifyResponse>, Error<()>>
Verify signature and authenticate
Verify signature and authenticate.
Verify the signed challenge message and create an authenticated session. Binds the caller-provided ed25519 session public key to the new session; subsequent requests are signed with the matching private key.
Sends a POST request to /api/v1/auth/verify
Sourcepub async fn list_delegated_agents<'a>(
&'a self,
) -> Result<ResponseValue<ListDelegatedAgentsResponse>, Error<()>>
pub async fn list_delegated_agents<'a>( &'a self, ) -> Result<ResponseValue<ListDelegatedAgentsResponse>, Error<()>>
List delegated agents
List the calling owner’s delegated agents.
Master accounts only. Returns every agent the calling account owns, each with its policy.
Sends a GET request to /api/v1/delegated-agents
Sourcepub async fn upsert_delegated_agent<'a>(
&'a self,
body: &'a UpsertDelegatedAgentRequest,
) -> Result<ResponseValue<DelegatedAgent>, Error<()>>
pub async fn upsert_delegated_agent<'a>( &'a self, body: &'a UpsertDelegatedAgentRequest, ) -> Result<ResponseValue<DelegatedAgent>, Error<()>>
Upsert delegated agent
Register or update a delegated agent.
Master accounts only. Creates (or updates, keyed on agent_address) a
delegation linking the calling owner to an agent wallet, together with the
policy that constrains what the agent may do on the owner’s behalf.
Sends a POST request to /api/v1/delegated-agents
Sourcepub async fn list_delegated_agent_owners<'a>(
&'a self,
) -> Result<ResponseValue<ListDelegatedAgentOwnersResponse>, Error<()>>
pub async fn list_delegated_agent_owners<'a>( &'a self, ) -> Result<ResponseValue<ListDelegatedAgentOwnersResponse>, Error<()>>
List delegating owners
List the owners that have delegated to the calling agent.
Reverse lookup keyed on the caller’s own wallet address: an agent that has
authenticated with its own session key can discover which owners it may act
on behalf of, and the owner_user_id to pass to CreateDelegatedSession.
Returns only active (non-revoked, non-expired) delegations.
Sends a GET request to /api/v1/delegated-agents/owners
Sourcepub async fn create_delegated_session<'a>(
&'a self,
body: &'a CreateDelegatedSessionRequest,
) -> Result<ResponseValue<CreateDelegatedSessionResponse>, Error<()>>
pub async fn create_delegated_session<'a>( &'a self, body: &'a CreateDelegatedSessionRequest, ) -> Result<ResponseValue<CreateDelegatedSessionResponse>, Error<()>>
Create delegated session
Exchange the agent’s session for an owner-scoped delegated session.
The agent authenticates with its own session key, then calls this with the
owner_user_id it wants to act for (discover it via
ListDelegatedAgentOwners) and a freshly generated session public key.
The new session acts as the owner but records the agent’s address for
policy enforcement. Requires an active delegation for the (owner, agent)
pair.
Sends a POST request to /api/v1/delegated-agents/sessions
Sourcepub async fn revoke_delegated_agent<'a>(
&'a self,
delegated_agent_id: &'a str,
) -> Result<ResponseValue<RevokeDelegatedAgentResponse>, Error<()>>
pub async fn revoke_delegated_agent<'a>( &'a self, delegated_agent_id: &'a str, ) -> Result<ResponseValue<RevokeDelegatedAgentResponse>, Error<()>>
Revoke delegated agent
Revoke a delegated agent.
Master accounts only. Revokes the delegation identified by
delegated_agent_id. Existing delegated sessions are not invalidated; only
future session creation is blocked.
Sends a DELETE request to /api/v1/delegated-agents/{delegatedAgentId}
Sourcepub async fn mint_tokens<'a>(
&'a self,
) -> Result<ResponseValue<MintTokensResponse>, Error<()>>
pub async fn mint_tokens<'a>( &'a self, ) -> Result<ResponseValue<MintTokensResponse>, Error<()>>
Mint all testnet tokens
Mint all testnet tokens.
Mint all available testnet tokens to the authenticated user’s address. Rate limited per 24 hours.
Sends a POST request to /api/v1/faucet/mint
Sourcepub async fn simulate_fees<'a>(
&'a self,
order_type: Option<SimulateFeesOrderType>,
price: &'a SimulateFeesPrice,
quantity: &'a SimulateFeesQuantity,
side: SimulateFeesSide,
slippage_tolerance_bps: Option<i32>,
trading_pair_id: &'a Uuid,
) -> Result<ResponseValue<SimulateFeesResponse>, Error<()>>
pub async fn simulate_fees<'a>( &'a self, order_type: Option<SimulateFeesOrderType>, price: &'a SimulateFeesPrice, quantity: &'a SimulateFeesQuantity, side: SimulateFeesSide, slippage_tolerance_bps: Option<i32>, trading_pair_id: &'a Uuid, ) -> Result<ResponseValue<SimulateFeesResponse>, Error<()>>
Simulate fees for a potential order
Simulate fees for a potential order.
Returns exact fee breakdown for a specific order before placing it, including Monaco protocol fees, application fees, total amounts, and the maximum quantity affordable at the given price.
Sends a GET request to /api/v1/fees/simulate
Arguments:
order_type: Order typeprice: Price as decimal stringquantity: Quantity as decimal stringside: Order sideslippage_tolerance_bpstrading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn get_my_fee_tier<'a>(
&'a self,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<GetMyFeeTierResponse>, Error<()>>
pub async fn get_my_fee_tier<'a>( &'a self, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<GetMyFeeTierResponse>, Error<()>>
Get my fee tier and pair schedule
Return the caller’s current fee tier, rolling 14-day volumes, and a pair’s schedule.
Sends a GET request to /api/v1/fees/tier
Arguments:
trading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn list_margin_accounts<'a>(
&'a self,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
state: Option<&'a str>,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListMarginAccountsResponse>, Error<()>>
pub async fn list_margin_accounts<'a>( &'a self, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, state: Option<&'a str>, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListMarginAccountsResponse>, Error<()>>
Sends a GET request to /api/v1/margin/accounts
Arguments:
page: Page number (1-indexed)page_size: Items per page (max 100)statetrading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn get_margin_account_summary<'a>(
&'a self,
margin_account_id: &'a str,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<GetMarginAccountSummaryResponse>, Error<()>>
pub async fn get_margin_account_summary<'a>( &'a self, margin_account_id: &'a str, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<GetMarginAccountSummaryResponse>, Error<()>>
Sends a GET request to /api/v1/margin/accounts/{marginAccountId}
Arguments:
margin_account_id: Margin account UUID for the current isolated bucket.trading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn transfer_collateral_to_margin_account<'a>(
&'a self,
margin_account_id: &'a str,
body: &'a TransferCollateralToMarginAccountRequest,
) -> Result<ResponseValue<TransferCollateralToMarginAccountResponse>, Error<()>>
pub async fn transfer_collateral_to_margin_account<'a>( &'a self, margin_account_id: &'a str, body: &'a TransferCollateralToMarginAccountRequest, ) -> Result<ResponseValue<TransferCollateralToMarginAccountResponse>, Error<()>>
Sends a POST request to /api/v1/margin/accounts/{marginAccountId}/collateral/transfer-in
Arguments:
margin_account_id: Parent margin account UUID that receives collateral.body
Sourcepub async fn transfer_collateral_from_margin_account<'a>(
&'a self,
margin_account_id: &'a str,
body: &'a TransferCollateralFromMarginAccountRequest,
) -> Result<ResponseValue<TransferCollateralFromMarginAccountResponse>, Error<()>>
pub async fn transfer_collateral_from_margin_account<'a>( &'a self, margin_account_id: &'a str, body: &'a TransferCollateralFromMarginAccountRequest, ) -> Result<ResponseValue<TransferCollateralFromMarginAccountResponse>, Error<()>>
Sends a POST request to /api/v1/margin/accounts/{marginAccountId}/collateral/transfer-out
Arguments:
margin_account_id: Parent margin account UUID that releases collateral.body
Sourcepub async fn get_margin_account_movements<'a>(
&'a self,
margin_account_id: &'a str,
movement_type: Option<&'a str>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
) -> Result<ResponseValue<GetMarginAccountMovementsResponse>, Error<()>>
pub async fn get_margin_account_movements<'a>( &'a self, margin_account_id: &'a str, movement_type: Option<&'a str>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, ) -> Result<ResponseValue<GetMarginAccountMovementsResponse>, Error<()>>
Sends a GET request to /api/v1/margin/accounts/{marginAccountId}/movements
Arguments:
margin_account_id: Margin account UUID for the current isolated bucket.movement_typepage: Page number (1-indexed)page_size: Items per page (max 100)
Sourcepub async fn simulate_order_risk<'a>(
&'a self,
margin_account_id: &'a str,
body: &'a SimulateOrderRiskRequest,
) -> Result<ResponseValue<SimulateOrderRiskResponse>, Error<()>>
pub async fn simulate_order_risk<'a>( &'a self, margin_account_id: &'a str, body: &'a SimulateOrderRiskRequest, ) -> Result<ResponseValue<SimulateOrderRiskResponse>, Error<()>>
Sends a POST request to /api/v1/margin/accounts/{marginAccountId}/simulate-order-risk
Arguments:
margin_account_id: Margin account UUID for the isolated bucket being simulated.body
Sourcepub async fn get_available_collateral<'a>(
&'a self,
asset: Option<&'a str>,
) -> Result<ResponseValue<GetAvailableCollateralResponse>, Error<()>>
pub async fn get_available_collateral<'a>( &'a self, asset: Option<&'a str>, ) -> Result<ResponseValue<GetAvailableCollateralResponse>, Error<()>>
Sends a GET request to /api/v1/margin/collateral/available
Sourcepub async fn get_parent_margin_account_summary<'a>(
&'a self,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<GetMarginAccountSummaryResponse>, Error<()>>
pub async fn get_parent_margin_account_summary<'a>( &'a self, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<GetMarginAccountSummaryResponse>, Error<()>>
Sends a GET request to /api/v1/margin/parent-margin-account
Arguments:
trading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn transfer_collateral_to_parent_margin_account<'a>(
&'a self,
body: &'a TransferCollateralToParentMarginAccountRequest,
) -> Result<ResponseValue<TransferCollateralToMarginAccountResponse>, Error<()>>
pub async fn transfer_collateral_to_parent_margin_account<'a>( &'a self, body: &'a TransferCollateralToParentMarginAccountRequest, ) -> Result<ResponseValue<TransferCollateralToMarginAccountResponse>, Error<()>>
Sends a POST request to /api/v1/margin/parent-margin-account/collateral/transfer-in
Sourcepub async fn transfer_collateral_from_parent_margin_account<'a>(
&'a self,
body: &'a TransferCollateralFromParentMarginAccountRequest,
) -> Result<ResponseValue<TransferCollateralFromMarginAccountResponse>, Error<()>>
pub async fn transfer_collateral_from_parent_margin_account<'a>( &'a self, body: &'a TransferCollateralFromParentMarginAccountRequest, ) -> Result<ResponseValue<TransferCollateralFromMarginAccountResponse>, Error<()>>
Sends a POST request to /api/v1/margin/parent-margin-account/collateral/transfer-out
Sourcepub async fn get_parent_margin_account_movements<'a>(
&'a self,
movement_type: Option<&'a str>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
) -> Result<ResponseValue<GetMarginAccountMovementsResponse>, Error<()>>
pub async fn get_parent_margin_account_movements<'a>( &'a self, movement_type: Option<&'a str>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, ) -> Result<ResponseValue<GetMarginAccountMovementsResponse>, Error<()>>
Sends a GET request to /api/v1/margin/parent-margin-account/movements
Arguments:
movement_typepage: Page number (1-indexed)page_size: Items per page (max 100)
Sourcepub async fn simulate_parent_margin_order_risk<'a>(
&'a self,
body: &'a SimulateParentMarginOrderRiskRequest,
) -> Result<ResponseValue<SimulateOrderRiskResponse>, Error<()>>
pub async fn simulate_parent_margin_order_risk<'a>( &'a self, body: &'a SimulateParentMarginOrderRiskRequest, ) -> Result<ResponseValue<SimulateOrderRiskResponse>, Error<()>>
Sends a POST request to /api/v1/margin/parent-margin-account/simulate-order-risk
Sourcepub async fn transfer_collateral_to_risk_bucket<'a>(
&'a self,
body: &'a TransferCollateralToRiskBucketRequest,
) -> Result<ResponseValue<TransferCollateralToMarginAccountResponse>, Error<()>>
pub async fn transfer_collateral_to_risk_bucket<'a>( &'a self, body: &'a TransferCollateralToRiskBucketRequest, ) -> Result<ResponseValue<TransferCollateralToMarginAccountResponse>, Error<()>>
Sends a POST request to /api/v1/margin/risk-buckets/collateral/transfer-in
Sourcepub async fn simulate_risk_bucket_order_risk<'a>(
&'a self,
body: &'a SimulateRiskBucketOrderRiskRequest,
) -> Result<ResponseValue<SimulateOrderRiskResponse>, Error<()>>
pub async fn simulate_risk_bucket_order_risk<'a>( &'a self, body: &'a SimulateRiskBucketOrderRiskRequest, ) -> Result<ResponseValue<SimulateOrderRiskResponse>, Error<()>>
Sends a POST request to /api/v1/margin/risk-buckets/simulate-order-risk
Sourcepub async fn list_trading_pairs<'a>(
&'a self,
base_token: Option<&'a str>,
category: Option<&'a str>,
is_active: Option<bool>,
market_type: Option<ListTradingPairsMarketType>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
quote_token: Option<&'a str>,
) -> Result<ResponseValue<ListTradingPairsResponse>, Error<()>>
pub async fn list_trading_pairs<'a>( &'a self, base_token: Option<&'a str>, category: Option<&'a str>, is_active: Option<bool>, market_type: Option<ListTradingPairsMarketType>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, quote_token: Option<&'a str>, ) -> Result<ResponseValue<ListTradingPairsResponse>, Error<()>>
Trading Pairs
Trading Pairs
Get paginated list of trading pairs with optional filtering by market type, base token, quote token, and active status.
Sends a GET request to /api/v1/market/pairs
Arguments:
base_tokencategoryis_activemarket_type: Filter by market typepage: Page number (1-indexed)page_size: Items per page (max 100)quote_token
Sourcepub async fn get_candles<'a>(
&'a self,
trading_pair_id: &'a str,
interval: &'a str,
end_time: Option<i64>,
limit: Option<NonZeroU32>,
start_time: Option<i64>,
) -> Result<ResponseValue<GetCandlesResponse>, Error<()>>
pub async fn get_candles<'a>( &'a self, trading_pair_id: &'a str, interval: &'a str, end_time: Option<i64>, limit: Option<NonZeroU32>, start_time: Option<i64>, ) -> Result<ResponseValue<GetCandlesResponse>, Error<()>>
Candlestick Data
Candlestick Data
Get OHLCV (Open, High, Low, Close, Volume) candlestick data for a trading pair with configurable interval and time range.
Sends a GET request to /api/v1/market/pairs/charts/candlestick/{tradingPairId}/{interval}
Arguments:
trading_pair_idintervalend_time: End time as Unix timestamp (milliseconds)limit: Max candles to return (max 1000)start_time: Start time as Unix timestamp (milliseconds)
Sourcepub async fn get_trading_pair_by_id<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<GetTradingPairResponse>, Error<()>>
pub async fn get_trading_pair_by_id<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<GetTradingPairResponse>, Error<()>>
Trading Pair By ID
Trading Pair By ID
Get a specific trading pair by its UUID.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}
Sourcepub async fn get_funding_state<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<GetFundingStateResponse>, Error<()>>
pub async fn get_funding_state<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<GetFundingStateResponse>, Error<()>>
Funding state for a perp market.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}/funding
Sourcepub async fn list_funding_history<'a>(
&'a self,
trading_pair_id: &'a str,
end_time: Option<i64>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
start_time: Option<i64>,
) -> Result<ResponseValue<ListFundingHistoryResponse>, Error<()>>
pub async fn list_funding_history<'a>( &'a self, trading_pair_id: &'a str, end_time: Option<i64>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, start_time: Option<i64>, ) -> Result<ResponseValue<ListFundingHistoryResponse>, Error<()>>
Historical funding settlements for a perp market.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}/funding/history
Arguments:
trading_pair_idend_time: End time as Unix timestamp (milliseconds)page: Page number (1-indexed)page_size: Items per page (max 100)start_time: Start time as Unix timestamp (milliseconds)
Sourcepub async fn get_index_price<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<GetIndexPriceResponse>, Error<()>>
pub async fn get_index_price<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<GetIndexPriceResponse>, Error<()>>
Current index/oracle price for a perp market.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}/index-price
Sourcepub async fn get_mark_price<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<GetMarkPriceResponse>, Error<()>>
pub async fn get_mark_price<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<GetMarkPriceResponse>, Error<()>>
Current mark price for a perp market.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}/mark-price
Sourcepub async fn get_market_metadata<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<GetMarketMetadataResponse>, Error<()>>
pub async fn get_market_metadata<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<GetMarketMetadataResponse>, Error<()>>
Market Metadata
Market Metadata
Returns current price (from latest candle), 24h statistics (high, low, volume, change), and market initialization timestamp. 24h fields will be null if less than 24 hours of data available.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}/metadata
Sourcepub async fn get_open_interest<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<GetOpenInterestResponse>, Error<()>>
pub async fn get_open_interest<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<GetOpenInterestResponse>, Error<()>>
Open Interest
Open interest for a perp market.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}/open-interest
Sourcepub async fn get_perp_market_config<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<GetPerpMarketConfigResponse>, Error<()>>
pub async fn get_perp_market_config<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<GetPerpMarketConfigResponse>, Error<()>>
Perp market risk/config parameters.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}/perp/config
Sourcepub async fn get_perp_market_summary<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<GetPerpMarketSummaryResponse>, Error<()>>
pub async fn get_perp_market_summary<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<GetPerpMarketSummaryResponse>, Error<()>>
Perp market summary combining public candles, risk marks, funding, and open interest.
Sends a GET request to /api/v1/market/pairs/{tradingPairId}/perp/summary
Sourcepub async fn get_screener<'a>(
&'a self,
category: Option<&'a str>,
is_active: Option<bool>,
market_type: Option<GetScreenerMarketType>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
) -> Result<ResponseValue<GetScreenerResponse>, Error<()>>
pub async fn get_screener<'a>( &'a self, category: Option<&'a str>, is_active: Option<bool>, market_type: Option<GetScreenerMarketType>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, ) -> Result<ResponseValue<GetScreenerResponse>, Error<()>>
Market Screener
Market Screener
Single-call aggregate of per-pair market stats across all trading pairs. Returns current price plus quote-volume and percent price change for 1h / 24h / 7d windows, and a 7-point UTC-day snapshot for sparkline rendering. Window fields are independently null when a pair lacks sufficient history. Results sorted by quoteVolume24h descending (nulls last) and paginated.
Sends a GET request to /api/v1/market/screener
Arguments:
categoryis_activemarket_type: Filter by market typepage: Page number (1-indexed)page_size: Items per page (max 100)
Sourcepub async fn get_market_stats<'a>(
&'a self,
) -> Result<ResponseValue<GetMarketStatsResponse>, Error<()>>
pub async fn get_market_stats<'a>( &'a self, ) -> Result<ResponseValue<GetMarketStatsResponse>, Error<()>>
Market Stats
Market Stats
Exchange-wide life-to-date (since-inception) cumulative totals across all trading pairs: total quote-token volume and total number of trades. No auth required.
Sends a GET request to /api/v1/market/stats
Sourcepub async fn get_orderbook_snapshot<'a>(
&'a self,
trading_pair_id: &'a str,
denomination: Option<GetOrderbookSnapshotDenomination>,
levels: Option<NonZeroU32>,
magnitude: Option<GetOrderbookSnapshotMagnitude>,
trading_mode: Option<GetOrderbookSnapshotTradingMode>,
) -> Result<ResponseValue<GetOrderbookResponse>, Error<()>>
pub async fn get_orderbook_snapshot<'a>( &'a self, trading_pair_id: &'a str, denomination: Option<GetOrderbookSnapshotDenomination>, levels: Option<NonZeroU32>, magnitude: Option<GetOrderbookSnapshotMagnitude>, trading_mode: Option<GetOrderbookSnapshotTradingMode>, ) -> Result<ResponseValue<GetOrderbookResponse>, Error<()>>
Orderbook Snapshot
Orderbook Snapshot
Get the complete orderbook snapshot for a trading pair showing all bids and asks with their price levels. This is a public endpoint that does not require authentication.
Sends a GET request to /api/v1/orderbook/{tradingPairId}
Arguments:
trading_pair_iddenomination: Price denominationlevels: Number of price levels (max 100)magnitude: Price grouping magnitudetrading_mode: Trading mode
Sourcepub async fn get_orders<'a>(
&'a self,
margin_account_id: Option<&'a str>,
order_by: Option<GetOrdersOrderBy>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
status: Option<&'a GetOrdersStatus>,
trading_mode: Option<GetOrdersTradingMode>,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListOrdersResponse>, Error<()>>
pub async fn get_orders<'a>( &'a self, margin_account_id: Option<&'a str>, order_by: Option<GetOrdersOrderBy>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, status: Option<&'a GetOrdersStatus>, trading_mode: Option<GetOrdersTradingMode>, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListOrdersResponse>, Error<()>>
Get user orders
Get user orders.
Get orders for the authenticated user with pagination and optional filtering by status and trading pair.
Sends a GET request to /api/v1/orders
Arguments:
margin_account_idorder_by: Sort direction for createdAtpage: Page number (1-indexed)page_size: Items per page (max 100)status: Order status (single value or comma-separated list)trading_mode: Trading modetrading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn create_order<'a>(
&'a self,
body: &'a CreateOrderRequest,
) -> Result<ResponseValue<CreateOrderResponse>, Error<()>>
pub async fn create_order<'a>( &'a self, body: &'a CreateOrderRequest, ) -> Result<ResponseValue<CreateOrderResponse>, Error<()>>
Create new order
Create new order.
Create a new order and process it through the matching engine. The order will be matched against existing orders in the orderbook.
Sends a POST request to /api/v1/orders
Sourcepub async fn batch_cancel_orders<'a>(
&'a self,
body: &'a BatchCancelOrdersRequest,
) -> Result<ResponseValue<BatchCancelOrdersResponse>, Error<()>>
pub async fn batch_cancel_orders<'a>( &'a self, body: &'a BatchCancelOrdersRequest, ) -> Result<ResponseValue<BatchCancelOrdersResponse>, Error<()>>
Batch cancel specific orders
Batch cancel specific orders.
Cancel multiple specific orders by their IDs. For canceling all orders, use /batch-cancel-all or /batch-cancel-all/{tradingPairId}.
Sends a POST request to /api/v1/orders/batch-cancel
Sourcepub async fn batch_cancel_all<'a>(
&'a self,
) -> Result<ResponseValue<BatchCancelAllResponse>, Error<()>>
pub async fn batch_cancel_all<'a>( &'a self, ) -> Result<ResponseValue<BatchCancelAllResponse>, Error<()>>
Cancel all orders
Cancel all orders.
Cancel all active orders for the authenticated user. To cancel orders for a specific trading pair, use /batch-cancel-all/{tradingPairId}.
Sends a POST request to /api/v1/orders/batch-cancel-all
Sourcepub async fn batch_cancel_all_by_pair<'a>(
&'a self,
trading_pair_id: &'a str,
) -> Result<ResponseValue<BatchCancelAllResponse>, Error<()>>
pub async fn batch_cancel_all_by_pair<'a>( &'a self, trading_pair_id: &'a str, ) -> Result<ResponseValue<BatchCancelAllResponse>, Error<()>>
Cancel all orders for a trading pair
Cancel all orders for a trading pair.
Cancel all active orders for the authenticated user on a specific trading pair.
Sends a POST request to /api/v1/orders/batch-cancel-all/{tradingPairId}
Sourcepub async fn batch_create_orders<'a>(
&'a self,
body: &'a BatchCreateOrdersRequest,
) -> Result<ResponseValue<BatchCreateOrdersResponse>, Error<()>>
pub async fn batch_create_orders<'a>( &'a self, body: &'a BatchCreateOrdersRequest, ) -> Result<ResponseValue<BatchCreateOrdersResponse>, Error<()>>
Batch create orders
Batch create orders.
Create multiple orders in a single batch. Each order is processed sequentially through the matching engine.
Sends a POST request to /api/v1/orders/batch-create
Sourcepub async fn batch_replace_orders<'a>(
&'a self,
body: &'a BatchReplaceOrdersRequest,
) -> Result<ResponseValue<BatchReplaceOrdersResponse>, Error<()>>
pub async fn batch_replace_orders<'a>( &'a self, body: &'a BatchReplaceOrdersRequest, ) -> Result<ResponseValue<BatchReplaceOrdersResponse>, Error<()>>
Batch replace orders
Batch replace orders.
Replace multiple orders in a single batch. Each order is processed sequentially through the matching engine.
Sends a POST request to /api/v1/orders/batch-replace
Sourcepub async fn cancel_order<'a>(
&'a self,
body: &'a CancelOrderRequest,
) -> Result<ResponseValue<CancelOrderResponse>, Error<()>>
pub async fn cancel_order<'a>( &'a self, body: &'a CancelOrderRequest, ) -> Result<ResponseValue<CancelOrderResponse>, Error<()>>
Cancel existing order
Cancel existing order.
Cancel an existing order and unlock the reserved funds. Only orders that are not yet filled can be cancelled.
Sends a POST request to /api/v1/orders/cancel
Sourcepub async fn list_conditional_orders<'a>(
&'a self,
margin_account_id: Option<&'a str>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
state: Option<&'a str>,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListConditionalOrdersResponse>, Error<()>>
pub async fn list_conditional_orders<'a>( &'a self, margin_account_id: Option<&'a str>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, state: Option<&'a str>, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListConditionalOrdersResponse>, Error<()>>
List conditional TP/SL orders for the authenticated user.
Sends a GET request to /api/v1/orders/conditional
Arguments:
margin_account_idpage: Page number (1-indexed)page_size: Items per page (max 100)statetrading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn get_conditional_order<'a>(
&'a self,
conditional_order_id: &'a str,
) -> Result<ResponseValue<ConditionalOrder>, Error<()>>
pub async fn get_conditional_order<'a>( &'a self, conditional_order_id: &'a str, ) -> Result<ResponseValue<ConditionalOrder>, Error<()>>
Get a single conditional (TP/SL) order by its UUID.
Sends a GET request to /api/v1/orders/conditional/{conditionalOrderId}
Sourcepub async fn cancel_conditional_order<'a>(
&'a self,
conditional_order_id: &'a str,
) -> Result<ResponseValue<CancelConditionalOrderResponse>, Error<()>>
pub async fn cancel_conditional_order<'a>( &'a self, conditional_order_id: &'a str, ) -> Result<ResponseValue<CancelConditionalOrderResponse>, Error<()>>
Cancel conditional TP/SL order.
Sends a DELETE request to /api/v1/orders/conditional/{conditionalOrderId}
Sourcepub async fn get_order_by_id<'a>(
&'a self,
order_id: &'a str,
) -> Result<ResponseValue<GetOrderResponse>, Error<()>>
pub async fn get_order_by_id<'a>( &'a self, order_id: &'a str, ) -> Result<ResponseValue<GetOrderResponse>, Error<()>>
Get order by ID
Get order by ID.
Get a single order by its ID. Users can only access their own orders.
Sends a GET request to /api/v1/orders/{orderId}
Sourcepub async fn replace_order<'a>(
&'a self,
order_id: &'a str,
body: &'a ReplaceOrderRequest,
) -> Result<ResponseValue<ReplaceOrderResponse>, Error<()>>
pub async fn replace_order<'a>( &'a self, order_id: &'a str, body: &'a ReplaceOrderRequest, ) -> Result<ResponseValue<ReplaceOrderResponse>, Error<()>>
Replace existing order
Replace existing order.
Replaces an existing order with new parameters by canceling the original order and creating a new one with the updated price/quantity. Priority is lost in the order book.
Sends a PUT request to /api/v1/orders/{orderId}
Sourcepub async fn list_positions<'a>(
&'a self,
margin_account_id: Option<&'a str>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
status: Option<&'a ListPositionsStatus>,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListPositionsResponse>, Error<()>>
pub async fn list_positions<'a>( &'a self, margin_account_id: Option<&'a str>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, status: Option<&'a ListPositionsStatus>, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListPositionsResponse>, Error<()>>
Sends a GET request to /api/v1/positions
Arguments:
margin_account_id: Optional isolated bucket filter.page: Page number (1-indexed)page_size: Items per page (max 100)status: Order status (single value or comma-separated list)trading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn batch_close_all_positions<'a>(
&'a self,
body: &'a BatchCloseAllRequest,
) -> Result<ResponseValue<BatchCloseAllResponse>, Error<()>>
pub async fn batch_close_all_positions<'a>( &'a self, body: &'a BatchCloseAllRequest, ) -> Result<ResponseValue<BatchCloseAllResponse>, Error<()>>
Close all open positions in a single batch (“panic close”).
Submits a MARKET reduce-only close for every open position owned by the
caller, optionally filtered to a single trading pair. Best-effort and
partial: each position closes independently and per-position failures are
reported in results rather than aborting the batch.
Sends a POST request to /api/v1/positions/batch-close-all
Sourcepub async fn list_position_history<'a>(
&'a self,
margin_account_id: Option<&'a str>,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
position_id: Option<&'a str>,
trading_pair_id: Option<&'a Uuid>,
) -> Result<ResponseValue<ListPositionHistoryResponse>, Error<()>>
pub async fn list_position_history<'a>( &'a self, margin_account_id: Option<&'a str>, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, position_id: Option<&'a str>, trading_pair_id: Option<&'a Uuid>, ) -> Result<ResponseValue<ListPositionHistoryResponse>, Error<()>>
Sends a GET request to /api/v1/positions/history
Arguments:
margin_account_idpage: Page number (1-indexed)page_size: Items per page (max 100)position_idtrading_pair_id: Trading pair identifier (UUID)
Sourcepub async fn get_position<'a>(
&'a self,
position_id: &'a str,
) -> Result<ResponseValue<GetPositionResponse>, Error<()>>
pub async fn get_position<'a>( &'a self, position_id: &'a str, ) -> Result<ResponseValue<GetPositionResponse>, Error<()>>
Sends a GET request to /api/v1/positions/{positionId}
Sourcepub async fn close_position<'a>(
&'a self,
position_id: &'a str,
body: &'a ClosePositionRequest,
) -> Result<ResponseValue<ClosePositionResponse>, Error<()>>
pub async fn close_position<'a>( &'a self, position_id: &'a str, body: &'a ClosePositionRequest, ) -> Result<ResponseValue<ClosePositionResponse>, Error<()>>
Sends a POST request to /api/v1/positions/{positionId}/close
Sourcepub async fn add_position_margin<'a>(
&'a self,
position_id: &'a str,
body: &'a AddPositionMarginRequest,
) -> Result<ResponseValue<AddPositionMarginResponse>, Error<()>>
pub async fn add_position_margin<'a>( &'a self, position_id: &'a str, body: &'a AddPositionMarginRequest, ) -> Result<ResponseValue<AddPositionMarginResponse>, Error<()>>
Sends a POST request to /api/v1/positions/{positionId}/margin/add
Arguments:
position_id: Position UUID for the isolated bucket being adjusted.body
Sourcepub async fn reduce_position_margin<'a>(
&'a self,
position_id: &'a str,
body: &'a ReducePositionMarginRequest,
) -> Result<ResponseValue<ReducePositionMarginResponse>, Error<()>>
pub async fn reduce_position_margin<'a>( &'a self, position_id: &'a str, body: &'a ReducePositionMarginRequest, ) -> Result<ResponseValue<ReducePositionMarginResponse>, Error<()>>
Sends a POST request to /api/v1/positions/{positionId}/margin/reduce
Arguments:
position_id: Position UUID for the isolated bucket being adjusted.body
Sourcepub async fn get_position_risk<'a>(
&'a self,
position_id: &'a str,
) -> Result<ResponseValue<GetPositionRiskResponse>, Error<()>>
pub async fn get_position_risk<'a>( &'a self, position_id: &'a str, ) -> Result<ResponseValue<GetPositionRiskResponse>, Error<()>>
Sends a GET request to /api/v1/positions/{positionId}/risk
Sourcepub async fn attach_position_tp_sl<'a>(
&'a self,
position_id: &'a str,
body: &'a AttachPositionTpSlRequest,
) -> Result<ResponseValue<AttachPositionTpSlResponse>, Error<()>>
pub async fn attach_position_tp_sl<'a>( &'a self, position_id: &'a str, body: &'a AttachPositionTpSlRequest, ) -> Result<ResponseValue<AttachPositionTpSlResponse>, Error<()>>
Sends a POST request to /api/v1/positions/{positionId}/tp-sl
Sourcepub async fn get_trade_by_id<'a>(
&'a self,
trade_id: &'a str,
) -> Result<ResponseValue<GetTradeByIdResponse>, Error<()>>
pub async fn get_trade_by_id<'a>( &'a self, trade_id: &'a str, ) -> Result<ResponseValue<GetTradeByIdResponse>, Error<()>>
Get Trade by ID
Get Trade by ID
Retrieve a single trade by its unique identifier.
Sends a GET request to /api/v1/trades/by-id/{tradeId}
Sourcepub async fn get_trades<'a>(
&'a self,
trading_pair_id: &'a str,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
) -> Result<ResponseValue<GetTradesResponse>, Error<()>>
pub async fn get_trades<'a>( &'a self, trading_pair_id: &'a str, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, ) -> Result<ResponseValue<GetTradesResponse>, Error<()>>
Recent Trades
Recent Trades
Get recent trades for a trading pair sorted by execution time.
Sends a GET request to /api/v1/trades/{tradingPairId}
Arguments:
trading_pair_idpage: Page number (1-indexed)page_size: Max trades to return (max 100)
Sourcepub async fn submit_whitelist<'a>(
&'a self,
body: &'a SubmitWhitelistRequest,
) -> Result<ResponseValue<SubmitWhitelistResponse>, Error<()>>
pub async fn submit_whitelist<'a>( &'a self, body: &'a SubmitWhitelistRequest, ) -> Result<ResponseValue<SubmitWhitelistResponse>, Error<()>>
Submit whitelist application
Submit whitelist application.
Submit a whitelist application to join Monaco Protocol. The user will be created with is_active = false and will need to be approved by an admin.
Sends a POST request to /api/v1/whitelist
Sourcepub async fn list_pending_withdrawals<'a>(
&'a self,
page: Option<NonZeroU32>,
page_size: Option<NonZeroU32>,
) -> Result<ResponseValue<ListPendingWithdrawalsResponse>, Error<()>>
pub async fn list_pending_withdrawals<'a>( &'a self, page: Option<NonZeroU32>, page_size: Option<NonZeroU32>, ) -> Result<ResponseValue<ListPendingWithdrawalsResponse>, Error<()>>
List pending withdrawals
List the caller’s pending withdrawals.
Authenticated. Returns the caller’s withdrawals that are still awaiting
on-chain root confirmation (status pending) — i.e. those for which the
merkle proof, and therefore the executable calldata from GetWithdrawal, is
not available yet. Scoped to the authenticated account: only withdrawals
owned by the caller’s user + application are returned. Newest first, paged.
Sends a GET request to /api/v1/withdrawals
Arguments:
page: Page number (1-indexed)page_size: Items per page (max 100)
Sourcepub async fn initiate_withdrawal<'a>(
&'a self,
body: &'a InitiateWithdrawalRequest,
) -> Result<ResponseValue<Withdrawal>, Error<()>>
pub async fn initiate_withdrawal<'a>( &'a self, body: &'a InitiateWithdrawalRequest, ) -> Result<ResponseValue<Withdrawal>, Error<()>>
Initiate withdrawal
Initiate a withdrawal.
Master accounts with the withdraw permission only. Routes through the
matching engine to debit the balance and allocate a withdrawal_index,
then returns it plus the target vault address. The calldata field is
empty: executeWithdrawal requires the merkle proof, which only exists
after the withdrawal’s root is confirmed on-chain. Poll GetWithdrawal to
obtain the calldata once it is ready.
Sends a POST request to /api/v1/withdrawals
Sourcepub async fn get_withdrawal<'a>(
&'a self,
withdrawal_index: &'a str,
) -> Result<ResponseValue<Withdrawal>, Error<()>>
pub async fn get_withdrawal<'a>( &'a self, withdrawal_index: &'a str, ) -> Result<ResponseValue<Withdrawal>, Error<()>>
Get withdrawal
Fetch a withdrawal’s executable calldata by index.
Public lookup — no auth. Returns the vault address and ABI-encoded
executeWithdrawal(...) calldata for a previously-initiated
withdrawal_index. The calldata is bound to the fixed
(index, metadata, owner, destination, token, amount) tuple persisted for
the withdrawal, so re-fetching it cannot redirect funds. Returns 409 while
the withdrawal’s root has not been confirmed on-chain yet (proof not
available) — clients poll this endpoint until it succeeds.
Sends a GET request to /api/v1/withdrawals/{withdrawalIndex}
Sourcepub async fn health_check<'a>(
&'a self,
) -> Result<ResponseValue<PublicHealthCheckResponse>, Error<()>>
pub async fn health_check<'a>( &'a self, ) -> Result<ResponseValue<PublicHealthCheckResponse>, Error<()>>
Health check
Health check.
Returns the current health status of the API gateway and its connected services. Can be used for monitoring and load balancer health checks.
Sends a GET request to /health