Skip to main content

FIFOOrderId

Struct FIFOOrderId 

Source
#[repr(C)]
pub struct FIFOOrderId { pub price_in_ticks: Ticks, pub order_sequence_number: u64, }

Fields§

§price_in_ticks: Ticks

The price of the order, in ticks. Each market has a designated tick size (some number of quote lots per base unit) that is used to convert the price to ticks. For example, if the tick size is 0.01, then a price of 1.23 is converted to 123 ticks. If the quote lot size is 0.001, this means that there is a spacing of 10 quote lots in between each tick.

§order_sequence_number: u64

This is the unique identifier of the order, which is used to determine the side of the order. It is derived from the sequence number of the market.

If the order is a bid, the sequence number will have its bits inverted, and if it is an ask, the sequence number will be used as is.

The way to identify the side of the order is to check the leading bit of order_id. A leading bit of 0 indicates an ask, and a leading bit of 1 indicates a bid. See Side::from_order_id.

Implementations§

Source§

impl FIFOOrderId

Source

pub fn new_from_untyped(price_in_ticks: u64, order_sequence_number: u64) -> Self

Source

pub fn new(price_in_ticks: Ticks, order_sequence_number: u64) -> Self

Trait Implementations§

Source§

impl BorshDeserialize for FIFOOrderId

Source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>

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§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSerialize for FIFOOrderId

Source§

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

Source§

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

Serialize this instance into a vector of bytes.
Source§

impl Clone for FIFOOrderId

Source§

fn clone(&self) -> FIFOOrderId

Returns a duplicate 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 FIFOOrderId

Source§

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

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

impl Default for FIFOOrderId

Source§

fn default() -> FIFOOrderId

Returns the “default value” for a type. 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§

fn get_data_size(&self) -> usize

Source§

fn get_taker_fee_bps(&self) -> u64

Source§

fn get_tick_size(&self) -> QuoteLotsPerBaseUnitPerTick

Source§

fn get_base_lots_per_base_unit(&self) -> BaseLotsPerBaseUnit

Source§

fn get_sequence_number(&self) -> u64

Source§

fn get_collected_fee_amount(&self) -> QuoteLots

Source§

fn get_uncollected_fee_amount(&self) -> QuoteLots

Source§

fn get_registered_traders( &self, ) -> &dyn OrderedNodeAllocatorMap<MarketTraderId, TraderState>

Source§

fn get_trader_state(&self, trader_id: &MarketTraderId) -> Option<&TraderState>

Source§

fn get_trader_state_from_index(&self, index: u32) -> &TraderState

Source§

fn get_trader_index(&self, trader_id: &MarketTraderId) -> Option<u32>

Source§

fn get_trader_id_from_index(&self, trader_index: u32) -> MarketTraderId

Source§

fn get_book( &self, side: Side, ) -> &dyn OrderedNodeAllocatorMap<FIFOOrderId, FIFORestingOrder>

Source§

fn get_ladder(&self, levels: u64) -> Ladder

Source§

fn get_ladder_with_expiration( &self, levels: u64, last_valid_slot: Option<u64>, last_valid_unix_timestamp_in_seconds: Option<u64>, ) -> Ladder

Source§

fn get_typed_ladder(&self, levels: u64) -> TypedLadder

Source§

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 Ord for FIFOOrderId

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl OrderId for FIFOOrderId

Source§

impl PartialEq for FIFOOrderId

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for FIFOOrderId

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Zeroable for FIFOOrderId

Source§

fn zeroed() -> Self

Source§

impl Copy for FIFOOrderId

Source§

impl Eq for FIFOOrderId

Source§

impl Pod for FIFOOrderId

Source§

impl StructuralPartialEq for FIFOOrderId

Auto Trait Implementations§

Blanket Implementations§

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<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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 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> AnyBitPattern for T
where T: Pod,

Source§

impl<T> NoUninit for T
where T: Pod,