test: cover next-open side flips and trim redundant default fields
This commit is contained in:
@@ -4856,7 +4856,6 @@ mod tests {
|
||||
) -> Result<StrategyDecision, super::BacktestError> {
|
||||
if ctx.decision_date == self.decision_date && ctx.portfolio.position(SYMBOL).is_none() {
|
||||
return Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -4897,7 +4896,6 @@ mod tests {
|
||||
);
|
||||
if ctx.portfolio.position(SYMBOL).is_none() {
|
||||
return Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -4957,7 +4955,6 @@ mod tests {
|
||||
rule: &ScheduleRule,
|
||||
) -> Result<StrategyDecision, super::BacktestError> {
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -4995,7 +4992,6 @@ mod tests {
|
||||
return Ok(StrategyDecision::default());
|
||||
}
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -5032,7 +5028,6 @@ mod tests {
|
||||
return Ok(StrategyDecision::default());
|
||||
}
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::TargetPortfolioSmart {
|
||||
target_weights: self.target_weights.clone(),
|
||||
order_prices: None,
|
||||
@@ -5075,7 +5070,6 @@ mod tests {
|
||||
Vec::new()
|
||||
};
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents,
|
||||
..StrategyDecision::default()
|
||||
})
|
||||
@@ -5112,7 +5106,6 @@ mod tests {
|
||||
return Ok(StrategyDecision::default());
|
||||
};
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol,
|
||||
quantity: 100,
|
||||
@@ -5173,7 +5166,6 @@ mod tests {
|
||||
.unwrap_or_default()
|
||||
));
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -5214,7 +5206,6 @@ mod tests {
|
||||
&& ctx.portfolio.position(SYMBOL).is_none()
|
||||
{
|
||||
return Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -5226,7 +5217,6 @@ mod tests {
|
||||
if ctx.decision_date == self.sell_decision_date {
|
||||
if let Some(position) = ctx.portfolio.position(SYMBOL) {
|
||||
return Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: -(position.quantity as i32),
|
||||
@@ -5266,7 +5256,6 @@ mod tests {
|
||||
&& ctx.portfolio.position(SYMBOL).is_none()
|
||||
{
|
||||
return Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -5278,7 +5267,6 @@ mod tests {
|
||||
if ctx.decision_date == self.rebuy_decision_date {
|
||||
if let Some(position) = ctx.portfolio.position(SYMBOL) {
|
||||
return Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![
|
||||
OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user