pub struct MarketMetadata {
pub base_mint: Pubkey,
pub quote_mint: Pubkey,
pub base_decimals: u32,
pub quote_decimals: u32,
pub base_atoms_per_raw_base_unit: u64,
pub quote_atoms_per_quote_unit: u64,
pub quote_atoms_per_quote_lot: u64,
pub base_atoms_per_base_lot: u64,
pub tick_size_in_quote_atoms_per_base_unit: u64,
pub num_base_lots_per_base_unit: u64,
pub raw_base_units_per_base_unit: u32,
pub market_size_params: MarketSizeParams,
}
Fields§
§base_mint: Pubkey
§quote_mint: Pubkey
§base_decimals: u32
§quote_decimals: u32
§base_atoms_per_raw_base_unit: u64
10^base_decimals
quote_atoms_per_quote_unit: u64
10^quote_decimals
quote_atoms_per_quote_lot: u64
§base_atoms_per_base_lot: u64
§tick_size_in_quote_atoms_per_base_unit: u64
§num_base_lots_per_base_unit: u64
§raw_base_units_per_base_unit: u32
The adjustment factor to convert from the raw base unit (i.e. 1 BONK token) to the Phoenix BaseUnit (which may be a multiple of whole tokens). The adjustment factor is almost always 1, unless one base token is worth less than one quote atom (i.e. 1e-6 USDC)
market_size_params: MarketSizeParams
Implementations§
Source§impl MarketMetadata
impl MarketMetadata
pub fn from_header(header: &MarketHeader) -> Result<MarketMetadata, Error>
Source§impl MarketMetadata
impl MarketMetadata
Sourcepub fn raw_base_units_to_base_lots_rounded_down(
&self,
raw_base_units: f64,
) -> u64
pub fn raw_base_units_to_base_lots_rounded_down( &self, raw_base_units: f64, ) -> u64
Given a number of raw base units, returns the equivalent number of base lots (rounded down).
Sourcepub fn raw_base_units_to_base_lots_rounded_up(&self, raw_base_units: f64) -> u64
pub fn raw_base_units_to_base_lots_rounded_up(&self, raw_base_units: f64) -> u64
Given a number of raw base units, returns the equivalent number of base lots (rounded up).
Sourcepub fn base_atoms_to_base_lots_rounded_down(&self, base_atoms: u64) -> u64
pub fn base_atoms_to_base_lots_rounded_down(&self, base_atoms: u64) -> u64
Given a number of base atoms, returns the equivalent number of base lots (rounded down).
Sourcepub fn base_atoms_to_base_lots_rounded_up(&self, base_atoms: u64) -> u64
pub fn base_atoms_to_base_lots_rounded_up(&self, base_atoms: u64) -> u64
Given a number of base atoms, returns the equivalent number of base lots (rounded up).
Sourcepub fn base_lots_to_base_atoms(&self, base_lots: u64) -> u64
pub fn base_lots_to_base_atoms(&self, base_lots: u64) -> u64
Given a number of base lots, returns the equivalent number of base atoms.
Sourcepub fn quote_units_to_quote_lots(&self, quote_units: f64) -> u64
pub fn quote_units_to_quote_lots(&self, quote_units: f64) -> u64
Given a number of quote units, returns the equivalent number of quote lots.
Sourcepub fn quote_atoms_to_quote_lots_rounded_down(&self, quote_atoms: u64) -> u64
pub fn quote_atoms_to_quote_lots_rounded_down(&self, quote_atoms: u64) -> u64
Given a number of quote atoms, returns the equivalent number of quote lots (rounded down).
Sourcepub fn quote_atoms_to_quote_lots_rounded_up(&self, quote_atoms: u64) -> u64
pub fn quote_atoms_to_quote_lots_rounded_up(&self, quote_atoms: u64) -> u64
Given a number of quote atoms, returns the equivalent number of quote lots (rounded up).
Sourcepub fn quote_lots_to_quote_atoms(&self, quote_lots: u64) -> u64
pub fn quote_lots_to_quote_atoms(&self, quote_lots: u64) -> u64
Given a number of quote lots, returns the equivalent number of quote atoms.
Sourcepub fn base_atoms_to_raw_base_units_as_float(&self, base_atoms: u64) -> f64
pub fn base_atoms_to_raw_base_units_as_float(&self, base_atoms: u64) -> f64
Given a number of base atoms, returns the equivalent number of raw base units.
Sourcepub fn quote_atoms_to_quote_units_as_float(&self, quote_atoms: u64) -> f64
pub fn quote_atoms_to_quote_units_as_float(&self, quote_atoms: u64) -> f64
Given a number of quote atoms, returns the equivalent number of quote units.
Sourcepub fn base_lots_and_price_to_quote_atoms(
&self,
base_lots: u64,
price_in_ticks: u64,
) -> u64
pub fn base_lots_and_price_to_quote_atoms( &self, base_lots: u64, price_in_ticks: u64, ) -> u64
Given a number of base lots and price in ticks, returns the equivalent number of quote atoms for that price and number of base lots.
Sourcepub fn float_price_to_ticks_rounded_down(&self, price: f64) -> u64
pub fn float_price_to_ticks_rounded_down(&self, price: f64) -> u64
Given a price in quote units per raw base unit (represented as a float), returns the corresponding number of ticks (rounded down)
Sourcepub fn float_price_to_ticks_rounded_up(&self, price: f64) -> u64
pub fn float_price_to_ticks_rounded_up(&self, price: f64) -> u64
Given a price in quote units per raw base unit (represented as a float), returns the corresponding number of ticks (rounded up)
Sourcepub fn ticks_to_float_price(&self, ticks: u64) -> f64
pub fn ticks_to_float_price(&self, ticks: u64) -> f64
Given a number of ticks, returns the corresponding price in quote units per raw base unit (as a float)
Sourcepub fn raw_base_units_per_base_lot(&self) -> f64
pub fn raw_base_units_per_base_lot(&self) -> f64
Returns the base lot size in raw base units (as a float)
Sourcepub fn quote_units_per_raw_base_unit_per_tick(&self) -> f64
pub fn quote_units_per_raw_base_unit_per_tick(&self) -> f64
Returns the tick size in quote units per raw base unit
Trait Implementations§
Source§impl Clone for MarketMetadata
impl Clone for MarketMetadata
Source§fn clone(&self) -> MarketMetadata
fn clone(&self) -> MarketMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MarketMetadata
impl Debug for MarketMetadata
Source§impl Default for MarketMetadata
impl Default for MarketMetadata
Source§fn default() -> MarketMetadata
fn default() -> MarketMetadata
impl Copy for MarketMetadata
Auto Trait Implementations§
impl Freeze for MarketMetadata
impl RefUnwindSafe for MarketMetadata
impl Send for MarketMetadata
impl Sync for MarketMetadata
impl Unpin for MarketMetadata
impl UnwindSafe for MarketMetadata
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request