Format related strategy and test files
This commit is contained in:
@@ -178,11 +178,7 @@ impl CnSmallCapRotationStrategy {
|
||||
let (sum, count) = window.fold((0.0, 0usize), |(sum, count), value| {
|
||||
(sum + value, count + 1)
|
||||
});
|
||||
if count == 0 {
|
||||
0.0
|
||||
} else {
|
||||
sum / count as f64
|
||||
}
|
||||
if count == 0 { 0.0 } else { sum / count as f64 }
|
||||
}
|
||||
|
||||
fn gross_exposure(&self, closes: &[f64]) -> f64 {
|
||||
@@ -332,7 +328,7 @@ impl Strategy for CnSmallCapRotationStrategy {
|
||||
order_intents: Vec::new(),
|
||||
notes: vec![format!("warmup: {}", message)],
|
||||
diagnostics: vec![
|
||||
"insufficient history; skip trading on warmup dates".to_string()
|
||||
"insufficient history; skip trading on warmup dates".to_string(),
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -628,11 +624,7 @@ impl JqMicroCapStrategy {
|
||||
0
|
||||
} else {
|
||||
let next = quantity.saturating_sub(order_step_size.max(1));
|
||||
if next < minimum {
|
||||
0
|
||||
} else {
|
||||
next
|
||||
}
|
||||
if next < minimum { 0 } else { next }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1538,7 +1530,7 @@ impl Strategy for JqMicroCapStrategy {
|
||||
order_intents: Vec::new(),
|
||||
notes: vec![format!("warmup: {}", message)],
|
||||
diagnostics: vec![
|
||||
"insufficient history; skip trading on warmup dates".to_string()
|
||||
"insufficient history; skip trading on warmup dates".to_string(),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user