pub enum OrderPacket {
    PostOnly {
        side: Side,
        price_in_ticks: Ticks,
        num_base_lots: BaseLots,
        client_order_id: u128,
        reject_post_only: bool,
        use_only_deposited_funds: bool,
        last_valid_slot: Option<u64>,
        last_valid_unix_timestamp_in_seconds: Option<u64>,
    },
    Limit {
        side: Side,
        price_in_ticks: Ticks,
        num_base_lots: BaseLots,
        self_trade_behavior: SelfTradeBehavior,
        match_limit: Option<u64>,
        client_order_id: u128,
        use_only_deposited_funds: bool,
        last_valid_slot: Option<u64>,
        last_valid_unix_timestamp_in_seconds: Option<u64>,
    },
    ImmediateOrCancel {
        side: Side,
        price_in_ticks: Option<Ticks>,
        num_base_lots: BaseLots,
        num_quote_lots: QuoteLots,
        min_base_lots_to_fill: BaseLots,
        min_quote_lots_to_fill: QuoteLots,
        self_trade_behavior: SelfTradeBehavior,
        match_limit: Option<u64>,
        client_order_id: u128,
        use_only_deposited_funds: bool,
        last_valid_slot: Option<u64>,
        last_valid_unix_timestamp_in_seconds: Option<u64>,
    },
}

Variants§

§

PostOnly

Fields

§side: Side
§price_in_ticks: Ticks

The price of the order, in ticks

§num_base_lots: BaseLots

Number of base lots to place on the book

§client_order_id: u128

Client order id used to identify the order in the response to the client

§reject_post_only: bool

Flag for whether or not to reject the order if it would immediately match or amend it to the best non-crossing price Default value is true

§use_only_deposited_funds: bool

Flag for whether or not the order should only use funds that are already in the account Using only deposited funds will allow the trader to pass in less accounts per instruction and save transaction space as well as compute. This is only for traders who have a seat

§last_valid_slot: Option<u64>

If this is set, the order will be invalid after the specified slot

§last_valid_unix_timestamp_in_seconds: Option<u64>

If this is set, the order will be invalid after the specified unix timestamp

This order type is used to place a limit order on the book. It will never be matched against other existing limit orders

§

Limit

Fields

§side: Side
§price_in_ticks: Ticks

The price of the order, in ticks

§num_base_lots: BaseLots

Total number of base lots to place on the book or fill at a better price

§self_trade_behavior: SelfTradeBehavior

How the matching engine should handle a self trade

§match_limit: Option<u64>

Number of orders to match against. If this is None there is no limit

§client_order_id: u128

Client order id used to identify the order in the response to the client

§use_only_deposited_funds: bool

Flag for whether or not the order should only use funds that are already in the account. Using only deposited funds will allow the trader to pass in less accounts per instruction and save transaction space as well as compute. This is only for traders who have a seat

§last_valid_slot: Option<u64>

If this is set, the order will be invalid after the specified slot

§last_valid_unix_timestamp_in_seconds: Option<u64>

If this is set, the order will be invalid after the specified unix timestamp

This order type is used to place a limit order on the book It can be matched against other existing limit orders, but will posted at the specified level if it is not matched

§

ImmediateOrCancel

Fields

§side: Side
§price_in_ticks: Option<Ticks>

The most aggressive price an order can be matched at. For example, if there is an IOC buy order to purchase 10 lots with the tick_per_lot parameter set to 10, then the order will never be matched at a price higher than 10 quote ticks per base unit. If this value is None, then the order is treated as a market order.

§num_base_lots: BaseLots

The number of base lots to fill against the order book. Either this parameter or the num_quote_lots parameter must be set to a nonzero value.

§num_quote_lots: QuoteLots

The number of quote lots to fill against the order book. Either this parameter or the num_base_lots parameter must be set to a nonzero value.

§min_base_lots_to_fill: BaseLots

The minimum number of base lots to fill against the order book. If the order does not fill this many base lots, it will be voided.

§min_quote_lots_to_fill: QuoteLots

The minimum number of quote lots to fill against the order book. If the order does not fill this many quote lots, it will be voided.

§self_trade_behavior: SelfTradeBehavior

How the matching engine should handle a self trade.

§match_limit: Option<u64>

Number of orders to match against. If set to None, there is no limit.

§client_order_id: u128

Client order id used to identify the order in the program’s inner instruction data.

§use_only_deposited_funds: bool

Flag for whether or not the order should only use funds that are already in the account. Using only deposited funds will allow the trader to pass in less accounts per instruction and save transaction space as well as compute. This is only for traders who have a seat

§last_valid_slot: Option<u64>

If this is set, the order will be invalid after the specified slot

§last_valid_unix_timestamp_in_seconds: Option<u64>

If this is set, the order will be invalid after the specified unix timestamp

This order type is used to place an order that will be matched against existing resting orders If the order matches fewer than min_lots lots, it will be cancelled.

Fill or Kill (FOK) orders are a subset of Immediate or Cancel (IOC) orders where either the num_base_lots is equal to the min_base_lots_to_fill of the order, or the num_quote_lots is equal to the min_quote_lots_to_fill of the order.

Implementations§

source§

impl OrderPacket

source

pub fn new_post_only_default( side: Side, price_in_ticks: u64, num_base_lots: u64 ) -> Self

source

pub fn new_post_only_default_with_client_order_id( side: Side, price_in_ticks: u64, num_base_lots: u64, client_order_id: u128 ) -> Self

source

pub fn new_adjustable_post_only_default_with_client_order_id( side: Side, price_in_ticks: u64, num_base_lots: u64, client_order_id: u128 ) -> Self

source

pub fn new_post_only( side: Side, price_in_ticks: u64, num_base_lots: u64, client_order_id: u128, reject_post_only: bool, use_only_deposited_funds: bool ) -> Self

source

pub fn new_limit_order_default( side: Side, price_in_ticks: u64, num_base_lots: u64 ) -> Self

source

pub fn new_limit_order_default_with_client_order_id( side: Side, price_in_ticks: u64, num_base_lots: u64, client_order_id: u128 ) -> Self

source

pub fn new_limit_order( side: Side, price_in_ticks: u64, num_base_lots: u64, self_trade_behavior: SelfTradeBehavior, match_limit: Option<u64>, client_order_id: u128, use_only_deposited_funds: bool ) -> Self

source

pub fn new_fok_sell_with_limit_price( target_price_in_ticks: u64, base_lot_budget: u64, self_trade_behavior: SelfTradeBehavior, match_limit: Option<u64>, client_order_id: u128, use_only_deposited_funds: bool ) -> Self

source

pub fn new_fok_buy_with_limit_price( target_price_in_ticks: u64, base_lot_budget: u64, self_trade_behavior: SelfTradeBehavior, match_limit: Option<u64>, client_order_id: u128, use_only_deposited_funds: bool ) -> Self

source

pub fn new_ioc_sell_with_limit_price( price_in_ticks: u64, num_base_lots: u64, self_trade_behavior: SelfTradeBehavior, match_limit: Option<u64>, client_order_id: u128, use_only_deposited_funds: bool ) -> Self

source

pub fn new_ioc_buy_with_limit_price( price_in_ticks: u64, num_quote_lots: u64, self_trade_behavior: SelfTradeBehavior, match_limit: Option<u64>, client_order_id: u128, use_only_deposited_funds: bool ) -> Self

source

pub fn new_ioc_by_lots( side: Side, price_in_ticks: u64, base_lot_budget: u64, self_trade_behavior: SelfTradeBehavior, match_limit: Option<u64>, client_order_id: u128, use_only_deposited_funds: bool ) -> Self

source

pub fn new_ioc_buy_with_slippage( quote_lots_in: u64, min_base_lots_out: u64 ) -> Self

source

pub fn new_ioc_sell_with_slippage( base_lots_in: u64, min_quote_lots_out: u64 ) -> Self

source

pub fn new_ioc( side: Side, price_in_ticks: Option<u64>, num_base_lots: u64, num_quote_lots: u64, min_base_lots_to_fill: u64, min_quote_lots_to_fill: u64, self_trade_behavior: SelfTradeBehavior, match_limit: Option<u64>, client_order_id: u128, use_only_deposited_funds: bool, last_valid_slot: Option<u64>, last_valid_unix_timestamp_in_seconds: Option<u64> ) -> Self

source§

impl OrderPacket

source

pub fn side(&self) -> Side

source

pub fn client_order_id(&self) -> u128

source

pub fn num_base_lots(&self) -> BaseLots

source

pub fn num_quote_lots(&self) -> QuoteLots

source

pub fn base_lot_budget(&self) -> BaseLots

source

pub fn quote_lot_budget(&self) -> Option<QuoteLots>

source

pub fn match_limit(&self) -> u64

source

pub fn self_trade_behavior(&self) -> SelfTradeBehavior

source

pub fn get_price_in_ticks(&self) -> Ticks

source

pub fn set_price_in_ticks(&mut self, price_in_ticks: Ticks)

source

pub fn get_last_valid_slot(&self) -> Option<u64>

source

pub fn get_last_valid_unix_timestamp_in_seconds(&self) -> Option<u64>

source

pub fn is_expired( &self, current_slot: u64, current_unix_timestamp_in_seconds: u64 ) -> bool

Trait Implementations§

source§

impl BorshDeserialize for OrderPacketwhere Side: BorshDeserialize, Ticks: BorshDeserialize, BaseLots: BorshDeserialize, u128: BorshDeserialize, bool: BorshDeserialize, Option<u64>: BorshDeserialize, SelfTradeBehavior: BorshDeserialize, Option<Ticks>: BorshDeserialize, QuoteLots: BorshDeserialize,

source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
source§

impl BorshSerialize for OrderPacketwhere Side: BorshSerialize, Ticks: BorshSerialize, BaseLots: BorshSerialize, u128: BorshSerialize, bool: BorshSerialize, Option<u64>: BorshSerialize, SelfTradeBehavior: BorshSerialize, Option<Ticks>: BorshSerialize, QuoteLots: BorshSerialize,

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

source§

fn try_to_vec(&self) -> Result<Vec<u8, Global>, Error>

Serialize this instance into a vector of bytes.
source§

impl Clone for OrderPacket

source§

fn clone(&self) -> OrderPacket

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for OrderPacket

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<MarketTraderId: Debug + PartialOrd + Ord + Default + Copy + Clone + Zeroable + Pod + BorshDeserialize + BorshSerialize, const BIDS_SIZE: usize, const ASKS_SIZE: usize, const NUM_SEATS: usize> Market<MarketTraderId, FIFOOrderId, FIFORestingOrder, OrderPacket> for FIFOMarket<MarketTraderId, BIDS_SIZE, ASKS_SIZE, NUM_SEATS>

source§

impl OrderPacketMetadata for OrderPacket

source§

impl PartialEq<OrderPacket> for OrderPacket

source§

fn eq(&self, other: &OrderPacket) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for OrderPacket

source§

impl Eq for OrderPacket

source§

impl StructuralEq for OrderPacket

source§

impl StructuralPartialEq for OrderPacket

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

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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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