pub struct SDKClient {
    pub client: EllipsisClient,
    pub core: SDKClientCore,
}

Fields§

§client: EllipsisClient§core: SDKClientCore

Implementations§

source§

impl SDKClient

source

pub async fn new_from_ellipsis_client(client: EllipsisClient) -> Result<Self>

Create a new SDKClient from an EllipsisClient. This does not have any markets added to it. You must call add_market or add_all_markets to add markets to the SDKClient.

source

pub fn new_from_ellipsis_client_sync(client: EllipsisClient) -> Result<Self>

Create a new SDKClient from an EllipsisClient. This does not have any markets added to it. You must call add_market or add_all_markets to add markets to the SDKClient.

source

pub async fn new_from_ellipsis_client_with_all_markets( client: EllipsisClient ) -> Result<Self>

Recommended way to create a new SDKClient from an EllipsisClient. This will use a list of markets from a pre-defined config file to add all known markets to the SDKClient.

source

pub fn new_from_ellipsis_client_with_all_markets_sync( client: EllipsisClient ) -> Result<Self>

Recommended way to create a new SDKClient from an EllipsisClient. This will use a list of markets from a pre-defined config file to add all known markets to the SDKClient.

source

pub async fn new_from_ellipsis_client_with_market_keys( market_keys: Vec<&Pubkey>, client: EllipsisClient ) -> Result<Self>

Create a new SDKClient from an EllipsisClient. Pass in a list of market keys to add to the SDKClient.

source

pub fn new_from_ellipsis_client_sync_with_market_keys( market_keys: Vec<&Pubkey>, client: EllipsisClient ) -> Result<Self>

Create a new SDKClient from an EllipsisClient. Pass in a list of market keys to add to the SDKClient.

source

pub async fn new(payer: &Keypair, url: &str) -> Result<Self>

Create a new SDKClient. This does not have any markets added to it. You must call add_market or add_all_markets to add markets to the SDKClient.

source

pub fn new_sync(payer: &Keypair, url: &str) -> Result<Self>

Create a new SDKClient. This does not have any markets added to it. You must call add_market or add_all_markets to add markets to the SDKClient.

source

pub async fn new_with_all_markets(payer: &Keypair, url: &str) -> Result<Self>

Recommended way to create a new SDKClient. This will use a list of markets from a pre-defined config file to add all known markets to the SDKClient.

source

pub fn new_with_all_markets_sync(payer: &Keypair, url: &str) -> Result<Self>

Recommended way to create a new SDKClient. This will use a list of markets from a pre-defined config file to add all known markets to the SDKClient.

source

pub async fn new_with_market_keys( market_keys: Vec<&Pubkey>, payer: &Keypair, url: &str ) -> Result<Self>

Create a new SDKClient. Pass in a list of market keys to add to the SDKClient.

source

pub fn new_with_market_keys_sync( market_keys: Vec<&Pubkey>, payer: &Keypair, url: &str ) -> Result<Self>

Create a new SDKClient. Pass in a list of market keys to add to the SDKClient.

source

pub async fn add_all_markets(&mut self) -> Result<()>

Load in all known markets from a pre-defined config file located in the SDK github.

source

pub fn add_all_markets_sync(&mut self) -> Result<()>

source

pub async fn add_market(&mut self, market_key: &Pubkey) -> Result<()>

source

pub fn set_payer(&mut self, payer: Keypair)

source

pub fn set_trader(&mut self, trader: Pubkey)

source

pub fn get_trader(&self) -> Pubkey

source

pub async fn get_market_ladder( &self, market_key: &Pubkey, levels: u64 ) -> Result<Ladder>

source

pub fn get_market_ladder_sync( &self, market_key: &Pubkey, levels: u64 ) -> Result<Ladder>

source

pub async fn get_market_orderbook( &self, market_key: &Pubkey ) -> Result<Orderbook<FIFOOrderId, PhoenixOrder>>

source

pub async fn get_market_orderbook_sync( &self, market_key: &Pubkey ) -> Result<Orderbook<FIFOOrderId, PhoenixOrder>>

source

pub async fn get_traders_with_market_key( &self, market_key: &Pubkey ) -> Result<BTreeMap<Pubkey, TraderState>>

source

pub fn get_traders_with_market_key_sync( &self, market_key: &Pubkey ) -> Result<BTreeMap<Pubkey, TraderState>>

source

pub async fn get_market_state(&self, market_key: &Pubkey) -> Result<MarketState>

source

pub async fn parse_events_from_transaction( &self, sig: &Signature ) -> Option<Vec<PhoenixEvent>>

source

pub async fn parse_places(&self, signature: &Signature) -> Vec<PhoenixEvent>

source

pub async fn parse_cancels(&self, signature: &Signature) -> Vec<PhoenixEvent>

source

pub async fn parse_fills(&self, signature: &Signature) -> Vec<PhoenixEvent>

source

pub async fn parse_fills_and_places( &self, signature: &Signature ) -> (Vec<PhoenixEvent>, Vec<PhoenixEvent>)

source

pub async fn send_ioc( &self, market_key: &Pubkey, price: u64, side: Side, size: u64 ) -> Option<(Signature, Vec<PhoenixEvent>)>

source

pub async fn send_fok_buy( &self, market_key: &Pubkey, price: u64, size_in_quote_lots: u64 ) -> Option<(Signature, Vec<PhoenixEvent>)>

source

pub async fn send_fok_sell( &self, market_key: &Pubkey, price: u64, size_in_base_lots: u64 ) -> Option<(Signature, Vec<PhoenixEvent>)>

source

pub async fn send_ioc_with_slippage( &self, market_key: &Pubkey, lots_in: u64, min_lots_out: u64, side: Side ) -> Option<(Signature, Vec<PhoenixEvent>)>

source

pub async fn send_post_only( &self, market_key: &Pubkey, price: u64, side: Side, size: u64 ) -> Option<(Signature, Vec<PhoenixEvent>)>

source

pub async fn send_limit_order( &self, market_key: &Pubkey, price: u64, side: Side, size: u64 ) -> Option<(Signature, Vec<PhoenixEvent>, Vec<PhoenixEvent>)>

source

pub async fn send_cancel_ids( &self, market_key: &Pubkey, ids: Vec<FIFOOrderId> ) -> Option<(Signature, Vec<PhoenixEvent>)>

source

pub async fn send_cancel_up_to( &self, market_key: &Pubkey, tick_limit: Option<u64>, side: Side ) -> Option<(Signature, Vec<PhoenixEvent>)>

source

pub async fn send_cancel_all( &self, market_key: &Pubkey ) -> Option<(Signature, Vec<PhoenixEvent>)>

Methods from Deref<Target = SDKClientCore>§

source

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

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.

source

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

The same function as raw_base_units_to_base_lots, but rounds up instead of down.

source

pub fn base_atoms_to_base_lots( &self, market_key: &Pubkey, base_atoms: u64 ) -> Result<u64, Error>

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.

source

pub fn base_lots_to_base_atoms( &self, market_key: &Pubkey, base_lots: u64 ) -> Result<u64, Error>

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.

source

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

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.

source

pub fn quote_atoms_to_quote_lots( &self, market_key: &Pubkey, quote_atoms: u64 ) -> Result<u64, Error>

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.

source

pub fn quote_lots_to_quote_atoms( &self, market_key: &Pubkey, quote_lots: u64 ) -> Result<u64, Error>

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.

source

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

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.

source

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

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.

source

pub fn print_quote_amount( &self, market_key: &Pubkey, quote_amount: u64 ) -> Result<(), Error>

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

source

pub fn print_base_amount( &self, market_key: &Pubkey, base_amount: u64 ) -> Result<(), Error>

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

source

pub fn fill_event_to_quote_amount( &self, market_key: &Pubkey, fill: &Fill ) -> Result<u64, Error>

Takes in information from a fill event and converts it into the equivalent quote amount

source

pub fn order_to_quote_amount( &self, market_key: &Pubkey, base_lots: u64, price_in_ticks: u64 ) -> Result<u64, Error>

Takes in tick price and base lots of an order converts it into the equivalent quote amount

source

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

Takes in a price as a floating point number and converts it to a number of ticks (rounded down)

source

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

Takes in a price as a floating point number and converts it to a number of ticks (rounded up)

source

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

Takes in a number of ticks and converts it to a floating point number price

source

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

Multiplier used to convert base lots to base units

source

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

Multiplier used to convert ticks to a floating point number price

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, Global>, Global> ) -> Option<Vec<RawPhoenixEvent, Global>>

source

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

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> ) -> 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> ) -> 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, Global> ) -> 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>

Trait Implementations§

source§

impl Deref for SDKClient

§

type Target = SDKClientCore

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for SDKClient

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

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

§

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

§

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

source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

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

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

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 Twhere U: From<T>,

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

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