Enum phoenix::state::order_schema::order_packet::OrderPacket
source · 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
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
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
self_trade_behavior: SelfTradeBehaviorHow the matching engine should handle a self trade
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
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.
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
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 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 OrderPacketwhere
Side: BorshDeserialize,
Ticks: BorshDeserialize,
BaseLots: BorshDeserialize,
u128: BorshDeserialize,
bool: BorshDeserialize,
Option<u64>: BorshDeserialize,
SelfTradeBehavior: BorshDeserialize,
Option<Ticks>: BorshDeserialize,
QuoteLots: BorshDeserialize,
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§impl BorshSerialize for OrderPacketwhere
Side: BorshSerialize,
Ticks: BorshSerialize,
BaseLots: BorshSerialize,
u128: BorshSerialize,
bool: BorshSerialize,
Option<u64>: BorshSerialize,
SelfTradeBehavior: BorshSerialize,
Option<Ticks>: BorshSerialize,
QuoteLots: BorshSerialize,
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§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<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<OrderPacket> for OrderPacket
impl PartialEq<OrderPacket> for OrderPacket
source§fn eq(&self, other: &OrderPacket) -> bool
fn eq(&self, other: &OrderPacket) -> bool
self and other values to be equal, and is used
by ==.