test: cover next-open side flips and trim redundant default fields
This commit is contained in:
@@ -37,7 +37,6 @@ impl Strategy for DecisionQuoteReader {
|
||||
self.day_count += 1;
|
||||
if self.day_count == 1 {
|
||||
return Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Value {
|
||||
symbol: "000001.SZ".to_string(),
|
||||
value: 5_000.0,
|
||||
@@ -627,7 +626,6 @@ impl Strategy for MultiTimeDecisionQuoteReader {
|
||||
self.day_count += 1;
|
||||
if self.day_count == 1 {
|
||||
return Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Value {
|
||||
symbol: "000001.SZ".to_string(),
|
||||
value: 5_000.0,
|
||||
|
||||
@@ -416,7 +416,6 @@ impl Strategy for FuturesLimitOrderStrategy {
|
||||
return Ok(StrategyDecision::default());
|
||||
}
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Futures {
|
||||
intent: FuturesOrderIntent::limit_open(
|
||||
"IF2501",
|
||||
@@ -448,7 +447,6 @@ impl Strategy for FuturesInvalidTickLimitStrategy {
|
||||
return Ok(StrategyDecision::default());
|
||||
}
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Futures {
|
||||
intent: FuturesOrderIntent::limit_open(
|
||||
"IF2501",
|
||||
@@ -480,7 +478,6 @@ impl Strategy for FuturesClosedPhaseOrderStrategy {
|
||||
return Ok(StrategyDecision::default());
|
||||
}
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Futures {
|
||||
intent: FuturesOrderIntent::open(
|
||||
"IF2501",
|
||||
@@ -512,7 +509,6 @@ impl Strategy for FuturesAboveUpperLimitStrategy {
|
||||
return Ok(StrategyDecision::default());
|
||||
}
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Futures {
|
||||
intent: FuturesOrderIntent::limit_open(
|
||||
"IF2501",
|
||||
@@ -544,7 +540,6 @@ impl Strategy for FuturesDepthLimitOrderStrategy {
|
||||
return Ok(StrategyDecision::default());
|
||||
}
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Futures {
|
||||
intent: FuturesOrderIntent::limit_open(
|
||||
"IF2501",
|
||||
|
||||
@@ -5014,7 +5014,6 @@ fn broker_ioc_limit_order_fills_available_quantity_and_cancels_remainder() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::LimitShares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5053,7 +5052,6 @@ fn broker_persists_daily_volume_consumption_across_execute_calls() {
|
||||
.with_liquidity_limit(false);
|
||||
let mut portfolio = PortfolioState::new(1_000_000.0);
|
||||
let decision = || StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
quantity: 100,
|
||||
@@ -5101,7 +5099,6 @@ fn broker_persists_quote_depth_until_fresh_level_data_arrives() {
|
||||
.with_liquidity_limit(true);
|
||||
let mut portfolio = PortfolioState::new(1_000_000.0);
|
||||
let decision = |quantity| StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: symbol.to_string(),
|
||||
quantity,
|
||||
@@ -5119,7 +5116,6 @@ fn broker_persists_quote_depth_until_fresh_level_data_arrives() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::Shares {
|
||||
symbol: symbol.to_string(),
|
||||
@@ -5224,7 +5220,6 @@ fn broker_persists_quote_volume_participation_until_next_quote() {
|
||||
.with_liquidity_limit(false);
|
||||
let mut portfolio = PortfolioState::new(1_000_000.0);
|
||||
let decision = |quantity| StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: symbol.to_string(),
|
||||
quantity,
|
||||
@@ -5307,7 +5302,6 @@ fn broker_day_market_order_cancels_remainder_without_creating_invalid_open_order
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::Shares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5349,7 +5343,6 @@ fn broker_fok_order_is_atomic_when_liquidity_is_insufficient() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::Shares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5396,7 +5389,6 @@ fn broker_fok_order_fills_when_full_quantity_is_available() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::Shares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5434,7 +5426,6 @@ fn broker_gtc_limit_order_survives_close_and_fills_next_day() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::LimitShares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5486,7 +5477,6 @@ fn broker_gtc_partial_fills_preserve_cumulative_order_and_commission_state() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::LimitShares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5551,7 +5541,6 @@ fn broker_modifies_gtc_limit_order_without_changing_order_identity() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::LimitShares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5573,7 +5562,6 @@ fn broker_modifies_gtc_limit_order_without_changing_order_identity() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::ModifyOrder {
|
||||
order_id,
|
||||
new_total_quantity: Some(400),
|
||||
@@ -5641,7 +5629,6 @@ fn broker_modifies_partially_filled_gtc_total_and_preserves_commission_state() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::LimitShares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5665,7 +5652,6 @@ fn broker_modifies_partially_filled_gtc_total_and_preserves_commission_state() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::ModifyOrder {
|
||||
order_id,
|
||||
new_total_quantity: Some(200),
|
||||
@@ -5720,7 +5706,6 @@ fn broker_rejected_modify_has_zero_side_effects() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::LimitShares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5744,7 +5729,6 @@ fn broker_rejected_modify_has_zero_side_effects() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::ModifyOrder {
|
||||
order_id,
|
||||
new_total_quantity: Some(100),
|
||||
@@ -5782,7 +5766,6 @@ fn broker_accepted_modify_resets_queue_priority_but_reduction_preserves_it() {
|
||||
);
|
||||
let mut portfolio = PortfolioState::new(1_000_000.0);
|
||||
let create = |reason: &str| StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::LimitShares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
@@ -5813,7 +5796,6 @@ fn broker_accepted_modify_resets_queue_priority_but_reduction_preserves_it() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::ModifyOrder {
|
||||
order_id: initial_ids[0],
|
||||
new_total_quantity: Some(200),
|
||||
@@ -5843,7 +5825,6 @@ fn broker_accepted_modify_resets_queue_priority_but_reduction_preserves_it() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::ModifyOrder {
|
||||
order_id: initial_ids[0],
|
||||
new_total_quantity: None,
|
||||
@@ -5885,7 +5866,6 @@ fn broker_rejects_gtc_for_market_order() {
|
||||
&mut portfolio,
|
||||
&data,
|
||||
&StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::Shares {
|
||||
symbol: "000002.SZ".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user