修正ALV补仓槽位占用语义
This commit is contained in:
@@ -2262,6 +2262,7 @@ impl PlatformExprStrategy {
|
||||
slot_working_symbols: &mut BTreeSet<String>,
|
||||
same_bar_buy_symbols: &mut BTreeSet<String>,
|
||||
pending_full_close_symbols: &BTreeSet<String>,
|
||||
slot_blocking_symbols: &BTreeSet<String>,
|
||||
same_day_sold_symbols: &BTreeSet<String>,
|
||||
exit_symbols: &BTreeSet<String>,
|
||||
delayed_sold_symbols: &BTreeSet<String>,
|
||||
@@ -2278,7 +2279,7 @@ impl PlatformExprStrategy {
|
||||
loop {
|
||||
let mut budget_working_symbols = slot_working_symbols.clone();
|
||||
budget_working_symbols.extend(same_bar_buy_symbols.iter().cloned());
|
||||
if Self::effective_slot_count(&budget_working_symbols, pending_full_close_symbols)
|
||||
if Self::effective_slot_count(&budget_working_symbols, slot_blocking_symbols)
|
||||
>= selection_limit
|
||||
{
|
||||
break;
|
||||
@@ -2304,7 +2305,7 @@ impl PlatformExprStrategy {
|
||||
&budget_working_symbols,
|
||||
&value_symbols,
|
||||
*pending_buy_value,
|
||||
pending_full_close_symbols,
|
||||
slot_blocking_symbols,
|
||||
);
|
||||
let available_buy_cash = slot_buy_cash.min(*aiquant_available_cash);
|
||||
if debug_daily_top_up {
|
||||
@@ -8331,6 +8332,7 @@ impl Strategy for PlatformExprStrategy {
|
||||
let daily_top_up_target_budget = aiquant_total_value * trading_ratio;
|
||||
let mut daily_top_up_pending_buy_value = 0.0_f64;
|
||||
let mut pending_full_close_symbols = BTreeSet::<String>::new();
|
||||
let mut slot_blocking_symbols = delayed_sold_symbols.clone();
|
||||
let mut interleaved_pending_full_close_symbols = BTreeSet::<String>::new();
|
||||
let risk_level_forced_exit_time = self.risk_level_forced_exit_time();
|
||||
self.pending_full_close_symbols.retain(|symbol| {
|
||||
@@ -8677,12 +8679,14 @@ impl Strategy for PlatformExprStrategy {
|
||||
)
|
||||
.is_some();
|
||||
if close_submitted {
|
||||
slot_working_symbols.remove(&position.symbol);
|
||||
if Self::projected_position_is_flat(&projected, &position.symbol) {
|
||||
same_day_sold_symbols.insert(position.symbol.clone());
|
||||
pending_full_close_symbols.remove(&position.symbol);
|
||||
self.pending_full_close_symbols.remove(&position.symbol);
|
||||
} else {
|
||||
pending_full_close_symbols.insert(position.symbol.clone());
|
||||
slot_blocking_symbols.insert(position.symbol.clone());
|
||||
self.pending_full_close_symbols
|
||||
.insert(position.symbol.clone());
|
||||
}
|
||||
@@ -8709,6 +8713,7 @@ impl Strategy for PlatformExprStrategy {
|
||||
&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,
|
||||
@@ -8769,6 +8774,7 @@ impl Strategy for PlatformExprStrategy {
|
||||
self.pending_full_close_symbols.remove(&position.symbol);
|
||||
} else {
|
||||
pending_full_close_symbols.insert(position.symbol.clone());
|
||||
slot_blocking_symbols.insert(position.symbol.clone());
|
||||
self.pending_full_close_symbols
|
||||
.insert(position.symbol.clone());
|
||||
}
|
||||
@@ -8797,6 +8803,7 @@ impl Strategy for PlatformExprStrategy {
|
||||
&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,
|
||||
@@ -8835,6 +8842,7 @@ impl Strategy for PlatformExprStrategy {
|
||||
self.pending_full_close_symbols.remove(&position.symbol);
|
||||
} else {
|
||||
pending_full_close_symbols.insert(position.symbol.clone());
|
||||
slot_blocking_symbols.insert(position.symbol.clone());
|
||||
self.pending_full_close_symbols
|
||||
.insert(position.symbol.clone());
|
||||
}
|
||||
@@ -8862,6 +8870,7 @@ impl Strategy for PlatformExprStrategy {
|
||||
&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,
|
||||
|
||||
Reference in New Issue
Block a user