pub struct Position<M>where
M: Currency + MarginCurrency,{ /* private fields */ }
Expand description
Describes the position information of the account. It assumes isolated margining mechanism, because the margin is directly associated with the position.
Implementations§
source§impl<M> Position<M>where
M: Currency + MarginCurrency,
impl<M> Position<M>where
M: Currency + MarginCurrency,
sourcepub fn size(&self) -> M::PairedCurrency
pub fn size(&self) -> M::PairedCurrency
The number of futures contracts making up the position.
Denoted in the currency in which the size is valued.
e.g.: XBTUSD has a contract size of 1 USD, so M::PairedCurrency
is USD.
sourcepub fn entry_price(&self) -> QuoteCurrency
pub fn entry_price(&self) -> QuoteCurrency
The entry price of the position
sourcepub fn position_margin(&self) -> M
pub fn position_margin(&self) -> M
The position margin of account, same denotation as wallet_balance
source§impl<M> Position<M>where
M: Currency + MarginCurrency,
impl<M> Position<M>where
M: Currency + MarginCurrency,
sourcepub fn implied_leverage(&self, price: QuoteCurrency) -> Decimal
pub fn implied_leverage(&self, price: QuoteCurrency) -> Decimal
Returns the implied leverage of the position based on the position value and the collateral backing it. It is computed by dividing the total value of the position by the amount of margin required to hold that position.
sourcepub fn unrealized_pnl(&self, bid: QuoteCurrency, ask: QuoteCurrency) -> M
pub fn unrealized_pnl(&self, bid: QuoteCurrency, ask: QuoteCurrency) -> M
Return the positions unrealized profit and loss denoted in QUOTE when using linear futures, denoted in BASE when using inverse futures