pub struct Account<M, UserOrderId>{ /* private fields */ }
Expand description
The users account
Generic over:
M
: The Currency
representing the margin currency.
UserOrderId
: The type for the user defined order id.
Implementations§
source§impl<M, UserOrderId> Account<M, UserOrderId>
impl<M, UserOrderId> Account<M, UserOrderId>
sourcepub fn active_limit_orders(
&self
) -> &HashMap<OrderId, LimitOrder<M::PairedCurrency, UserOrderId, Pending<M::PairedCurrency>>>
pub fn active_limit_orders( &self ) -> &HashMap<OrderId, LimitOrder<M::PairedCurrency, UserOrderId, Pending<M::PairedCurrency>>>
Maps the order id
to the actual Order
.
source§impl<M, UserOrderId> Account<M, UserOrderId>
impl<M, UserOrderId> Account<M, UserOrderId>
sourcepub fn wallet_balance(&self) -> M
pub fn wallet_balance(&self) -> M
The wallet balance of the user denoted in the margin currency.
sourcepub fn order_margin(&self) -> M
pub fn order_margin(&self) -> M
The current order margin used by the user Account
.
source§impl<M, UserOrderId> Account<M, UserOrderId>
impl<M, UserOrderId> Account<M, UserOrderId>
sourcepub fn available_balance(&self) -> M
pub fn available_balance(&self) -> M
Return the available balance of the Account
sourcepub fn update_desired_leverage(&mut self, _leverage: Leverage) -> Result<()>
pub fn update_desired_leverage(&mut self, _leverage: Leverage) -> Result<()>
Allows the user to update their desired leverage. This will deposit or release variation margin from the position if any.
§Returns:
If Err, the account is unable to provide enough variation margin for the desired leverage.
Trait Implementations§
Auto Trait Implementations§
impl<M, UserOrderId> Freeze for Account<M, UserOrderId>
impl<M, UserOrderId> RefUnwindSafe for Account<M, UserOrderId>
impl<M, UserOrderId> Send for Account<M, UserOrderId>where
UserOrderId: Send,
impl<M, UserOrderId> Sync for Account<M, UserOrderId>
impl<M, UserOrderId> Unpin for Account<M, UserOrderId>
impl<M, UserOrderId> UnwindSafe for Account<M, UserOrderId>
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