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