pub struct BalanceResponse {
pub order_books: HashMap<String, OrderBookBalance>,
pub total_locked: u128,
pub total_unlocked: u128,
pub trading_account_balance: u128,
}Expand description
Balance response from GET /v1/balance.
The balance model tracks funds across three locations:
trading_account_balance— funds sitting directly in the trading account contract, ready to be allocated to any market.total_unlocked— the total available balance, i.e.trading_account_balanceplus unlocked amounts sitting in individual order-book contracts (e.g. proceeds from filled orders not yet settled). Use this when computing how much you can trade.total_locked— funds locked as collateral for currently open orders across all order-book contracts.
§Warning
total_unlocked already includes trading_account_balance.
Do not add them together — that double-counts your funds.
available_for_new_orders = total_unlocked // correct
locked_in_open_orders = total_locked
grand_total = total_unlocked + total_lockedFields§
§order_books: HashMap<String, OrderBookBalance>§total_locked: u128Total balance locked as collateral for open orders (chain integer).
total_unlocked: u128Total available balance for trading (chain integer).
This is trading_account_balance + unlocked amounts in each order-book
contract. Use this value — not trading_account_balance alone — when
deciding how much you can spend on new orders.
trading_account_balance: u128Balance sitting directly in the trading account contract (chain integer).
This is a subset of total_unlocked. Do not add these two fields
together.
Implementations§
Trait Implementations§
Source§impl Clone for BalanceResponse
impl Clone for BalanceResponse
Source§fn clone(&self) -> BalanceResponse
fn clone(&self) -> BalanceResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BalanceResponse
impl Debug for BalanceResponse
Source§impl<'de> Deserialize<'de> for BalanceResponse
impl<'de> Deserialize<'de> for BalanceResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BalanceResponse
impl RefUnwindSafe for BalanceResponse
impl Send for BalanceResponse
impl Sync for BalanceResponse
impl Unpin for BalanceResponse
impl UnwindSafe for BalanceResponse
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
Mutably borrows from an owned value. Read more