移除回测兼容语义残留

This commit is contained in:
boris
2026-06-26 13:39:21 +08:00
parent 7f40cfdab0
commit 380c34aa66
15 changed files with 265 additions and 300 deletions
+13 -10
View File
@@ -106,7 +106,7 @@ pub struct DailyMarketSnapshot {
pub ask1: f64,
pub prev_close: f64,
pub volume: u64,
pub tick_volume: u64,
pub minute_volume: u64,
pub bid1_volume: u64,
pub ask1_volume: u64,
pub trading_phase: Option<String>,
@@ -519,7 +519,7 @@ struct SymbolPriceSeries {
bid1s: Vec<f64>,
ask1s: Vec<f64>,
volumes: Vec<u64>,
tick_volumes: Vec<u64>,
minute_volumes: Vec<u64>,
bid1_volumes: Vec<u64>,
ask1_volumes: Vec<u64>,
trading_phases: Vec<Option<String>>,
@@ -557,7 +557,10 @@ impl SymbolPriceSeries {
let bid1s = sorted.iter().map(|row| row.bid1).collect::<Vec<_>>();
let ask1s = sorted.iter().map(|row| row.ask1).collect::<Vec<_>>();
let volumes = sorted.iter().map(|row| row.volume).collect::<Vec<_>>();
let tick_volumes = sorted.iter().map(|row| row.tick_volume).collect::<Vec<_>>();
let minute_volumes = sorted
.iter()
.map(|row| row.minute_volume)
.collect::<Vec<_>>();
let bid1_volumes = sorted.iter().map(|row| row.bid1_volume).collect::<Vec<_>>();
let ask1_volumes = sorted.iter().map(|row| row.ask1_volume).collect::<Vec<_>>();
let trading_phases = sorted
@@ -592,7 +595,7 @@ impl SymbolPriceSeries {
bid1s,
ask1s,
volumes,
tick_volumes,
minute_volumes,
bid1_volumes,
ask1_volumes,
trading_phases,
@@ -816,7 +819,7 @@ impl SymbolPriceSeries {
ask1: self.ask1s[index],
prev_close: self.prev_closes[index],
volume: self.volumes[index],
tick_volume: self.tick_volumes[index],
minute_volume: self.minute_volumes[index],
bid1_volume: self.bid1_volumes[index],
ask1_volume: self.ask1_volumes[index],
trading_phase: self.trading_phases[index].clone(),
@@ -837,7 +840,7 @@ impl SymbolPriceSeries {
"last" | "last_price" => Some(self.last_prices[index]),
"prev_close" | "pre_close" => Some(self.prev_closes[index]),
"volume" => Some(self.volumes[index] as f64),
"tick_volume" => Some(self.tick_volumes[index] as f64),
"minute_volume" => Some(self.minute_volumes[index] as f64),
"bid1" => Some(self.bid1s[index]),
"ask1" => Some(self.ask1s[index]),
"bid1_volume" => Some(self.bid1_volumes[index] as f64),
@@ -2695,7 +2698,7 @@ fn read_market(path: &Path) -> Result<Vec<DailyMarketSnapshot>, DataSetError> {
ask1: row.parse_optional_f64(14).unwrap_or(close),
prev_close,
volume: row.parse_u64(7)?,
tick_volume: row.parse_optional_u64(17).unwrap_or_default(),
minute_volume: row.parse_optional_u64(17).unwrap_or_default(),
bid1_volume: row.parse_optional_u64(18).unwrap_or_default(),
ask1_volume: row.parse_optional_u64(19).unwrap_or_default(),
trading_phase: row
@@ -3727,7 +3730,7 @@ mod tests {
ask1: prev_close,
prev_close,
volume,
tick_volume: 0,
minute_volume: 0,
bid1_volume: 0,
ask1_volume: 0,
trading_phase: None,
@@ -3915,7 +3918,7 @@ mod tests {
ask1: prev_close,
prev_close,
volume: 100_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 1_000,
ask1_volume: 1_000,
trading_phase: Some("continuous".to_string()),
@@ -3995,7 +3998,7 @@ mod tests {
ask1: 10.0,
prev_close: 10.0,
volume: 100_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 1_000,
ask1_volume: 1_000,
trading_phase: Some("continuous".to_string()),