pub fn protection_price_calculate(
price_increment: Price,
order: &OrderAny,
protection_points: u32,
bid: Option<Price>,
ask: Option<Price>,
) -> Result<Price>Expand description
Calculates the protection price for stop limit and stop market orders using best bid or ask price.
Uses integer arithmetic on raw price values to avoid floating-point precision issues.
§Returns
A calculated protection price.
§Errors
Returns an error if:
- the order type is invalid.
- best bid/ask is not provided when required for the order side.