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

Function get_concurrent_sides

crates/openquant/src/bet_sizing.rs:384–405  ·  view source on GitHub ↗
(
    t1: &[(NaiveDateTime, NaiveDateTime)],
    side: &[f64],
)

Source from the content-addressed store, hash-verified

382}
383
384pub fn get_concurrent_sides(
385 t1: &[(NaiveDateTime, NaiveDateTime)],
386 side: &[f64],
387) -> Vec<(NaiveDateTime, f64, f64)> {
388 // returns (index, active_long, active_short)
389 let mut out = Vec::new();
390 for (start, _end) in t1.iter() {
391 let mut long = 0.0;
392 let mut short = 0.0;
393 for (j, (s, e)) in t1.iter().enumerate() {
394 if *s <= *start && *e > *start {
395 if side[j] > 0.0 {
396 long += 1.0;
397 } else {
398 short += 1.0;
399 }
400 }
401 }
402 out.push((*start, long, short));
403 }
404 out
405}
406
407pub fn bet_size_budget(
408 t1: &[(NaiveDateTime, NaiveDateTime)],

Callers 5

bet_size_budgetFunction · 0.85
bet_size_reserve_fullFunction · 0.85

Calls

no outgoing calls

Tested by 1