移除回测兼容语义残留
This commit is contained in:
@@ -58,7 +58,7 @@ fn single_day_anchor_data(date: NaiveDate) -> DataSet {
|
||||
ask1: 10.0,
|
||||
prev_close: 9.9,
|
||||
volume: 1_000_000,
|
||||
tick_volume: 1_000_000,
|
||||
minute_volume: 1_000_000,
|
||||
bid1_volume: 1_000_000,
|
||||
ask1_volume: 1_000_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -116,7 +116,7 @@ fn market_row(date: NaiveDate, symbol: &str, open: f64, close: f64) -> DailyMark
|
||||
ask1: close,
|
||||
prev_close: open,
|
||||
volume: 1_000_000,
|
||||
tick_volume: 1_000_000,
|
||||
minute_volume: 1_000_000,
|
||||
bid1_volume: 1_000_000,
|
||||
ask1_volume: 1_000_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -627,7 +627,7 @@ struct UniverseDirectiveStrategy {
|
||||
snapshots: Rc<RefCell<Vec<String>>>,
|
||||
}
|
||||
|
||||
struct TickProbeStrategy {
|
||||
struct MinuteProbeStrategy {
|
||||
seen_ticks: Rc<RefCell<Vec<String>>>,
|
||||
ordered: bool,
|
||||
}
|
||||
@@ -797,7 +797,7 @@ impl Strategy for UniverseDirectiveStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
impl Strategy for TickProbeStrategy {
|
||||
impl Strategy for MinuteProbeStrategy {
|
||||
fn name(&self) -> &str {
|
||||
"minute-probe"
|
||||
}
|
||||
@@ -883,13 +883,13 @@ impl Strategy for DataApiProbeStrategy {
|
||||
.map(|value| format!("{value:.2}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join(",");
|
||||
let tick_last = ctx
|
||||
let minute_last = ctx
|
||||
.history_bars("000001.SZ", 2, "1m", "last", true)
|
||||
.iter()
|
||||
.map(|value| format!("{value:.2}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join(",");
|
||||
let previous_tick_last = ctx
|
||||
let previous_minute_last = ctx
|
||||
.history_bars("000001.SZ", 2, "1m", "last", false)
|
||||
.iter()
|
||||
.map(|value| format!("{value:.2}"))
|
||||
@@ -930,7 +930,7 @@ impl Strategy for DataApiProbeStrategy {
|
||||
ctx.instruments_history(&["000001.SZ", "000002.SZ"]).len();
|
||||
let active_instrument_count = ctx.active_instruments(&["000001.SZ", "000002.SZ"]).len();
|
||||
self.snapshots.borrow_mut().push(format!(
|
||||
"daily={daily_close};previous={previous_close};minute={tick_last};previous_minute={previous_tick_last};current={current_close};instrument={instrument_name};all={};history={instrument_history_count};active={active_instrument_count};range={trading_date_count};prev={prev_date};next={next_date};suspended={suspended};st={st_flags};price_daily={daily_price_count};price_tick={minute_price_count};minute_frequency={minute_frequency}",
|
||||
"daily={daily_close};previous={previous_close};minute={minute_last};previous_minute={previous_minute_last};current={current_close};instrument={instrument_name};all={};history={instrument_history_count};active={active_instrument_count};range={trading_date_count};prev={prev_date};next={next_date};suspended={suspended};st={st_flags};price_daily={daily_price_count};price_tick={minute_price_count};minute_frequency={minute_frequency}",
|
||||
ctx.all_instruments().len()
|
||||
));
|
||||
}
|
||||
@@ -1056,7 +1056,7 @@ fn engine_runs_strategy_hooks_in_daily_order() {
|
||||
ask1: 10.0,
|
||||
prev_close: 10.0,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -1079,7 +1079,7 @@ fn engine_runs_strategy_hooks_in_daily_order() {
|
||||
ask1: 10.1,
|
||||
prev_close: 10.0,
|
||||
volume: 110_000,
|
||||
tick_volume: 110_000,
|
||||
minute_volume: 110_000,
|
||||
bid1_volume: 110_000,
|
||||
ask1_volume: 110_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -1252,7 +1252,7 @@ fn engine_executes_open_auction_decisions_before_on_day() {
|
||||
ask1: 10.0,
|
||||
prev_close: 10.0,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("open_auction".to_string()),
|
||||
@@ -1351,7 +1351,7 @@ fn engine_executes_futures_order_intents_against_future_account() {
|
||||
ask1: 10.0,
|
||||
prev_close: 9.9,
|
||||
volume: 1_000_000,
|
||||
tick_volume: 1_000_000,
|
||||
minute_volume: 1_000_000,
|
||||
bid1_volume: 1_000_000,
|
||||
ask1_volume: 1_000_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -1915,7 +1915,7 @@ fn strategy_context_exposes_advanced_data_helpers() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn engine_runs_subscribed_tick_hooks_and_executes_tick_orders() {
|
||||
fn engine_runs_minute_hooks_and_executes_minute_orders() {
|
||||
let date = d(2025, 1, 2);
|
||||
let data = DataSet::from_components_with_actions_and_quotes(
|
||||
vec![Instrument {
|
||||
@@ -1941,7 +1941,7 @@ fn engine_runs_subscribed_tick_hooks_and_executes_tick_orders() {
|
||||
ask1: 10.2,
|
||||
prev_close: 10.0,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -2013,7 +2013,7 @@ fn engine_runs_subscribed_tick_hooks_and_executes_tick_orders() {
|
||||
.expect("dataset");
|
||||
|
||||
let seen_ticks = Rc::new(RefCell::new(Vec::new()));
|
||||
let strategy = TickProbeStrategy {
|
||||
let strategy = MinuteProbeStrategy {
|
||||
seen_ticks: seen_ticks.clone(),
|
||||
ordered: false,
|
||||
};
|
||||
@@ -2114,7 +2114,7 @@ fn strategy_context_exposes_engine_native_data_helpers() {
|
||||
ask1: close + 0.01,
|
||||
prev_close,
|
||||
volume,
|
||||
tick_volume: volume,
|
||||
minute_volume: volume,
|
||||
bid1_volume: volume,
|
||||
ask1_volume: volume,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -2285,7 +2285,7 @@ fn strategy_context_exposes_final_order_runtime_view() {
|
||||
ask1: 10.2,
|
||||
prev_close: 10.0,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -2502,7 +2502,7 @@ fn engine_applies_account_cash_flow_and_financing_intents() {
|
||||
ask1: 10.01,
|
||||
prev_close: 9.9,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -2525,7 +2525,7 @@ fn engine_applies_account_cash_flow_and_financing_intents() {
|
||||
ask1: 10.01,
|
||||
prev_close: 10.0,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -2686,7 +2686,7 @@ fn engine_rejects_pending_limit_orders_at_market_close() {
|
||||
ask1: 10.0,
|
||||
prev_close: 10.0,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -2709,7 +2709,7 @@ fn engine_rejects_pending_limit_orders_at_market_close() {
|
||||
ask1: 9.7,
|
||||
prev_close: 10.0,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -2856,7 +2856,7 @@ fn engine_runs_scheduled_rules_for_daily_weekly_and_monthly_triggers() {
|
||||
ask1: 10.0,
|
||||
prev_close: 9.9,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("open_auction".to_string()),
|
||||
@@ -2879,7 +2879,7 @@ fn engine_runs_scheduled_rules_for_daily_weekly_and_monthly_triggers() {
|
||||
ask1: 10.1,
|
||||
prev_close: 10.0,
|
||||
volume: 110_000,
|
||||
tick_volume: 110_000,
|
||||
minute_volume: 110_000,
|
||||
bid1_volume: 110_000,
|
||||
ask1_volume: 110_000,
|
||||
trading_phase: Some("open_auction".to_string()),
|
||||
@@ -2902,7 +2902,7 @@ fn engine_runs_scheduled_rules_for_daily_weekly_and_monthly_triggers() {
|
||||
ask1: 10.2,
|
||||
prev_close: 10.1,
|
||||
volume: 120_000,
|
||||
tick_volume: 120_000,
|
||||
minute_volume: 120_000,
|
||||
bid1_volume: 120_000,
|
||||
ask1_volume: 120_000,
|
||||
trading_phase: Some("open_auction".to_string()),
|
||||
@@ -3105,7 +3105,7 @@ fn engine_dispatches_process_events_to_external_bus_listeners() {
|
||||
ask1: 10.0,
|
||||
prev_close: 9.9,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("open_auction".to_string()),
|
||||
@@ -3128,7 +3128,7 @@ fn engine_dispatches_process_events_to_external_bus_listeners() {
|
||||
ask1: 10.1,
|
||||
prev_close: 10.0,
|
||||
volume: 110_000,
|
||||
tick_volume: 110_000,
|
||||
minute_volume: 110_000,
|
||||
bid1_volume: 110_000,
|
||||
ask1_volume: 110_000,
|
||||
trading_phase: Some("open_auction".to_string()),
|
||||
@@ -3151,7 +3151,7 @@ fn engine_dispatches_process_events_to_external_bus_listeners() {
|
||||
ask1: 10.2,
|
||||
prev_close: 10.1,
|
||||
volume: 120_000,
|
||||
tick_volume: 120_000,
|
||||
minute_volume: 120_000,
|
||||
bid1_volume: 120_000,
|
||||
ask1_volume: 120_000,
|
||||
trading_phase: Some("open_auction".to_string()),
|
||||
@@ -3485,7 +3485,7 @@ fn engine_applies_dynamic_universe_and_subscription_directives() {
|
||||
ask1: 10.01,
|
||||
prev_close: 9.95,
|
||||
volume: 100_000,
|
||||
tick_volume: 5_000,
|
||||
minute_volume: 5_000,
|
||||
bid1_volume: 2_000,
|
||||
ask1_volume: 2_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -3508,7 +3508,7 @@ fn engine_applies_dynamic_universe_and_subscription_directives() {
|
||||
ask1: 20.01,
|
||||
prev_close: 19.95,
|
||||
volume: 100_000,
|
||||
tick_volume: 5_000,
|
||||
minute_volume: 5_000,
|
||||
bid1_volume: 2_000,
|
||||
ask1_volume: 2_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
@@ -3667,7 +3667,7 @@ fn engine_exposes_current_process_context_to_strategies() {
|
||||
ask1: 10.0,
|
||||
prev_close: 9.9,
|
||||
volume: 100_000,
|
||||
tick_volume: 100_000,
|
||||
minute_volume: 100_000,
|
||||
bid1_volume: 100_000,
|
||||
ask1_volume: 100_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
|
||||
Reference in New Issue
Block a user