Struct SDKClientCore

Source
pub struct SDKClientCore {
    pub markets: BTreeMap<Pubkey, MarketMetadata>,
    pub trader: Pubkey,
}

Fields§

§markets: BTreeMap<Pubkey, MarketMetadata>§trader: Pubkey

Implementations§

Source§

impl SDKClientCore

Unit conversions

Source

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).

Source

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).

Source

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).

Source

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).

Source

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.

Source

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.

Source

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).

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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)

Source

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)

Source

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

pub fn raw_base_units_per_base_lot( &self, market_key: &Pubkey, ) -> Result<f64, Error>

Given a market, returns the base lot size in raw base units (as a float)

Source

pub fn quote_units_per_raw_base_unit_per_tick( &self, market_key: &Pubkey, ) -> Result<f64, Error>

Given a market, returns the tick size in quote units per raw base unit

Source§

impl SDKClientCore

Source

pub fn get_next_client_order_id(&self, rng: &mut StdRng) -> u128

Generate a random client order id

Source

pub fn get_market_metadata(&self, market_key: &Pubkey) -> &MarketMetadata

Source

pub fn parse_raw_phoenix_events( &self, sig: &Signature, events: Vec<Vec<u8>>, ) -> Option<Vec<RawPhoenixEvent>>

Source

pub fn parse_events_from_transaction( &self, tx: &ParsedTransaction, ) -> Option<Vec<RawPhoenixEvent>>

Source§

impl SDKClientCore

SDKClientCore instruction builders

Source

pub fn get_ioc_ix( &self, market_key: &Pubkey, price: u64, side: Side, num_base_lots: u64, ) -> Result<Instruction, Error>

Source

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>

Source

pub fn get_fok_sell_ix( &self, market_key: &Pubkey, price: u64, size_in_base_lots: u64, ) -> Result<Instruction, Error>

Source

pub fn get_fok_buy_ix( &self, market_key: &Pubkey, price: u64, size_in_base_lots: u64, ) -> Result<Instruction, Error>

Source

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>

Source

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>

Source

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>

Source

pub fn get_ioc_with_slippage_ix( &self, market_key: &Pubkey, lots_in: u64, min_lots_out: u64, side: Side, ) -> Result<Instruction, Error>

Source

pub fn get_ioc_from_tick_price_ix( &self, market_key: &Pubkey, tick_price: u64, side: Side, size: u64, ) -> Result<Instruction, Error>

Source

pub fn get_post_only_ix( &self, market_key: &Pubkey, price: u64, side: Side, size: u64, ) -> Result<Instruction, Error>

Source

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>, fail_silently_on_insufficient_funds: Option<bool>, ) -> Result<Instruction, Error>

Source

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>

Source

pub fn get_limit_order_ix( &self, market_key: &Pubkey, price: u64, side: Side, size: u64, ) -> Result<Instruction, Error>

Source

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>, fail_silently_on_insufficient_funds: Option<bool>, ) -> Result<Instruction, Error>

Source

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>

Source

pub fn get_cancel_ids_ix( &self, market_key: &Pubkey, ids: Vec<FIFOOrderId>, ) -> Result<Instruction, Error>

Source

pub fn get_cancel_up_to_ix( &self, market_key: &Pubkey, tick_limit: Option<u64>, side: Side, ) -> Result<Instruction, Error>

Source

pub fn get_cancel_all_ix( &self, market_key: &Pubkey, ) -> Result<Instruction, Error>

Source

pub fn get_withdraw_ix(&self, market_key: &Pubkey) -> Result<Instruction, Error>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AbiExample for T

Source§

default fn example() -> T

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T