(
t1: &[(NaiveDateTime, NaiveDateTime)],
side: &[f64],
)
| 382 | } |
| 383 | |
| 384 | pub 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 | |
| 407 | pub fn bet_size_budget( |
| 408 | t1: &[(NaiveDateTime, NaiveDateTime)], |
no outgoing calls