@@ -8349,7 +8349,7 @@ impl Strategy for PlatformExprStrategy {
|
||||
.portfolio
|
||||
.positions()
|
||||
.keys()
|
||||
.filter(|symbol| !same_day_sold_symbols.contains(*symbol))
|
||||
.filter(|symbol| !delayed_sold_symbols.contains(*symbol))
|
||||
.cloned()
|
||||
.collect::<BTreeSet<_>>();
|
||||
let daily_top_up_active = self.config.daily_top_up_enabled
|
||||
@@ -8739,6 +8739,7 @@ impl Strategy for PlatformExprStrategy {
|
||||
self.pending_full_close_symbols.remove(&position.symbol);
|
||||
} else {
|
||||
exit_symbols.insert(position.symbol.clone());
|
||||
slot_blocking_symbols.insert(position.symbol.clone());
|
||||
order_intents.push(OrderIntent::TargetValue {
|
||||
symbol: position.symbol.clone(),
|
||||
target_value: 0.0,
|
||||
@@ -8773,37 +8774,6 @@ impl Strategy for PlatformExprStrategy {
|
||||
} else if stop_hit {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -21832,7 +21802,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn platform_aiquant_carried_full_close_releases_slot_when_flat() {
|
||||
fn platform_aiquant_carried_full_close_does_not_release_new_top_up_slot() {
|
||||
let prev_date = d(2025, 4, 29);
|
||||
let date = d(2025, 4, 30);
|
||||
let buy_first = "000001.SZ";
|
||||
@@ -22016,7 +21986,12 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
top_up_symbols,
|
||||
vec![buy_first, buy_second],
|
||||
vec![buy_first],
|
||||
"{:?}",
|
||||
decision.order_intents
|
||||
);
|
||||
assert!(
|
||||
!top_up_symbols.contains(&buy_second),
|
||||
"{:?}",
|
||||
decision.order_intents
|
||||
);
|
||||
@@ -22619,7 +22594,7 @@ mod tests {
|
||||
decision.order_intents
|
||||
);
|
||||
assert!(
|
||||
!decision.order_intents.iter().any(|intent| matches!(
|
||||
decision.order_intents.iter().any(|intent| matches!(
|
||||
intent,
|
||||
OrderIntent::Value {
|
||||
symbol,
|
||||
|
||||
Reference in New Issue
Block a user