调整next open末日执行测试入口
This commit is contained in:
@@ -4211,34 +4211,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
struct AuctionBuyWhenDecisionDateStrategy {
|
|
||||||
decision_date: NaiveDate,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Strategy for AuctionBuyWhenDecisionDateStrategy {
|
|
||||||
fn name(&self) -> &str {
|
|
||||||
"auction_buy_when_decision_date"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn open_auction(
|
|
||||||
&mut self,
|
|
||||||
ctx: &StrategyContext<'_>,
|
|
||||||
) -> Result<StrategyDecision, super::BacktestError> {
|
|
||||||
if ctx.decision_date == self.decision_date && ctx.portfolio.position(SYMBOL).is_none() {
|
|
||||||
return Ok(StrategyDecision {
|
|
||||||
order_intents: vec![OrderIntent::Shares {
|
|
||||||
symbol: SYMBOL.to_string(),
|
|
||||||
quantity: 100,
|
|
||||||
reason: "auction_test_buy".to_string(),
|
|
||||||
}],
|
|
||||||
..StrategyDecision::default()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Ok(StrategyDecision::default())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct ScheduledBuyStrategy {
|
struct ScheduledBuyStrategy {
|
||||||
rule: ScheduleRule,
|
rule: ScheduleRule,
|
||||||
@@ -4943,8 +4915,9 @@ mod tests {
|
|||||||
|
|
||||||
let result = BacktestEngine::new(
|
let result = BacktestEngine::new(
|
||||||
dataset,
|
dataset,
|
||||||
AuctionBuyWhenDecisionDateStrategy {
|
ScheduledBuyStrategy {
|
||||||
decision_date: second,
|
rule: ScheduleRule::daily("daily_open_signal", ScheduleStage::OpenAuction),
|
||||||
|
expected_decision_date: second,
|
||||||
},
|
},
|
||||||
broker,
|
broker,
|
||||||
config,
|
config,
|
||||||
|
|||||||
Reference in New Issue
Block a user