Struct lfest::prelude::QuoteCurrency
source · pub struct QuoteCurrency(_);
Expand description
The markets QUOTE currency, e.g.: BTCUSD -> USD is the quote currency
Trait Implementations§
source§impl<'a> Add<&'a QuoteCurrency> for QuoteCurrency
impl<'a> Add<&'a QuoteCurrency> for QuoteCurrency
source§impl Add<Decimal> for QuoteCurrency
impl Add<Decimal> for QuoteCurrency
source§impl Add<QuoteCurrency> for QuoteCurrency
impl Add<QuoteCurrency> for QuoteCurrency
§type Output = QuoteCurrency
type Output = QuoteCurrency
The resulting type after applying the
+
operator.source§fn add(self, rhs: QuoteCurrency) -> QuoteCurrency
fn add(self, rhs: QuoteCurrency) -> QuoteCurrency
Performs the
+
operation. Read moresource§impl<'a> AddAssign<&'a QuoteCurrency> for QuoteCurrency
impl<'a> AddAssign<&'a QuoteCurrency> for QuoteCurrency
source§fn add_assign(&mut self, rhs: &'a Self)
fn add_assign(&mut self, rhs: &'a Self)
Performs the
+=
operation. Read moresource§impl AddAssign<QuoteCurrency> for QuoteCurrency
impl AddAssign<QuoteCurrency> for QuoteCurrency
source§fn add_assign(&mut self, rhs: QuoteCurrency)
fn add_assign(&mut self, rhs: QuoteCurrency)
Performs the
+=
operation. Read moresource§impl Clone for QuoteCurrency
impl Clone for QuoteCurrency
source§fn clone(&self) -> QuoteCurrency
fn clone(&self) -> QuoteCurrency
Returns a copy 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 Currency for QuoteCurrency
impl Currency for QuoteCurrency
§type PairedCurrency = BaseCurrency
type PairedCurrency = BaseCurrency
The paired currency.
e.g.: for the BTCUSD market the BTC currency is paired with USD, so the
PairedCurrency
would be USDsource§fn abs(self) -> Self
fn abs(self) -> Self
TODO: it may be smart to remove this here and use another type that can
be negative Get the absolute value
source§fn fee_portion(&self, fee: Fee) -> Self
fn fee_portion(&self, fee: Fee) -> Self
Compute the fee denoted in the currency
source§fn convert(&self, rate: QuoteCurrency) -> Self::PairedCurrency
fn convert(&self, rate: QuoteCurrency) -> Self::PairedCurrency
Convert this
Currency
’s value into its pair at the conversion rate
.
E.g:
1 BTC @ 20_000 USD means that 1 USD = 1 / 20_000 BTCsource§fn into_negative(self) -> Self
fn into_negative(self) -> Self
Convert the Currency to a negative value
source§impl Debug for QuoteCurrency
impl Debug for QuoteCurrency
source§impl Default for QuoteCurrency
impl Default for QuoteCurrency
source§fn default() -> QuoteCurrency
fn default() -> QuoteCurrency
Returns the “default value” for a type. Read more
source§impl Display for QuoteCurrency
impl Display for QuoteCurrency
source§impl<'a> Div<&'a QuoteCurrency> for QuoteCurrency
impl<'a> Div<&'a QuoteCurrency> for QuoteCurrency
source§impl Div<Decimal> for QuoteCurrency
impl Div<Decimal> for QuoteCurrency
source§impl Div<QuoteCurrency> for QuoteCurrency
impl Div<QuoteCurrency> for QuoteCurrency
§type Output = QuoteCurrency
type Output = QuoteCurrency
The resulting type after applying the
/
operator.source§fn div(self, rhs: QuoteCurrency) -> QuoteCurrency
fn div(self, rhs: QuoteCurrency) -> QuoteCurrency
Performs the
/
operation. Read moresource§impl From<Decimal> for QuoteCurrency
impl From<Decimal> for QuoteCurrency
source§fn from(original: Decimal) -> QuoteCurrency
fn from(original: Decimal) -> QuoteCurrency
Converts to this type from the input type.
source§impl From<QuoteCurrency> for Decimal
impl From<QuoteCurrency> for Decimal
source§fn from(original: QuoteCurrency) -> Self
fn from(original: QuoteCurrency) -> Self
Converts to this type from the input type.
source§impl MarginCurrency for QuoteCurrency
impl MarginCurrency for QuoteCurrency
source§fn pnl<S>(
entry_price: QuoteCurrency,
exit_price: QuoteCurrency,
quantity: S
) -> S::PairedCurrencywhere
S: Currency,
fn pnl<S>( entry_price: QuoteCurrency, exit_price: QuoteCurrency, quantity: S ) -> S::PairedCurrencywhere S: Currency,
This represents a linear futures contract pnl calculation
source§impl<'a> Mul<&'a QuoteCurrency> for QuoteCurrency
impl<'a> Mul<&'a QuoteCurrency> for QuoteCurrency
source§impl Mul<Decimal> for QuoteCurrency
impl Mul<Decimal> for QuoteCurrency
source§impl Mul<QuoteCurrency> for QuoteCurrency
impl Mul<QuoteCurrency> for QuoteCurrency
§type Output = QuoteCurrency
type Output = QuoteCurrency
The resulting type after applying the
*
operator.source§fn mul(self, rhs: QuoteCurrency) -> QuoteCurrency
fn mul(self, rhs: QuoteCurrency) -> QuoteCurrency
Performs the
*
operation. Read moresource§impl PartialEq<QuoteCurrency> for QuoteCurrency
impl PartialEq<QuoteCurrency> for QuoteCurrency
source§fn eq(&self, other: &QuoteCurrency) -> bool
fn eq(&self, other: &QuoteCurrency) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<QuoteCurrency> for QuoteCurrency
impl PartialOrd<QuoteCurrency> for QuoteCurrency
source§fn partial_cmp(&self, other: &QuoteCurrency) -> Option<Ordering>
fn partial_cmp(&self, other: &QuoteCurrency) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Rem<QuoteCurrency> for QuoteCurrency
impl Rem<QuoteCurrency> for QuoteCurrency
source§impl<'a> Sub<&'a QuoteCurrency> for QuoteCurrency
impl<'a> Sub<&'a QuoteCurrency> for QuoteCurrency
source§impl Sub<Decimal> for QuoteCurrency
impl Sub<Decimal> for QuoteCurrency
source§impl Sub<QuoteCurrency> for QuoteCurrency
impl Sub<QuoteCurrency> for QuoteCurrency
§type Output = QuoteCurrency
type Output = QuoteCurrency
The resulting type after applying the
-
operator.source§fn sub(self, rhs: QuoteCurrency) -> QuoteCurrency
fn sub(self, rhs: QuoteCurrency) -> QuoteCurrency
Performs the
-
operation. Read moresource§impl<'a> SubAssign<&'a QuoteCurrency> for QuoteCurrency
impl<'a> SubAssign<&'a QuoteCurrency> for QuoteCurrency
source§fn sub_assign(&mut self, rhs: &'a Self)
fn sub_assign(&mut self, rhs: &'a Self)
Performs the
-=
operation. Read moresource§impl SubAssign<QuoteCurrency> for QuoteCurrency
impl SubAssign<QuoteCurrency> for QuoteCurrency
source§fn sub_assign(&mut self, rhs: QuoteCurrency)
fn sub_assign(&mut self, rhs: QuoteCurrency)
Performs the
-=
operation. Read more