Function trailing_stop_calculate_with_bid_ask

Source
pub fn trailing_stop_calculate_with_bid_ask(
    price_increment: Price,
    trailing_offset_type: TrailingOffsetType,
    side: OrderSideSpecified,
    offset: Decimal,
    bid: Price,
    ask: Price,
) -> Result<Price>
Expand description

Calculates the trailing stop price using bid and ask prices.

§Errors

Returns an error if the offset calculation fails or the offset type is unsupported.

§Panics

Panics if the offset cannot be converted to a float.