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>,
fail_silently_on_insufficient_funds: bool,
},
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>,
fail_silently_on_insufficient_funds: bool,
},
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
This order type is used to place a limit order on the book. It will never be matched against other existing limit orders
Fields
reject_post_only: boolFlag 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: boolFlag 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
Limit
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
Fields
self_trade_behavior: SelfTradeBehaviorHow the matching engine should handle a self trade
use_only_deposited_funds: boolFlag 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
ImmediateOrCancel
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.
Fields
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: BaseLotsThe 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: QuoteLotsThe 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: BaseLotsThe 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: QuoteLotsThe 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: SelfTradeBehaviorHow the matching engine should handle a self trade.
client_order_id: u128Client order id used to identify the order in the program’s inner instruction data.
Implementations§
Source§impl OrderPacket
impl OrderPacket
pub fn new_post_only_default( side: Side, price_in_ticks: u64, num_base_lots: u64, ) -> Self
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
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
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
pub fn new_limit_order_default( side: Side, price_in_ticks: u64, num_base_lots: u64, ) -> Self
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
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
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
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
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
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
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
pub fn new_ioc_buy_with_slippage( quote_lots_in: u64, min_base_lots_out: u64, ) -> Self
pub fn new_ioc_sell_with_slippage( base_lots_in: u64, min_quote_lots_out: u64, ) -> Self
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
impl OrderPacket
pub fn side(&self) -> Side
pub fn fail_silently_on_insufficient_funds(&self) -> bool
pub fn client_order_id(&self) -> u128
pub fn num_base_lots(&self) -> BaseLots
pub fn num_quote_lots(&self) -> QuoteLots
pub fn base_lot_budget(&self) -> BaseLots
pub fn quote_lot_budget(&self) -> Option<QuoteLots>
pub fn match_limit(&self) -> u64
pub fn self_trade_behavior(&self) -> SelfTradeBehavior
pub fn get_price_in_ticks(&self) -> Ticks
pub fn set_price_in_ticks(&mut self, price_in_ticks: Ticks)
pub fn get_last_valid_slot(&self) -> Option<u64>
pub fn get_last_valid_unix_timestamp_in_seconds(&self) -> Option<u64>
pub fn is_expired( &self, current_slot: u64, current_unix_timestamp_in_seconds: u64, ) -> bool
Trait Implementations§
Source§impl BorshDeserialize for OrderPacket
impl BorshDeserialize for OrderPacket
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for OrderPacket
impl BorshSerialize for OrderPacket
Source§impl Clone for OrderPacket
impl Clone for OrderPacket
Source§fn clone(&self) -> OrderPacket
fn clone(&self) -> OrderPacket
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OrderPacket
impl Debug for OrderPacket
Source§impl EnumExt for OrderPacket
impl EnumExt for OrderPacket
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>
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>
fn get_data_size(&self) -> usize
fn get_taker_fee_bps(&self) -> u64
fn get_tick_size(&self) -> QuoteLotsPerBaseUnitPerTick
fn get_base_lots_per_base_unit(&self) -> BaseLotsPerBaseUnit
fn get_sequence_number(&self) -> u64
fn get_collected_fee_amount(&self) -> QuoteLots
fn get_uncollected_fee_amount(&self) -> QuoteLots
fn get_registered_traders( &self, ) -> &dyn OrderedNodeAllocatorMap<MarketTraderId, TraderState>
fn get_trader_state(&self, trader_id: &MarketTraderId) -> Option<&TraderState>
fn get_trader_state_from_index(&self, index: u32) -> &TraderState
fn get_trader_index(&self, trader_id: &MarketTraderId) -> Option<u32>
fn get_trader_id_from_index(&self, trader_index: u32) -> MarketTraderId
fn get_book( &self, side: Side, ) -> &dyn OrderedNodeAllocatorMap<FIFOOrderId, FIFORestingOrder>
fn get_ladder(&self, levels: u64) -> Ladder
fn get_ladder_with_expiration( &self, levels: u64, last_valid_slot: Option<u64>, last_valid_unix_timestamp_in_seconds: Option<u64>, ) -> Ladder
fn get_typed_ladder(&self, levels: u64) -> TypedLadder
fn get_typed_ladder_with_expiration( &self, levels: u64, last_valid_slot: Option<u64>, last_valid_unix_timestamp_in_seconds: Option<u64>, ) -> TypedLadder
Source§impl OrderPacketMetadata for OrderPacket
impl OrderPacketMetadata for OrderPacket
Source§impl PartialEq for OrderPacket
impl PartialEq for OrderPacket
impl Copy for OrderPacket
impl Eq for OrderPacket
impl StructuralPartialEq for OrderPacket
Auto Trait Implementations§
impl Freeze for OrderPacket
impl RefUnwindSafe for OrderPacket
impl Send for OrderPacket
impl Sync for OrderPacket
impl Unpin for OrderPacket
impl UnwindSafe for OrderPacket
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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