MCPcopy Create free account
hub / github.com/Open-Quant/openquant / bet_size_dynamic

Function bet_size_dynamic

crates/openquant/src/bet_sizing.rs:356–363  ·  view source on GitHub ↗
(
    pos: &[f64],
    max_pos: &[f64],
    m_p: &[f64],
    f: &[f64],
)

Source from the content-addressed store, hash-verified

354}
355
356/// Calibrates the curve width `w` so that divergence `price_div` gives size `m_bet_size`.
357///
358/// Dispatches to [`get_w_sigmoid`] or [`get_w_power`].
359///
360/// # Errors
361///
362/// - [`BetSizingError::InvalidFunction`] if `func` is not `"sigmoid"` or `"power"`.
363/// - [`BetSizingError::PriceDivergenceOutOfRange`] from [`get_w_power`].
364pub fn get_w(price_div: f64, m_bet_size: f64, func: &str) -> Result<f64, BetSizingError> {
365 match func {
366 "sigmoid" => Ok(get_w_sigmoid(price_div, m_bet_size)),

Callers 1

test_bet_size_dynamicFunction · 0.85

Calls 1

bet_size_dynamic_checkedFunction · 0.85

Tested by 1

test_bet_size_dynamicFunction · 0.68