Skip to main content

SymbolMeta

Struct SymbolMeta 

Source
#[repr(C)]
pub struct SymbolMeta { pub tick_size_1e9: u64, pub lot_size_1e8: u64, pub min_qty_1e8: u64, pub min_notional_1e9: u64, pub price_precision: u8, pub qty_precision: u8, pub _pad: [u8; 6], }
Expand description

Symbol trading specifications from the exchange. Injected by runtime — prevents rejects from wrong lot size / tick size. Fields set to 0 mean “unknown” — helpers return input unchanged.

Fields§

§tick_size_1e9: u64

Minimum price increment (1e9 scaled, e.g. 10_000_000 = $0.01). 0 = unknown.

§lot_size_1e8: u64

Minimum qty increment (1e8 scaled, e.g. 1_000_000 = 0.01 units). 0 = unknown.

§min_qty_1e8: u64

Minimum order quantity (1e8 scaled). 0 = unknown.

§min_notional_1e9: u64

Minimum order notional value (1e9 scaled, e.g. 10_000_000_000 = $10). 0 = no minimum.

§price_precision: u8

Price decimal precision (e.g. 2 = $100.00).

§qty_precision: u8

Quantity decimal precision (e.g. 8 = 0.00000001).

§_pad: [u8; 6]

Implementations§

Source§

impl SymbolMeta

Source

pub const EMPTY: Self

Source

pub fn round_px(&self, px_1e9: u64) -> u64

Round price DOWN to nearest tick. Returns raw if tick_size == 0 (unknown).

Source

pub fn round_qty(&self, qty_1e8: i64) -> i64

Round qty DOWN to nearest lot. Returns raw if lot_size == 0 (unknown).

Source

pub fn check_notional(&self, qty_1e8: i64, px_1e9: u64) -> bool

Check min notional. Returns true if unknown (0) — skip check, don’t false-reject.

Source

pub fn check_min_qty(&self, qty_1e8: i64) -> bool

Check min quantity. Returns true if unknown (0).

Trait Implementations§

Source§

impl Clone for SymbolMeta

Source§

fn clone(&self) -> SymbolMeta

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SymbolMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SymbolMeta

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for SymbolMeta

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.