Skip to main content

compute_size

Function compute_size 

Source
pub fn compute_size(
    policy: &SizingPolicy,
    risk_multiplier: f64,
    balance_before: f64,
    side: Side,
    entry_price: f64,
    protective_stop: Option<f64>,
    spec: &SymbolSpec,
    account_loss_per_lot: Option<f64>,
) -> Result<SizingResult, SizingError>
Expand description

Compute one in-place account position size.

balance_before is the realized account balance immediately before the entry. entry_price and protective_stop are authoritative resolved prices. Monetary policies require account_loss_per_lot to be converted to account currency by the caller. Fixed-lot sizing ignores balance_before and account_loss_per_lot, and it may omit the protective stop.