Skip to main content

resolve_position_idx

Function resolve_position_idx 

Source
pub fn resolve_position_idx(
    position_mode: Option<BybitPositionMode>,
    order_side: BybitOrderSide,
    is_reduce_only: bool,
    manual_override: Option<BybitPositionIdx>,
) -> Option<BybitPositionIdx>
Expand description

Resolves the positionIdx to send with an order under a given position mode.

In hedge mode positionIdx identifies the position being affected (1 = long, 2 = short), not the trade direction. A reduce-only sell closes a long position and a reduce-only buy closes a short position. A manual override always wins.