移除回测兼容语义残留

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
+4 -4
View File
@@ -42,7 +42,7 @@ fn snapshot(open: f64, upper_limit: f64, lower_limit: f64) -> DailyMarketSnapsho
ask1: open,
prev_close: 10.0,
volume: 1_000_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 50_000,
ask1_volume: 50_000,
trading_phase: Some("continuous".to_string()),
@@ -67,8 +67,8 @@ fn china_cost_model_applies_minimum_commission_and_stamp_tax() {
}
#[test]
fn aiquant_rqalpha_cost_model_matches_alv_run_options() {
let model = ChinaAShareCostModel::aiquant_rqalpha_default();
fn aiquant_cost_model_matches_alv_run_options() {
let model = ChinaAShareCostModel::aiquant_default();
let buy = model.calculate(d(2026, 5, 19), OrderSide::Buy, 49_978.84);
assert!((buy.commission - 12.49471).abs() < 1e-9);
@@ -260,7 +260,7 @@ fn china_rule_hooks_allow_sell_when_last_price_is_above_lower_limit() {
ask1: 2.53,
prev_close: 2.80,
volume: 1_000_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 50_000,
ask1_volume: 50_000,
trading_phase: Some("continuous".to_string()),
+3 -3
View File
@@ -122,7 +122,7 @@ fn engine_reinvests_dividend_receivable_in_round_lots() {
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()),
@@ -145,7 +145,7 @@ fn engine_reinvests_dividend_receivable_in_round_lots() {
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()),
@@ -168,7 +168,7 @@ fn engine_reinvests_dividend_receivable_in_round_lots() {
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()),
@@ -83,7 +83,7 @@ fn engine_preloads_declared_decision_quotes_for_current_positions() {
ask1: 10.0,
prev_close: 9.8,
volume: 10_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 10_000,
ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()),
@@ -106,7 +106,7 @@ fn engine_preloads_declared_decision_quotes_for_current_positions() {
ask1: 10.6,
prev_close: 10.0,
volume: 10_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 10_000,
ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()),
@@ -249,7 +249,7 @@ fn engine_reuses_preloaded_decision_quotes_without_loader_call() {
ask1: 10.0,
prev_close: 9.8,
volume: 10_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 10_000,
ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()),
@@ -272,7 +272,7 @@ fn engine_reuses_preloaded_decision_quotes_without_loader_call() {
ask1: 10.6,
prev_close: 10.0,
volume: 10_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 10_000,
ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()),
@@ -480,7 +480,7 @@ fn engine_loads_distinct_decision_quote_times_on_same_day() {
ask1: 10.0,
prev_close: 9.8,
volume: 10_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 10_000,
ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()),
@@ -503,7 +503,7 @@ fn engine_loads_distinct_decision_quote_times_on_same_day() {
ask1: 10.6,
prev_close: 10.0,
volume: 10_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 10_000,
ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()),
+6 -6
View File
@@ -81,7 +81,7 @@ fn engine_settles_delisted_position_before_missing_market_snapshot_breaks_run()
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()),
@@ -104,7 +104,7 @@ fn engine_settles_delisted_position_before_missing_market_snapshot_breaks_run()
ask1: 5.01,
prev_close: 5.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()),
@@ -127,7 +127,7 @@ fn engine_settles_delisted_position_before_missing_market_snapshot_breaks_run()
ask1: 5.11,
prev_close: 5.0,
volume: 120_000,
tick_volume: 120_000,
minute_volume: 120_000,
bid1_volume: 120_000,
ask1_volume: 120_000,
trading_phase: Some("continuous".to_string()),
@@ -304,7 +304,7 @@ fn engine_applies_successor_conversion_before_delisted_cash_settlement() {
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()),
@@ -327,7 +327,7 @@ fn engine_applies_successor_conversion_before_delisted_cash_settlement() {
ask1: 20.0,
prev_close: 20.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()),
@@ -350,7 +350,7 @@ fn engine_applies_successor_conversion_before_delisted_cash_settlement() {
ask1: 21.0,
prev_close: 20.0,
volume: 120_000,
tick_volume: 120_000,
minute_volume: 120_000,
bid1_volume: 120_000,
ask1_volume: 120_000,
trading_phase: Some("continuous".to_string()),
+29 -29
View File
@@ -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()),
+40 -40
View File
@@ -32,7 +32,7 @@ fn order_value_rounding_data(date: NaiveDate, symbol: &str, price: f64) -> DataS
ask1: price,
prev_close: price,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -137,7 +137,7 @@ fn broker_executes_explicit_order_value_buy() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -259,7 +259,7 @@ fn broker_order_value_budget_includes_buy_commission() {
}
#[test]
fn broker_delayed_limit_open_sell_uses_tick_price() {
fn broker_delayed_limit_open_sell_uses_minute_price() {
let date = NaiveDate::from_ymd_opt(2025, 6, 27).unwrap();
let prev_date = NaiveDate::from_ymd_opt(2025, 6, 26).unwrap();
let symbol = "300635.SZ";
@@ -287,7 +287,7 @@ fn broker_delayed_limit_open_sell_uses_tick_price() {
ask1: 12.40,
prev_close: 13.24,
volume: 329_575,
tick_volume: 10_000,
minute_volume: 10_000,
bid1_volume: 10_000,
ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()),
@@ -419,7 +419,7 @@ fn broker_executes_order_shares_and_order_lots() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -545,7 +545,7 @@ fn broker_executes_target_shares_like_order_to() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -665,7 +665,7 @@ fn broker_executes_target_portfolio_smart_with_custom_prices() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -688,7 +688,7 @@ fn broker_executes_target_portfolio_smart_with_custom_prices() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -845,7 +845,7 @@ fn broker_executes_target_portfolio_smart_with_algo_order_style() {
ask1: 10.21,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -986,7 +986,7 @@ fn broker_executes_order_percent_and_target_percent() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -1107,7 +1107,7 @@ fn broker_uses_day_open_price_for_open_auction_matching() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("open_auction".to_string()),
@@ -1211,7 +1211,7 @@ fn broker_open_auction_uses_auction_volume_without_quote_liquidity() {
ask1: 0.0,
prev_close: 10.0,
volume: 1_000,
tick_volume: 1_000,
minute_volume: 1_000,
bid1_volume: 0,
ask1_volume: 0,
trading_phase: Some("open_auction".to_string()),
@@ -1312,7 +1312,7 @@ fn broker_cancels_buy_when_open_hits_upper_limit() {
ask1: 11.0,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 50_000,
ask1_volume: 50_000,
trading_phase: Some("continuous".to_string()),
@@ -1425,7 +1425,7 @@ fn broker_applies_price_ratio_slippage_on_snapshot_fills() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -1525,7 +1525,7 @@ fn broker_applies_dynamic_slippage_on_snapshot_fills() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -1630,7 +1630,7 @@ fn broker_applies_tick_size_slippage_on_intraday_last_fills() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -1748,7 +1748,7 @@ fn broker_rejects_intraday_last_order_without_execution_quotes() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -1855,7 +1855,7 @@ fn broker_executes_intraday_last_on_start_quote_without_trade_delta() {
ask1: 15.21,
prev_close: 15.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -1971,7 +1971,7 @@ fn broker_cancels_market_order_remainder_when_intraday_quote_liquidity_exhausted
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -2073,7 +2073,7 @@ fn broker_cancels_market_order_remainder_when_intraday_quote_liquidity_exhausted
}
#[test]
fn broker_cancels_market_buy_when_tick_has_no_volume() {
fn broker_cancels_market_buy_when_minute_has_no_volume() {
let date = NaiveDate::from_ymd_opt(2024, 1, 10).unwrap();
let data = DataSet::from_components(
vec![Instrument {
@@ -2099,7 +2099,7 @@ fn broker_cancels_market_buy_when_tick_has_no_volume() {
ask1: 10.01,
prev_close: 10.0,
volume: 0,
tick_volume: 0,
minute_volume: 0,
bid1_volume: 0,
ask1_volume: 0,
trading_phase: Some("continuous".to_string()),
@@ -2203,7 +2203,7 @@ fn broker_splits_intraday_quote_fills_and_tracks_commission_by_order() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -2364,7 +2364,7 @@ fn broker_aggregates_intraday_quote_fills_into_vwap_leg() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -2509,7 +2509,7 @@ fn broker_executes_algo_vwap_value_with_time_window() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -2667,7 +2667,7 @@ fn broker_executes_algo_twap_percent_across_window_quotes() {
ask1: 12.01,
prev_close: 12.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -2827,7 +2827,7 @@ fn broker_uses_best_own_price_for_intraday_matching() {
ask1: 10.02,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -2942,7 +2942,7 @@ fn broker_uses_best_counterparty_price_for_intraday_matching() {
ask1: 10.02,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -3070,7 +3070,7 @@ fn rebalance_optimizer_skips_unfunded_buy_when_existing_position_cannot_sell() {
ask1: 9.81,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -3093,7 +3093,7 @@ fn rebalance_optimizer_skips_unfunded_buy_when_existing_position_cannot_sell() {
ask1: 10.11,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -3259,7 +3259,7 @@ fn rebalance_uses_prev_close_for_open_auction_valuation() {
ask1: 20.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()),
@@ -3282,7 +3282,7 @@ fn rebalance_uses_prev_close_for_open_auction_valuation() {
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()),
@@ -3442,7 +3442,7 @@ fn rebalance_optimizer_prioritizes_higher_target_weight_when_cash_is_tight() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -3465,7 +3465,7 @@ fn rebalance_optimizer_prioritizes_higher_target_weight_when_cash_is_tight() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -3617,7 +3617,7 @@ fn broker_uses_board_specific_min_quantity_and_step_size_for_buy_sizing() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -3716,7 +3716,7 @@ fn broker_allows_bjse_quantities_above_minimum_without_round_lot_step() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -3817,7 +3817,7 @@ fn broker_allows_full_odd_lot_sell_when_liquidating_position() {
ask1: 10.01,
prev_close: 10.0,
volume: 10_000,
tick_volume: 1_400,
minute_volume: 1_400,
bid1_volume: 350,
ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()),
@@ -3926,7 +3926,7 @@ fn same_day_sell_then_rebuy_reinserts_position_at_end() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -4063,7 +4063,7 @@ fn two_day_limit_order_data(day1_open: f64, day2_open: f64) -> DataSet {
ask1: day1_open + 0.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -4086,7 +4086,7 @@ fn two_day_limit_order_data(day1_open: f64, day2_open: f64) -> DataSet {
ask1: day2_open + 0.01,
prev_close: day1_open,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),
@@ -4510,7 +4510,7 @@ fn broker_reserves_sellable_quantity_for_open_limit_sells() {
ask1: 10.01,
prev_close: 10.0,
volume: 100_000,
tick_volume: 100_000,
minute_volume: 100_000,
bid1_volume: 80_000,
ask1_volume: 80_000,
trading_phase: Some("continuous".to_string()),