Skip to main content

insert_bid

Function insert_bid 

Source
pub fn insert_bid(levels: &mut Vec<PriceLevel>, level: PriceLevel)
Expand description

Insert a price level into a bid-sorted (descending) list. Uses push + sort_unstable for prediction market books (typically < 100 levels). sort_unstable avoids the allocation of a merge-sort buffer and is faster on small, nearly-sorted arrays than Vec::insert’s O(n) memcpy shift.