修正部分延迟卖出槽位计数
This commit is contained in:
@@ -8349,7 +8349,7 @@ impl Strategy for PlatformExprStrategy {
|
|||||||
.portfolio
|
.portfolio
|
||||||
.positions()
|
.positions()
|
||||||
.keys()
|
.keys()
|
||||||
.filter(|symbol| !delayed_sold_symbols.contains(*symbol))
|
.filter(|symbol| !same_day_sold_symbols.contains(*symbol))
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<BTreeSet<_>>();
|
.collect::<BTreeSet<_>>();
|
||||||
let daily_top_up_active = self.config.daily_top_up_enabled
|
let daily_top_up_active = self.config.daily_top_up_enabled
|
||||||
@@ -8739,7 +8739,6 @@ impl Strategy for PlatformExprStrategy {
|
|||||||
self.pending_full_close_symbols.remove(&position.symbol);
|
self.pending_full_close_symbols.remove(&position.symbol);
|
||||||
} else {
|
} else {
|
||||||
exit_symbols.insert(position.symbol.clone());
|
exit_symbols.insert(position.symbol.clone());
|
||||||
slot_blocking_symbols.insert(position.symbol.clone());
|
|
||||||
order_intents.push(OrderIntent::TargetValue {
|
order_intents.push(OrderIntent::TargetValue {
|
||||||
symbol: position.symbol.clone(),
|
symbol: position.symbol.clone(),
|
||||||
target_value: 0.0,
|
target_value: 0.0,
|
||||||
@@ -8774,6 +8773,37 @@ impl Strategy for PlatformExprStrategy {
|
|||||||
} else if stop_hit {
|
} else if stop_hit {
|
||||||
unresolved_stop_loss_symbols.insert(position.symbol.clone());
|
unresolved_stop_loss_symbols.insert(position.symbol.clone());
|
||||||
}
|
}
|
||||||
|
if daily_top_up_active {
|
||||||
|
self.try_daily_top_up_at_position(
|
||||||
|
ctx,
|
||||||
|
&day,
|
||||||
|
&stock_list,
|
||||||
|
decision_date,
|
||||||
|
execution_date,
|
||||||
|
projection_date,
|
||||||
|
selection_factor_date,
|
||||||
|
signal_date,
|
||||||
|
daily_top_up_target_budget,
|
||||||
|
selection_limit,
|
||||||
|
defer_execution_risk,
|
||||||
|
Some(position.symbol.as_str()),
|
||||||
|
&mut projected,
|
||||||
|
&mut projected_execution_state,
|
||||||
|
&mut order_intents,
|
||||||
|
&mut aiquant_available_cash,
|
||||||
|
&mut slot_working_symbols,
|
||||||
|
&mut same_bar_buy_symbols,
|
||||||
|
&pending_full_close_symbols,
|
||||||
|
&slot_blocking_symbols,
|
||||||
|
&same_day_sold_symbols,
|
||||||
|
&exit_symbols,
|
||||||
|
&delayed_sold_symbols,
|
||||||
|
&mut intraday_attempted_buys,
|
||||||
|
&mut daily_top_up_pending_buy_value,
|
||||||
|
debug_daily_top_up,
|
||||||
|
&mut daily_top_up_debug_notes,
|
||||||
|
)?;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21802,7 +21832,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn platform_aiquant_carried_full_close_does_not_release_new_top_up_slot() {
|
fn platform_aiquant_carried_full_close_releases_slot_when_flat() {
|
||||||
let prev_date = d(2025, 4, 29);
|
let prev_date = d(2025, 4, 29);
|
||||||
let date = d(2025, 4, 30);
|
let date = d(2025, 4, 30);
|
||||||
let buy_first = "000001.SZ";
|
let buy_first = "000001.SZ";
|
||||||
@@ -21986,12 +22016,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
top_up_symbols,
|
top_up_symbols,
|
||||||
vec![buy_first],
|
vec![buy_first, buy_second],
|
||||||
"{:?}",
|
|
||||||
decision.order_intents
|
|
||||||
);
|
|
||||||
assert!(
|
|
||||||
!top_up_symbols.contains(&buy_second),
|
|
||||||
"{:?}",
|
"{:?}",
|
||||||
decision.order_intents
|
decision.order_intents
|
||||||
);
|
);
|
||||||
@@ -22594,7 +22619,7 @@ mod tests {
|
|||||||
decision.order_intents
|
decision.order_intents
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
decision.order_intents.iter().any(|intent| matches!(
|
!decision.order_intents.iter().any(|intent| matches!(
|
||||||
intent,
|
intent,
|
||||||
OrderIntent::Value {
|
OrderIntent::Value {
|
||||||
symbol,
|
symbol,
|
||||||
|
|||||||
Reference in New Issue
Block a user