[][src]Struct trade::tick::Tick

pub struct Tick(_);

An object carrying the number of ticks per unit of something and representative of its tick size.

Example: BTC is quoted on exchanges up to a precision of 1e-8, i.e. the tick size is 1e-8, so the number of ticks per unit would be 1e8.

Used for both prices and sizes.

Methods

impl Tick
[src]

Return a new Tick with given ticks_per_unit.

Panics

Panic if ticks_per_unit is 0.

Return the number of ticks per unit carried by self.

Convert an unticked value, e.g. "0.001" into a value expressed in ticks, e.g. if self.ticks_per_unit == 1000 then this would return Ok(1).

Note

Will truncate extra decimals if self.ticks_per_unit() is too low.

Errors

Return Err if the value is in an incorrect format or if the number of ticks per unit is badly chosen.

Panics

Panic in case of overflow. Should correctly handle numbers up to (at least) 100,000,000,000.00000001 when using a 10^-8 precision, which seems ok.

Convert a value expressed in ticks back to an unticked value.

Errors

Return Err if the number of ticks per unit does not divide some power of 10.

Panics

Panic in case of overflow.

Trait Implementations

impl PartialEq<Tick> for Tick
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Clone for Tick
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Tick
[src]

impl Eq for Tick
[src]

impl Debug for Tick
[src]

Formats the value using the given formatter. Read more

impl Display for Tick
[src]

Formats the value using the given formatter. Read more

impl Hash for Tick
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Serialize for Tick
[src]

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for Tick
[src]

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations

impl Send for Tick

impl Sync for Tick

Blanket Implementations

impl<T> IntoTimestamped for T
[src]

Add the current timestamp to self.

Add the given timestamp to self.

impl<T> IntoWithSymbol for T
[src]

Add the given symbol to a borrowed &self.

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

Performs the conversion.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

Converts the given value to a String. Read more

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

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> From for T
[src]

Performs the conversion.

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

Immutably borrows from an owned value. Read more

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

Mutably borrows from an owned value. Read more

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<Q, K> Equivalent for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

Compare self to key and return true if they are equal.

impl<T> Erased for T

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T