为执行报价预取测试补齐明确证券生命周期

This commit is contained in:
boris
2026-09-10 22:18:50 +08:00
parent d01f32ca5b
commit 7d05f8f7c7
@@ -2,7 +2,7 @@ use chrono::{Duration, NaiveDate, NaiveTime};
use fidc_core::{ use fidc_core::{
BacktestConfig, BacktestEngine, BenchmarkSnapshot, BrokerSimulator, CandidateEligibility, BacktestConfig, BacktestEngine, BenchmarkSnapshot, BrokerSimulator, CandidateEligibility,
ChinaAShareCostModel, ChinaEquityRuleHooks, DailyFactorSnapshot, DailyMarketSnapshot, DataSet, ChinaAShareCostModel, ChinaEquityRuleHooks, DailyFactorSnapshot, DailyMarketSnapshot, DataSet,
IntradayExecutionQuote, MatchingType, OrderIntent, PriceField, Strategy, StrategyContext, Instrument, IntradayExecutionQuote, MatchingType, OrderIntent, PriceField, Strategy, StrategyContext,
StrategyDecision, StrategyDecision,
}; };
use std::collections::{BTreeMap, BTreeSet}; 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") NaiveTime::from_hms_opt(hour, minute, second).expect("valid time")
} }
fn fixture_instruments() -> Vec<Instrument> {
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)] #[derive(Default)]
struct DecisionQuoteReader { struct DecisionQuoteReader {
day_count: usize, day_count: usize,
@@ -90,7 +102,7 @@ impl Strategy for NoLoaderDecisionQuoteStrategy {
fn single_day_quote_plan_data(date: NaiveDate) -> DataSet { fn single_day_quote_plan_data(date: NaiveDate) -> DataSet {
DataSet::from_components( DataSet::from_components(
Vec::new(), fixture_instruments(),
vec![DailyMarketSnapshot { vec![DailyMarketSnapshot {
date, date,
symbol: "000001.SZ".to_string(), 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 first = d(2026, 1, 5);
let second = d(2026, 1, 6); let second = d(2026, 1, 6);
let data = DataSet::from_components( let data = DataSet::from_components(
Vec::new(), fixture_instruments(),
vec![ vec![
DailyMarketSnapshot { DailyMarketSnapshot {
date: first, date: first,
@@ -423,7 +435,7 @@ fn engine_reuses_preloaded_decision_quotes_without_loader_call() {
let first = d(2026, 1, 5); let first = d(2026, 1, 5);
let second = d(2026, 1, 6); let second = d(2026, 1, 6);
let data = DataSet::from_components_with_actions_and_quotes( let data = DataSet::from_components_with_actions_and_quotes(
Vec::new(), fixture_instruments(),
vec![ vec![
DailyMarketSnapshot { DailyMarketSnapshot {
date: first, date: first,
@@ -658,7 +670,7 @@ fn engine_loads_distinct_decision_quote_times_on_same_day() {
let first = d(2026, 1, 5); let first = d(2026, 1, 5);
let second = d(2026, 1, 6); let second = d(2026, 1, 6);
let data = DataSet::from_components( let data = DataSet::from_components(
Vec::new(), fixture_instruments(),
vec![ vec![
DailyMarketSnapshot { DailyMarketSnapshot {
date: first, date: first,