由执行风控处理无行情买单
This commit is contained in:
@@ -13321,18 +13321,6 @@ impl Strategy for PlatformExprStrategy {
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if self.uses_intraday_execution_quotes() {
|
||||
let execution_time = self.intraday_execution_start_time();
|
||||
if self
|
||||
.scheduled_quote_at_time(ctx, projection_date, symbol, Some(execution_time))
|
||||
.is_none()
|
||||
{
|
||||
selection_notes.push(format!(
|
||||
"daily_target_skipped symbol={symbol} reason=execution_quote_unavailable no_order=true"
|
||||
));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let target_value = target_value_for_scale(
|
||||
strategy_visible_total_value,
|
||||
trading_ratio,
|
||||
@@ -24371,6 +24359,46 @@ mod tests {
|
||||
assert_eq!(selected.len(), 1);
|
||||
assert_eq!(selected[0].symbol, symbol);
|
||||
|
||||
let mut target_cfg = PlatformExprStrategyConfig::microcap_rotation();
|
||||
target_cfg.universe_exclude.clear();
|
||||
target_cfg.signal_symbol = symbol.to_string();
|
||||
target_cfg.max_positions = 1;
|
||||
target_cfg.selection_limit_expr = "1".to_string();
|
||||
target_cfg.market_cap_lower_expr = "0".to_string();
|
||||
target_cfg.market_cap_upper_expr = "100".to_string();
|
||||
target_cfg.stock_filter_expr = "close > 0".to_string();
|
||||
target_cfg.exposure_expr = "1.0".to_string();
|
||||
target_cfg.stop_loss_expr.clear();
|
||||
target_cfg.take_profit_expr.clear();
|
||||
target_cfg.daily_top_up_enabled = true;
|
||||
target_cfg.daily_position_target_adjust_enabled = true;
|
||||
target_cfg.target_portfolio_daily_enabled = true;
|
||||
target_cfg.hold_until_exit_enabled = true;
|
||||
target_cfg.retry_empty_rebalance = false;
|
||||
target_cfg.matching_type = MatchingType::CurrentBarClose;
|
||||
target_cfg.intraday_execution_time =
|
||||
Some(NaiveTime::from_hms_opt(10, 18, 0).expect("valid execution time"));
|
||||
let mut target_strategy = PlatformExprStrategy::new(target_cfg);
|
||||
target_strategy.last_rebalance_date = Some(date);
|
||||
|
||||
let target_decision = target_strategy.on_day(&ctx).expect("daily target decision");
|
||||
assert!(target_decision.order_intents.iter().any(|intent| matches!(
|
||||
intent,
|
||||
OrderIntent::TargetValue {
|
||||
symbol: intent_symbol,
|
||||
target_value,
|
||||
reason,
|
||||
} if intent_symbol == symbol
|
||||
&& *target_value > 0.0
|
||||
&& reason == "model_target_portfolio_daily"
|
||||
)));
|
||||
assert!(
|
||||
!target_decision
|
||||
.diagnostics
|
||||
.iter()
|
||||
.any(|note| note.contains("execution_quote_unavailable"))
|
||||
);
|
||||
|
||||
let mut restricted_cfg = PlatformExprStrategyConfig::microcap_rotation();
|
||||
restricted_cfg.universe_include = Some(BTreeSet::from(["000001.SZ".to_string()]));
|
||||
restricted_cfg.universe_exclude.clear();
|
||||
|
||||
Reference in New Issue
Block a user