Struct phoenix_sdk::sdk_client::SDKClientCore
source · pub struct SDKClientCore {
pub markets: BTreeMap<Pubkey, MarketMetadata, Global>,
pub rng: Arc<Mutex<StdRng>>,
pub active_market_key: Pubkey,
pub trader: Pubkey,
}Fields§
§markets: BTreeMap<Pubkey, MarketMetadata, Global>§rng: Arc<Mutex<StdRng>>§active_market_key: Pubkey§trader: PubkeyImplementations§
source§impl SDKClientCore
impl SDKClientCore
sourcepub fn raw_base_units_to_base_lots(&self, raw_base_units: f64) -> u64
pub fn raw_base_units_to_base_lots(&self, raw_base_units: f64) -> u64
RECOMMENDED: Converts raw base units (whole tokens) to base lots. For example if the base currency was a Widget and you wanted to convert 3 Widget tokens to base lots you would call sdk.raw_base_units_to_base_lots(3.0). This would return the number of base lots that would be equivalent to 3 Widget tokens.
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
The same function as raw_base_units_to_base_lots, but rounds up instead of down.
sourcepub fn base_atoms_to_base_lots(&self, base_atoms: u64) -> u64
pub fn base_atoms_to_base_lots(&self, base_atoms: u64) -> u64
RECOMMENDED: Converts base atoms to base lots. For example if the base currency was a Widget with 9 decimals, where 1 atom is 1e-9 of one Widget and you wanted to convert 3 Widgets to base lots you would call sdk.base_amount_to_base_lots(3_000_000_000). This would return the number of base lots that would be equivalent to 3 Widgets or 3 * 1e9 Widget atoms.
sourcepub fn base_lots_to_base_atoms(&self, base_lots: u64) -> u64
pub fn base_lots_to_base_atoms(&self, base_lots: u64) -> u64
RECOMMENDED: Converts base lots to base atoms. For example if the base currency was a Widget where there are 1_000 base atoms per base lot of Widget, you would call sdk.base_lots_to_base_atoms(300) to convert 300 base lots to 300_000 Widget 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
RECOMMENDED: Converts quote units to quote lots. For example if the quote currency was USDC you wanted to convert 3 USDC to quote lots you would call sdk.quote_unit_to_quote_lots(3.0). This would return the number of quote lots that would be equivalent to 3 USDC.
sourcepub fn quote_atoms_to_quote_lots(&self, quote_atoms: u64) -> u64
pub fn quote_atoms_to_quote_lots(&self, quote_atoms: u64) -> u64
RECOMMENDED: Converts quote atoms to quote lots. For example if the quote currency was USDC with 6 decimals and you wanted to convert 3 USDC, or 3_000_000 USDC atoms, to quote lots you would call sdk.quote_atoms_to_quote_lots(3_000_000). This would return the number of quote lots that would be equivalent to 3_000_000 USDC atoms.
sourcepub fn quote_lots_to_quote_atoms(&self, quote_lots: u64) -> u64
pub fn quote_lots_to_quote_atoms(&self, quote_lots: u64) -> u64
RECOMMENDED: Converts quote lots to quote atoms. For example if the quote currency was USDC and there are 100 quote atoms per quote lot of USDC, you would call sdk.quote_lots_to_quote_atoms(300) to convert 300 quote lots to 30_000 USDC atoms.
sourcepub fn base_atoms_to_base_unit_as_float(&self, base_atoms: u64) -> f64
pub fn base_atoms_to_base_unit_as_float(&self, base_atoms: u64) -> f64
Converts a number of base atoms to a floating point number of base units. For example if the base currency is a Widget where the token has 9 decimals and you wanted to convert 1_000_000_000 base atoms to a floating point number of whole Widget tokens you would call sdk.base_amount_to_float(1_000_000_000). This would return 1.0. This is useful for displaying the base amount in a human readable format.
sourcepub fn quote_atoms_to_quote_unit_as_float(&self, quote_atoms: u64) -> f64
pub fn quote_atoms_to_quote_unit_as_float(&self, quote_atoms: u64) -> f64
Converts a number of quote atoms to a floating point number of quote units. For example if the quote currency is USDC the token has 6 decimals and you wanted to convert 1_000_000 USDC atoms to a floating point number of whole USDC tokens you would call sdk.quote_amount_to_float(1_000_000). This would return 1.0. This is useful for displaying the quote amount in a human readable format.
sourcepub fn print_quote_amount(&self, quote_amount: u64)
pub fn print_quote_amount(&self, quote_amount: u64)
Takes in a number of quote atoms, converts to floating point number of whole tokens, and prints it as a human readable string to the console
sourcepub fn print_base_amount(&self, base_amount: u64)
pub fn print_base_amount(&self, base_amount: u64)
Takes in a number of base atoms, converts to floating point number of whole tokens, and prints it as a human readable string to the console
sourcepub fn fill_event_to_quote_amount(&self, fill: &Fill) -> u64
pub fn fill_event_to_quote_amount(&self, fill: &Fill) -> u64
Takes in information from a fill event and converts it into the equivalent quote amount
sourcepub fn order_to_quote_amount(&self, base_lots: u64, price_in_ticks: u64) -> u64
pub fn order_to_quote_amount(&self, base_lots: u64, price_in_ticks: u64) -> u64
Takes in tick price and base lots of an order converts it into the equivalent quote amount
sourcepub fn float_price_to_ticks(&self, price: f64) -> u64
pub fn float_price_to_ticks(&self, price: f64) -> u64
Takes in a price as a floating point number and converts it to a 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
Takes in a price as a floating point number and converts it to a 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
Takes in a number of ticks and converts it to a floating point number price