Skip to main content

L1

Struct L1 

Source
pub struct L1 {
    pub lmp: Option<u64>,
    pub bid_head: Option<u64>,
    pub ask_head: Option<u64>,
    pub limit_buy_slippage_limit: Option<u64>,
    pub limit_sell_slippage_limit: Option<u64>,
    pub market_buy_slippage_limit: Option<u64>,
    pub market_sell_slippage_limit: Option<u64>,
}

Fields§

§lmp: Option<u64>

Last match price

§bid_head: Option<u64>

Head of the bid list

§ask_head: Option<u64>

Head of the ask list

§limit_buy_slippage_limit: Option<u64>

Slippage limit for limit buy orders in 8 decimals

§limit_sell_slippage_limit: Option<u64>

Slippage limit for limit sell orders in 8 decimals

§market_buy_slippage_limit: Option<u64>

Slippage limit for market buy orders in 8 decimals

§market_sell_slippage_limit: Option<u64>

Slippage limit for market sell orders in 8 decimals

Implementations§

Source§

impl L1

Source

pub fn new() -> Self

Source

pub fn new_with_slippage( lmp: Option<u64>, bid_head: Option<u64>, ask_head: Option<u64>, limit_buy_slippage_limit: Option<u64>, limit_sell_slippage_limit: Option<u64>, market_buy_slippage_limit: Option<u64>, market_sell_slippage_limit: Option<u64>, ) -> Self

Source

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

Source

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

Source

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

Source

pub fn set_lmp(&mut self, price: u64)

Source

pub fn set_ask_head(&mut self, price: u64)

Source

pub fn set_bid_head(&mut self, price: u64)

Source

pub fn set_limit_buy_slippage_limit(&mut self, slippage_limit: Option<u64>)

Set the slippage limit for limit buy orders

Source

pub fn set_limit_sell_slippage_limit(&mut self, slippage_limit: Option<u64>)

Set the slippage limit for limit sell orders

Source

pub fn set_market_buy_slippage_limit(&mut self, slippage_limit: Option<u64>)

Set the slippage limit for market buy orders

Source

pub fn set_market_sell_slippage_limit(&mut self, slippage_limit: Option<u64>)

Set the slippage limit for market sell orders

Source

pub fn det_limit_sell_make_price( &self, lp: u64, bid_head: u64, ask_head: u64, spread: u32, ) -> u64

Determine the maker price for a limit sell order This function calculates the price at which a limit sell order should be placed as a maker order based on current market conditions, limit price, and spread.

  • lp: Limit price specified by the user
  • bid_head: Current best bid price (0 if no bids)
  • ask_head: Current best ask price (0 if no asks)
  • spread: Spread in basis points (10000 = 100%)
  • Returns the calculated maker price and lmp tuple
Source

pub fn det_limit_buy_make_price( &self, lp: u64, bid_head: u64, ask_head: u64, spread: u32, ) -> u64

Determine the maker price for a limit buy order This function calculates the price at which a limit buy order should be placed as a maker order based on current market conditions, limit price, and spread.

  • lp: Limit price specified by the user
  • bid_head: Current best bid price (0 if no bids)
  • ask_head: Current best ask price (0 if no asks)
  • spread: Spread in basis points (10000 = 100%)
  • Returns the calculated maker price and lmp tuple
Source

pub fn det_market_buy_make_price( &self, bid_head: u64, ask_head: u64, spread: u32, ) -> u64

Determine the maker price for a market buy order This function calculates the price at which a market buy order should be placed as a maker order based on current market conditions (bid_head, ask_head, lmp) and spread.

  • bid_head: Current best bid price (0 if no bids)
  • ask_head: Current best ask price (0 if no asks)
  • spread: Spread in basis points (10000 = 100%)
  • Returns the calculated maker price
Source

pub fn det_market_sell_make_price( &self, bid_head: u64, ask_head: u64, spread: u32, ) -> u64

Determine the maker price for a market sell order This function calculates the price at which a market sell order should be placed as a maker order based on current market conditions (bid_head, ask_head, lmp) and spread.

  • bid_head: Current best bid price (0 if no bids)
  • ask_head: Current best ask price (0 if no asks)
  • spread: Spread in basis points (10000 = 100%)
  • Returns the calculated maker price (minimum 1 to prevent zero price)

Trait Implementations§

Source§

impl Clone for L1

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for L1

Source§

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

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

impl Default for L1

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for L1

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for L1

Source§

impl PartialEq for L1

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for L1

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for L1

Auto Trait Implementations§

§

impl Forget for L1

§

impl Freeze for L1

§

impl RefUnwindSafe for L1

§

impl Send for L1

§

impl Sync for L1

§

impl Unpin for L1

§

impl UnsafeUnpin for L1

§

impl UnwindSafe for L1

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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