Skip to main content

submit_bracket

Function submit_bracket 

Source
pub fn submit_bracket(
    sim: &mut FillSimulator,
    side: OrderSide,
    quantity: f64,
    entry: OrderKind,
    stop_loss_trigger: f64,
    take_profit_price: f64,
) -> Option<(u64, u64, u64)>
Expand description

Submits a bracket: an entry order plus stop-loss and take-profit exits linked to it as one OCO (“one cancels other”) group. The exits are inactive until the entry actually fills, become active for at most the entry’s filled-but-not-yet-closed quantity (so a partial entry fill cannot be over-closed), and share one capacity budget so that whichever fills first — per FillSimulatorConfig::bracket_intrabar_policy when a single bar touches both — immediately caps the other within the same bar. Callers still get the three order IDs back and may cancel them individually (e.g. to tear down a bracket whose entry never filled).