From 7d05f8f7c75627f949b035610a5564cdab041b5c Mon Sep 17 00:00:00 2001 From: boris Date: Thu, 10 Sep 2026 22:18:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=89=A7=E8=A1=8C=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E9=A2=84=E5=8F=96=E6=B5=8B=E8=AF=95=E8=A1=A5=E9=BD=90=E6=98=8E?= =?UTF-8?q?=E7=A1=AE=E8=AF=81=E5=88=B8=E7=94=9F=E5=91=BD=E5=91=A8=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fidc-core/tests/decision_quote_preload.rs | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/crates/fidc-core/tests/decision_quote_preload.rs b/crates/fidc-core/tests/decision_quote_preload.rs index fc06c99..e08db24 100644 --- a/crates/fidc-core/tests/decision_quote_preload.rs +++ b/crates/fidc-core/tests/decision_quote_preload.rs @@ -2,7 +2,7 @@ use chrono::{Duration, NaiveDate, NaiveTime}; use fidc_core::{ BacktestConfig, BacktestEngine, BenchmarkSnapshot, BrokerSimulator, CandidateEligibility, ChinaAShareCostModel, ChinaEquityRuleHooks, DailyFactorSnapshot, DailyMarketSnapshot, DataSet, - IntradayExecutionQuote, MatchingType, OrderIntent, PriceField, Strategy, StrategyContext, + Instrument, IntradayExecutionQuote, MatchingType, OrderIntent, PriceField, Strategy, StrategyContext, StrategyDecision, }; use std::collections::{BTreeMap, BTreeSet}; @@ -16,6 +16,18 @@ fn t(hour: u32, minute: u32, second: u32) -> NaiveTime { NaiveTime::from_hms_opt(hour, minute, second).expect("valid time") } +fn fixture_instruments() -> Vec { + vec![Instrument { + symbol: "000001.SZ".to_string(), + name: "quote-plan-fixture".to_string(), + board: "SZ".to_string(), + round_lot: 100, + listed_at: Some(d(2020, 1, 1)), + delisted_at: None, + status: "active".to_string(), + }] +} + #[derive(Default)] struct DecisionQuoteReader { day_count: usize, @@ -90,7 +102,7 @@ impl Strategy for NoLoaderDecisionQuoteStrategy { fn single_day_quote_plan_data(date: NaiveDate) -> DataSet { DataSet::from_components( - Vec::new(), + fixture_instruments(), vec![DailyMarketSnapshot { date, symbol: "000001.SZ".to_string(), @@ -253,7 +265,7 @@ fn engine_preloads_declared_decision_quotes_for_current_positions() { let first = d(2026, 1, 5); let second = d(2026, 1, 6); let data = DataSet::from_components( - Vec::new(), + fixture_instruments(), vec![ DailyMarketSnapshot { date: first, @@ -423,7 +435,7 @@ fn engine_reuses_preloaded_decision_quotes_without_loader_call() { let first = d(2026, 1, 5); let second = d(2026, 1, 6); let data = DataSet::from_components_with_actions_and_quotes( - Vec::new(), + fixture_instruments(), vec![ DailyMarketSnapshot { date: first, @@ -658,7 +670,7 @@ fn engine_loads_distinct_decision_quote_times_on_same_day() { let first = d(2026, 1, 5); let second = d(2026, 1, 6); let data = DataSet::from_components( - Vec::new(), + fixture_instruments(), vec![ DailyMarketSnapshot { date: first,