修正涨停卖出挂起语义
This commit is contained in:
@@ -2628,19 +2628,12 @@ impl PlatformExprStrategy {
|
||||
symbol: &str,
|
||||
execution_time: NaiveTime,
|
||||
) -> Result<bool, BacktestError> {
|
||||
if !self.config.delayed_limit_open_exit_enabled {
|
||||
if !self.config.delayed_limit_open_exit_enabled
|
||||
|| !self.pending_highlimit_holdings.contains(symbol)
|
||||
{
|
||||
return Ok(false);
|
||||
}
|
||||
if self.pending_highlimit_holdings.contains(symbol) {
|
||||
return self.pending_highlimit_sell_should_wait(ctx, date, symbol, execution_time);
|
||||
}
|
||||
match self.stock_is_at_upper_limit_at_time(ctx, date, symbol, execution_time)? {
|
||||
Some(true) => {
|
||||
self.pending_highlimit_holdings.insert(symbol.to_string());
|
||||
Ok(true)
|
||||
}
|
||||
Some(false) | None => Ok(false),
|
||||
}
|
||||
self.pending_highlimit_sell_should_wait(ctx, date, symbol, execution_time)
|
||||
}
|
||||
|
||||
fn stock_state_with_factor_date_and_time(
|
||||
@@ -14940,7 +14933,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn platform_aiquant_weak_market_waits_when_intraday_highlimit_reached() {
|
||||
fn platform_aiquant_weak_market_sells_upper_limit_when_not_pending() {
|
||||
let prev_date = d(2023, 5, 4);
|
||||
let date = d(2023, 5, 5);
|
||||
let symbol = "600148.SH";
|
||||
@@ -15080,7 +15073,7 @@ mod tests {
|
||||
let decision = strategy.on_day(&ctx).expect("platform decision");
|
||||
|
||||
assert!(
|
||||
!decision.order_intents.iter().any(|intent| matches!(
|
||||
decision.order_intents.iter().any(|intent| matches!(
|
||||
intent,
|
||||
OrderIntent::Shares {
|
||||
symbol: intent_symbol,
|
||||
@@ -15093,7 +15086,7 @@ mod tests {
|
||||
"{:?}",
|
||||
decision.order_intents
|
||||
);
|
||||
assert!(strategy.pending_highlimit_holdings.contains(symbol));
|
||||
assert!(!strategy.pending_highlimit_holdings.contains(symbol));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user