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

Function bet_size_dynamic_checked

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

Source from the content-addressed store, hash-verified

363}
364
365pub fn bet_size_dynamic_checked(
366 pos: &[f64],
367 max_pos: &[f64],
368 m_p: &[f64],
369 f: &[f64],
370) -> Result<Vec<(f64, f64, f64)>, BetSizingError> {
371 let w_param = get_w(10.0, 0.95, "sigmoid");
372 let rows = confirm_and_cast_to_df_checked(pos, max_pos, m_p, f)?;
373 Ok(rows
374 .into_iter()
375 .map(|(p, m, mp, forecast)| {
376 let t_pos = get_target_pos(w_param, forecast, mp, m, "sigmoid");
377 let l_p = limit_price(t_pos, p, forecast, w_param, m, "sigmoid");
378 let b = bet_size(w_param, forecast - mp, "sigmoid");
379 (b, t_pos, l_p)
380 })
381 .collect())
382}
383
384pub fn get_concurrent_sides(
385 t1: &[(NaiveDateTime, NaiveDateTime)],

Callers 2

bet_size_dynamicFunction · 0.85

Calls 5

get_wFunction · 0.85
get_target_posFunction · 0.85
limit_priceFunction · 0.85
bet_sizeFunction · 0.85

Tested by

no test coverage detected