修正季节清仓执行时间
This commit is contained in:
@@ -7965,6 +7965,7 @@ impl Strategy for PlatformExprStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if in_skip_window {
|
if in_skip_window {
|
||||||
|
let seasonal_exit_time = self.intraday_execution_start_time();
|
||||||
let mut pending_highlimit_kept = 0usize;
|
let mut pending_highlimit_kept = 0usize;
|
||||||
for symbol in ctx.portfolio.positions().keys() {
|
for symbol in ctx.portfolio.positions().keys() {
|
||||||
if delayed_sold_symbols.contains(symbol) {
|
if delayed_sold_symbols.contains(symbol) {
|
||||||
@@ -7981,8 +7982,8 @@ impl Strategy for PlatformExprStrategy {
|
|||||||
symbol: symbol.clone(),
|
symbol: symbol.clone(),
|
||||||
target_value: 0.0,
|
target_value: 0.0,
|
||||||
style: AlgoOrderStyle::Twap,
|
style: AlgoOrderStyle::Twap,
|
||||||
start_time: Some(delayed_limit_exit_time),
|
start_time: Some(seasonal_exit_time),
|
||||||
end_time: Some(delayed_limit_exit_time),
|
end_time: Some(seasonal_exit_time),
|
||||||
reason: "seasonal_stop_window".to_string(),
|
reason: "seasonal_stop_window".to_string(),
|
||||||
});
|
});
|
||||||
self.forget_position_entry_date(symbol);
|
self.forget_position_entry_date(symbol);
|
||||||
@@ -11980,8 +11981,8 @@ mod tests {
|
|||||||
..
|
..
|
||||||
} if symbol == other_symbol
|
} if symbol == other_symbol
|
||||||
&& *target_value == 0.0
|
&& *target_value == 0.0
|
||||||
&& *start_time == Some(NaiveTime::from_hms_opt(9, 31, 0).unwrap())
|
&& *start_time == Some(NaiveTime::from_hms_opt(10, 18, 0).unwrap())
|
||||||
&& *end_time == Some(NaiveTime::from_hms_opt(9, 31, 0).unwrap())
|
&& *end_time == Some(NaiveTime::from_hms_opt(10, 18, 0).unwrap())
|
||||||
&& reason == "seasonal_stop_window"
|
&& reason == "seasonal_stop_window"
|
||||||
)),
|
)),
|
||||||
"{:?}",
|
"{:?}",
|
||||||
@@ -12274,8 +12275,8 @@ mod tests {
|
|||||||
..
|
..
|
||||||
} if symbol == other_symbol
|
} if symbol == other_symbol
|
||||||
&& *target_value == 0.0
|
&& *target_value == 0.0
|
||||||
&& *start_time == Some(NaiveTime::from_hms_opt(9, 31, 0).unwrap())
|
&& *start_time == Some(NaiveTime::from_hms_opt(10, 18, 0).unwrap())
|
||||||
&& *end_time == Some(NaiveTime::from_hms_opt(9, 31, 0).unwrap())
|
&& *end_time == Some(NaiveTime::from_hms_opt(10, 18, 0).unwrap())
|
||||||
&& reason == "seasonal_stop_window"
|
&& reason == "seasonal_stop_window"
|
||||||
)),
|
)),
|
||||||
"{:?}",
|
"{:?}",
|
||||||
|
|||||||
Reference in New Issue
Block a user