feat: add decision-scoped buy denials to broker submission
This commit is contained in:
@@ -4856,6 +4856,7 @@ 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,
|
||||
@@ -4896,6 +4897,7 @@ 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,
|
||||
@@ -4955,6 +4957,7 @@ 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,
|
||||
@@ -4992,6 +4995,7 @@ mod tests {
|
||||
return Ok(StrategyDecision::default());
|
||||
}
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -5028,6 +5032,7 @@ 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,
|
||||
@@ -5070,6 +5075,7 @@ mod tests {
|
||||
Vec::new()
|
||||
};
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents,
|
||||
..StrategyDecision::default()
|
||||
})
|
||||
@@ -5106,6 +5112,7 @@ mod tests {
|
||||
return Ok(StrategyDecision::default());
|
||||
};
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol,
|
||||
quantity: 100,
|
||||
@@ -5166,6 +5173,7 @@ mod tests {
|
||||
.unwrap_or_default()
|
||||
));
|
||||
Ok(StrategyDecision {
|
||||
buy_denials: Default::default(),
|
||||
order_intents: vec![OrderIntent::Shares {
|
||||
symbol: SYMBOL.to_string(),
|
||||
quantity: 100,
|
||||
@@ -5206,6 +5214,7 @@ 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,
|
||||
@@ -5217,6 +5226,7 @@ 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),
|
||||
@@ -5256,6 +5266,7 @@ 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,
|
||||
@@ -5267,6 +5278,7 @@ 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