Struct phoenix_sdk::sdk_client::SDKClientCore
source · pub struct SDKClientCore {
pub markets: BTreeMap<Pubkey, MarketMetadata, Global>,
pub trader: Pubkey,
}Fields§
§markets: BTreeMap<Pubkey, MarketMetadata, Global>§trader: PubkeyImplementations§
source§impl SDKClientCore
impl SDKClientCore
Unit conversions
sourcepub fn raw_base_units_to_base_lots_rounded_down(
&self,
market_key: &Pubkey,
raw_base_units: f64
) -> Result<u64, Error>
pub fn raw_base_units_to_base_lots_rounded_down( &self, market_key: &Pubkey, raw_base_units: f64 ) -> Result<u64, Error>
Given a market pubkey and 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,
market_key: &Pubkey,
raw_base_units: f64
) -> Result<u64, Error>
pub fn raw_base_units_to_base_lots_rounded_up( &self, market_key: &Pubkey, raw_base_units: f64 ) -> Result<u64, Error>
Given a market pubkey and 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,
market_key: &Pubkey,
base_atoms: u64
) -> Result<u64, Error>
pub fn base_atoms_to_base_lots_rounded_down( &self, market_key: &Pubkey, base_atoms: u64 ) -> Result<u64, Error>
Given a market pubkey and a number of base atoms, returns the equivalent number of base lots (rounded down).
sourcepub fn base_atoms_to_base_lots_rounded_up(
&self,
market_key: &Pubkey,
base_atoms: u64
) -> Result<u64, Error>
pub fn base_atoms_to_base_lots_rounded_up( &self, market_key: &Pubkey, base_atoms: u64 ) -> Result<u64, Error>
Given a market pubkey and a number of base atoms, returns the equivalent number of base lots (rounded up).
sourcepub fn base_lots_to_base_atoms(
&self,
market_key: &Pubkey,
base_lots: u64
) -> Result<u64, Error>
pub fn base_lots_to_base_atoms( &self, market_key: &Pubkey, base_lots: u64 ) -> Result<u64, Error>
Given a market pubkey and a number of base lots, returns the equivalent number of base atoms.
sourcepub fn quote_units_to_quote_lots(
&self,
market_key: &Pubkey,
quote_units: f64
) -> Result<u64, Error>
pub fn quote_units_to_quote_lots( &self, market_key: &Pubkey, quote_units: f64 ) -> Result<u64, Error>
Given a market pubkey and a number of quote units, returns the equivalent number of quote lots.
sourcepub fn quote_atoms_to_quote_lots_rounded_down(
&self,
market_key: &Pubkey,
quote_atoms: u64
) -> Result<u64, Error>
pub fn quote_atoms_to_quote_lots_rounded_down( &self, market_key: &Pubkey, quote_atoms: u64 ) -> Result<u64, Error>
Given a market pubkey and a number of quote atoms, returns the equivalent number of quote lots (rounded down).
sourcepub fn quote_atoms_to_quote_lots_rounded_up(
&self,
market_key: &Pubkey,
quote_atoms: u64
) -> Result<u64, Error>
pub fn quote_atoms_to_quote_lots_rounded_up( &self, market_key: &Pubkey, quote_atoms: u64 ) -> Result<u64, Error>
Given a market pubkey and a number of quote atoms, returns the equivalent number of quote lots (rounded up).
sourcepub fn quote_lots_to_quote_atoms(
&self,
market_key: &Pubkey,
quote_lots: u64
) -> Result<u64, Error>
pub fn quote_lots_to_quote_atoms( &self, market_key: &Pubkey, quote_lots: u64 ) -> Result<u64, Error>
Given a market pubkey and a number of quote lots, returns the equivalent number of quote atoms.
sourcepub fn base_atoms_to_raw_base_units_as_float(
&self,
market_key: &Pubkey,
base_atoms: u64
) -> Result<f64, Error>
pub fn base_atoms_to_raw_base_units_as_float( &self, market_key: &Pubkey, base_atoms: u64 ) -> Result<f64, Error>
Given a market pubkey and a number of base atoms, returns the equivalent number of raw base units.
sourcepub fn quote_atoms_to_quote_units_as_float(
&self,
market_key: &Pubkey,
quote_atoms: u64
) -> Result<f64, Error>
pub fn quote_atoms_to_quote_units_as_float( &self, market_key: &Pubkey, quote_atoms: u64 ) -> Result<f64, Error>
Given a market pubkey and a number of quote atoms, returns the equivalent number of quote units.
sourcepub fn fill_event_to_quote_atoms(
&self,
market_key: &Pubkey,
fill: &Fill
) -> Result<u64, Error>
pub fn fill_event_to_quote_atoms( &self, market_key: &Pubkey, fill: &Fill ) -> Result<u64, Error>
Given a market pubkey and a fill event, returns the number of quote atoms filled.
sourcepub fn base_lots_and_price_to_quote_atoms(
&self,
market_key: &Pubkey,
base_lots: u64,
price_in_ticks: u64
) -> Result<u64, Error>
pub fn base_lots_and_price_to_quote_atoms( &self, market_key: &Pubkey, base_lots: u64, price_in_ticks: u64 ) -> Result<u64, Error>
Given a market pubkey, 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,
market_key: &Pubkey,
price: f64
) -> Result<u64, Error>
pub fn float_price_to_ticks_rounded_down( &self, market_key: &Pubkey, price: f64 ) -> Result<u64, Error>
Given a market pubkey and 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,
market_key: &Pubkey,
price: f64
) -> Result<u64, Error>
pub fn float_price_to_ticks_rounded_up( &self, market_key: &Pubkey, price: f64 ) -> Result<u64, Error>
Given a market pubkey and 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,
market_key: &Pubkey,
ticks: u64
) -> Result<f64, Error>
pub fn ticks_to_float_price( &self, market_key: &Pubkey, ticks: u64 ) -> Result<f64, Error>
Given a number of ticks, returns the corresponding price in quote units per raw base unit (as a float)
source§impl SDKClientCore
impl SDKClientCore
sourcepub fn get_next_client_order_id(&self, rng: &mut StdRng) -> u128
pub fn get_next_client_order_id(&self, rng: &mut StdRng) -> u128
Generate a random client order id
pub fn get_market_metadata(&self, market_key: &Pubkey) -> &MarketMetadata
pub fn parse_raw_phoenix_events( &self, sig: &Signature, events: Vec<Vec<u8, Global>, Global> ) -> Option<Vec<RawPhoenixEvent, Global>>
pub fn parse_events_from_transaction( &self, tx: &ParsedTransaction ) -> Option<Vec<RawPhoenixEvent, Global>>
source§impl SDKClientCore
impl SDKClientCore
SDKClientCore instruction builders
pub fn get_ioc_ix( &self, market_key: &Pubkey, price: u64, side: Side, num_base_lots: u64 ) -> Result<Instruction, Error>
pub fn get_ioc_generic_ix( &self, market_key: &Pubkey, price: u64, side: Side, num_base_lots: u64, self_trade_behavior: Option<SelfTradeBehavior>, match_limit: Option<u64>, client_order_id: Option<u128>, use_only_deposited_funds: Option<bool>, last_valid_slot: Option<u64>, last_valid_unix_timestamp_in_seconds: Option<u64> ) -> Result<Instruction, Error>
pub fn get_fok_sell_ix( &self, market_key: &Pubkey, price: u64, size_in_base_lots: u64 ) -> Result<Instruction, Error>
pub fn get_fok_buy_ix( &self, market_key: &Pubkey, price: u64, size_in_base_lots: u64 ) -> Result<Instruction, Error>
pub fn get_fok_buy_generic_ix( &self, market_key: &Pubkey, price: u64, size_in_quote_lots: u64, self_trade_behavior: Option<SelfTradeBehavior>, match_limit: Option<u64>, client_order_id: Option<u128>, use_only_deposited_funds: Option<bool> ) -> Result<Instruction, Error>
pub fn get_fok_sell_generic_ix( &self, market_key: &Pubkey, price: u64, size_in_base_lots: u64, self_trade_behavior: Option<SelfTradeBehavior>, match_limit: Option<u64>, client_order_id: Option<u128>, use_only_deposited_funds: Option<bool> ) -> Result<Instruction, Error>
pub fn get_fok_generic_ix( &self, market_key: &Pubkey, price: u64, side: Side, size: u64, self_trade_behavior: Option<SelfTradeBehavior>, match_limit: Option<u64>, client_order_id: Option<u128>, use_only_deposited_funds: Option<bool> ) -> Result<Instruction, Error>
pub fn get_ioc_with_slippage_ix( &self, market_key: &Pubkey, lots_in: u64, min_lots_out: u64, side: Side ) -> Result<Instruction, Error>
pub fn get_ioc_from_tick_price_ix( &self, market_key: &Pubkey, tick_price: u64, side: Side, size: u64 ) -> Result<Instruction, Error>
pub fn get_post_only_ix( &self, market_key: &Pubkey, price: u64, side: Side, size: u64 ) -> Result<Instruction, Error>
pub fn get_post_only_generic_ix( &self, market_key: &Pubkey, price: u64, side: Side, size: u64, client_order_id: Option<u128>, reject_post_only: Option<bool>, use_only_deposited_funds: Option<bool>, last_valid_slot: Option<u64>, last_valid_unix_timestamp_in_seconds: Option<u64> ) -> Result<Instruction, Error>
pub fn get_post_only_ix_from_tick_price( &self, market_key: &Pubkey, tick_price: u64, side: Side, size: u64, client_order_id: u128, improve_price_on_cross: bool ) -> Result<Instruction, Error>
pub fn get_limit_order_ix( &self, market_key: &Pubkey, price: u64, side: Side, size: u64 ) -> Result<Instruction, Error>
pub fn get_limit_order_generic_ix( &self, market_key: &Pubkey, price: u64, side: Side, size: u64, self_trade_behavior: Option<SelfTradeBehavior>, match_limit: Option<u64>, client_order_id: Option<u128>, use_only_deposited_funds: Option<bool>, last_valid_slot: Option<u64>, last_valid_unix_timestamp_in_seconds: Option<u64> ) -> Result<Instruction, Error>
pub fn get_limit_order_ix_from_tick_price( &self, market_key: &Pubkey, tick_price: u64, side: Side, size: u64, client_order_id: u128 ) -> Result<Instruction, Error>
pub fn get_cancel_ids_ix( &self, market_key: &Pubkey, ids: Vec<FIFOOrderId, Global> ) -> Result<Instruction, Error>
pub fn get_cancel_up_to_ix( &self, market_key: &Pubkey, tick_limit: Option<u64>, side: Side ) -> Result<Instruction, Error>
pub fn get_cancel_all_ix( &self, market_key: &Pubkey ) -> Result<Instruction, Error>
Auto Trait Implementations§
impl RefUnwindSafe for SDKClientCore
impl Send for SDKClientCore
impl Sync for SDKClientCore
impl Unpin for SDKClientCore
impl UnwindSafe for SDKClientCore
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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