Skip to main content

Actions

Struct Actions 

Source
pub struct Actions { /* private fields */ }
Expand description

Actions buffer - orders to send.

Implementations§

Source§

impl Actions

Source

pub const fn new() -> Self

Source

pub fn clear(&mut self)

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_full(&self) -> bool

Source

pub fn buy(&mut self, order_id: u64, qty_1e8: i64, px_1e9: u64) -> bool

Place a limit buy order (GTC - Good Till Canceled).

Source

pub fn sell(&mut self, order_id: u64, qty_1e8: i64, px_1e9: u64) -> bool

Place a limit sell order (GTC - Good Till Canceled).

Source

pub fn order( &mut self, order_id: u64, side: i8, qty_1e8: i64, px_1e9: u64, ) -> bool

Place limit order with explicit side (1=buy, -1=sell).

Source

pub fn market_buy(&mut self, order_id: u64, qty_1e8: i64) -> bool

Place a market buy order (fills immediately).

Source

pub fn market_sell(&mut self, order_id: u64, qty_1e8: i64) -> bool

Place a market sell order (fills immediately).

Source

pub fn ioc_buy(&mut self, order_id: u64, qty_1e8: i64, px_1e9: u64) -> bool

Place IOC buy - fills available liquidity, cancels unfilled portion.

Source

pub fn ioc_sell(&mut self, order_id: u64, qty_1e8: i64, px_1e9: u64) -> bool

Place IOC sell - fills available liquidity, cancels unfilled portion.

Source

pub fn fok_buy(&mut self, order_id: u64, qty_1e8: i64, px_1e9: u64) -> bool

Place FOK buy - must fill entire quantity or rejected.

Source

pub fn fok_sell(&mut self, order_id: u64, qty_1e8: i64, px_1e9: u64) -> bool

Place FOK sell - must fill entire quantity or rejected.

Source

pub fn post_only_buy( &mut self, order_id: u64, qty_1e8: i64, px_1e9: u64, ) -> bool

Place a post-only buy order (maker only, rejected if would cross).

Source

pub fn post_only_sell( &mut self, order_id: u64, qty_1e8: i64, px_1e9: u64, ) -> bool

Place a post-only sell order (maker only, rejected if would cross).

Source

pub fn order_typed( &mut self, order_id: u64, side: i8, qty_1e8: i64, px_1e9: u64, order_type: u8, ) -> bool

Place order with explicit type.

Source

pub fn cancel(&mut self, order_id: u64) -> bool

Cancel an order.

Source

pub fn cancel_all(&mut self, state: &AlgoState)

Cancel all open orders.

Source

pub fn amend( &mut self, order_id: u64, new_qty_1e8: i64, new_px_1e9: u64, ) -> bool

Amend an existing order’s price and/or quantity.

Uses is_cancel = ACTION_AMEND (2). The venue performs an atomic edit — the order keeps its ID and (when only qty decreases) its queue position.

Returns false if the actions buffer is full.

Source

pub fn amend_on( &mut self, venue_id: u8, order_id: u64, new_qty_1e8: i64, new_px_1e9: u64, ) -> bool

Amend an existing order on a specific venue.

Source

pub fn buy_on( &mut self, venue_id: u8, order_id: u64, qty_1e8: i64, px_1e9: u64, ) -> bool

Place a limit buy on a specific venue. venue_id is a VenueId value from NbboSnapshot.venue_ids[].

Source

pub fn sell_on( &mut self, venue_id: u8, order_id: u64, qty_1e8: i64, px_1e9: u64, ) -> bool

Place a limit sell on a specific venue.

Source

pub fn ioc_buy_on( &mut self, venue_id: u8, order_id: u64, qty_1e8: i64, px_1e9: u64, ) -> bool

Place an IOC buy on a specific venue.

Source

pub fn ioc_sell_on( &mut self, venue_id: u8, order_id: u64, qty_1e8: i64, px_1e9: u64, ) -> bool

Place an IOC sell on a specific venue.

Source

pub fn order_on_venue( &mut self, venue_id: u8, order_id: u64, side: i8, qty_1e8: i64, px_1e9: u64, order_type: u8, ) -> bool

Place a venue-targeted order with explicit side and order type. Used by the runtime to replay actions read from WASM memory.

Source

pub fn clear_at(&mut self, idx: usize)

Zero out an action at index (marks as no-op). Used by risk engine to neutralize rejected actions in-place.

Source

pub fn get(&self, idx: usize) -> Option<&Action>

Source

pub fn iter(&self) -> impl Iterator<Item = &Action>

Trait Implementations§

Source§

impl Default for Actions

Source§

fn default() -> Self

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

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