Struct lfest::Margin[][src]

pub struct Margin {
    pub wallet_balance: f64,
    pub margin_balance: f64,
    pub position_margin: f64,
    pub order_margin: f64,
    pub available_balance: f64,
}

Describes the margin information of the account

Fields

wallet_balance: f64

The wallet balance of account denoted in BASE currency

margin_balance: f64

The margin balance of account denoted in BASE currency

position_margin: f64

The position margin of account denoted in BASE currency

order_margin: f64

The order margin of account denoted in BASE currency

available_balance: f64

The available balance of account denoted in BASE currency

Implementations

impl Margin[src]

pub fn new(init_balance: f64) -> Self[src]

Create a new margin account with an initial balance denoted in BASE currency

pub fn reserve_order_margin(&mut self, order_margin: f64) -> bool[src]

Reserve some margin for open orders, order_margin denoted in BASE currency Returns true if successful

pub fn free_order_margin(&mut self, order_margin: f64) -> bool[src]

Free some reserved order margin for some order value, denoted in BASE currency Returns true if successful

pub fn add_margin_to_position(&mut self, trade_margin: f64) -> bool[src]

Assign some margin for a trade with given margin value, denoted in BASE currency Return true if successful

pub fn reduce_position_margin(&mut self, trade_margin: f64) -> bool[src]

Reduce the position margin by a given trade margin Return true if successful

pub fn change_balance(&mut self, delta: f64) -> bool[src]

Change the balance by a given delta e.g. from realizing profit or loss Return true if successful

pub fn wallet_balance(&self) -> f64[src]

Return the wallet balance of account

pub fn margin_balance(&self) -> f64[src]

Return the margin balance of account

pub fn position_margin(&self) -> f64[src]

Return the position margin of account

pub fn order_margin(&self) -> f64[src]

Return the used order margin of account

pub fn available_balance(&self) -> f64[src]

Return the available balance of account

Trait Implementations

impl Clone for Margin[src]

impl Copy for Margin[src]

impl Debug for Margin[src]

Auto Trait Implementations

impl RefUnwindSafe for Margin

impl Send for Margin

impl Sync for Margin

impl Unpin for Margin

impl UnwindSafe for Margin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.