[][src]Enum nash_protocol::types::exchange::Rate

pub enum Rate {
    OrderRate(OrderRate),
    MaxOrderRate,
    MinOrderRate,
    FeeRate(OrderRate),
    MaxFeeRate,
    MinFeeRate,
}

The Rate enum describes behavior common to rates/prices.

Variants

OrderRate(OrderRate)
MaxOrderRate
MinOrderRate
FeeRate(OrderRate)
MaxFeeRate
MinFeeRate

Implementations

impl Rate[src]

pub fn to_be_bytes(&self) -> Result<[u8; 8]>[src]

Convert any Rate into bytes for encoding in a Ethereum payload

pub fn from_be_bytes(bytes: [u8; 8]) -> Result<Self>[src]

Create Rate from big endian bytes in Ethereum FillOrder payload

impl Rate[src]

pub fn to_le_bytes(&self) -> Result<[u8; 8]>[src]

Convert any Rate into bytes for encoding in a NEO payload

impl Rate[src]

pub fn to_bigdecimal(&self) -> Result<BigDecimal>[src]

Return new bigdecimal inner value based on Rate

pub fn invert_rate(&self, precision: Option<u32>) -> Result<Self>[src]

pub fn subtract_fee(&self, fee: BigDecimal) -> Result<OrderRate>[src]

Subtract fee from user by adjusting the order rate downwards

Trait Implementations

impl Clone for Rate[src]

impl Debug for Rate[src]

impl From<OrderRate> for Rate[src]

Enum wrappers are kind of annoying. This allows us to use .into() on a value to generate a wrapped value. For example: OrderRate::new("1").unwrap().into() => Rate::OrderRate(...)

impl PartialEq<Rate> for Rate[src]

impl StructuralPartialEq for Rate[src]

Auto Trait Implementations

impl RefUnwindSafe for Rate

impl Send for Rate

impl Sync for Rate

impl Unpin for Rate

impl UnwindSafe for Rate

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> Conv for T

impl<T> FmtForward for T

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

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

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

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.