calculate_fixed_risk_position_size

Function calculate_fixed_risk_position_size 

Source
pub fn calculate_fixed_risk_position_size(
    instrument: InstrumentAny,
    entry: Price,
    stop_loss: Price,
    equity: Money,
    risk: Decimal,
    commission_rate: Decimal,
    exchange_rate: Decimal,
    hard_limit: Option<Decimal>,
    unit_batch_size: Decimal,
    units: usize,
) -> Quantity
Expand description

Calculates the position size based on fixed risk parameters.

ยงPanics

Panics if converting units to a decimal fails, or if converting the final size to f64 fails.