Skip to main content

get_worst_px_for_quantity

Function get_worst_px_for_quantity 

Source
pub fn get_worst_px_for_quantity(
    qty: Quantity,
    levels: &BTreeMap<BookPrice, BookLevel>,
) -> Option<Price>
Expand description

Calculates the worst (last-touched) price while filling a specified quantity from order book levels.

For buy-side traversal this is the highest ask touched; for sell-side traversal this is the lowest bid touched. Returns None when no quantity can be matched.