修复季节性清仓执行时间
This commit is contained in:
@@ -7978,9 +7978,12 @@ impl Strategy for PlatformExprStrategy {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
exit_symbols.insert(symbol.clone());
|
exit_symbols.insert(symbol.clone());
|
||||||
order_intents.push(OrderIntent::TargetValue {
|
order_intents.push(OrderIntent::TimedTargetValue {
|
||||||
symbol: symbol.clone(),
|
symbol: symbol.clone(),
|
||||||
target_value: 0.0,
|
target_value: 0.0,
|
||||||
|
style: AlgoOrderStyle::Twap,
|
||||||
|
start_time: Some(delayed_limit_exit_time),
|
||||||
|
end_time: Some(delayed_limit_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);
|
||||||
@@ -11950,12 +11953,17 @@ mod tests {
|
|||||||
assert!(
|
assert!(
|
||||||
decision.order_intents.iter().any(|intent| matches!(
|
decision.order_intents.iter().any(|intent| matches!(
|
||||||
intent,
|
intent,
|
||||||
OrderIntent::TargetValue {
|
OrderIntent::TimedTargetValue {
|
||||||
symbol,
|
symbol,
|
||||||
target_value,
|
target_value,
|
||||||
|
start_time,
|
||||||
|
end_time,
|
||||||
reason,
|
reason,
|
||||||
|
..
|
||||||
} 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())
|
||||||
|
&& *end_time == Some(NaiveTime::from_hms_opt(9, 31, 0).unwrap())
|
||||||
&& reason == "seasonal_stop_window"
|
&& reason == "seasonal_stop_window"
|
||||||
)),
|
)),
|
||||||
"{:?}",
|
"{:?}",
|
||||||
@@ -11964,7 +11972,7 @@ mod tests {
|
|||||||
assert!(
|
assert!(
|
||||||
!decision.order_intents.iter().any(|intent| matches!(
|
!decision.order_intents.iter().any(|intent| matches!(
|
||||||
intent,
|
intent,
|
||||||
OrderIntent::TargetValue {
|
OrderIntent::TimedTargetValue {
|
||||||
symbol,
|
symbol,
|
||||||
reason,
|
reason,
|
||||||
..
|
..
|
||||||
@@ -12227,7 +12235,7 @@ mod tests {
|
|||||||
assert!(
|
assert!(
|
||||||
!decision.order_intents.iter().any(|intent| matches!(
|
!decision.order_intents.iter().any(|intent| matches!(
|
||||||
intent,
|
intent,
|
||||||
OrderIntent::TargetValue {
|
OrderIntent::TimedTargetValue {
|
||||||
symbol,
|
symbol,
|
||||||
reason,
|
reason,
|
||||||
..
|
..
|
||||||
@@ -12239,12 +12247,17 @@ mod tests {
|
|||||||
assert!(
|
assert!(
|
||||||
decision.order_intents.iter().any(|intent| matches!(
|
decision.order_intents.iter().any(|intent| matches!(
|
||||||
intent,
|
intent,
|
||||||
OrderIntent::TargetValue {
|
OrderIntent::TimedTargetValue {
|
||||||
symbol,
|
symbol,
|
||||||
target_value,
|
target_value,
|
||||||
|
start_time,
|
||||||
|
end_time,
|
||||||
reason,
|
reason,
|
||||||
|
..
|
||||||
} 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())
|
||||||
|
&& *end_time == Some(NaiveTime::from_hms_opt(9, 31, 0).unwrap())
|
||||||
&& reason == "seasonal_stop_window"
|
&& reason == "seasonal_stop_window"
|
||||||
)),
|
)),
|
||||||
"{:?}",
|
"{:?}",
|
||||||
|
|||||||
@@ -2622,9 +2622,12 @@ impl Strategy for OmniMicroCapStrategy {
|
|||||||
.positions()
|
.positions()
|
||||||
.keys()
|
.keys()
|
||||||
.cloned()
|
.cloned()
|
||||||
.map(|symbol| OrderIntent::TargetValue {
|
.map(|symbol| OrderIntent::TimedTargetValue {
|
||||||
symbol,
|
symbol,
|
||||||
target_value: 0.0,
|
target_value: 0.0,
|
||||||
|
style: AlgoOrderStyle::Twap,
|
||||||
|
start_time: Some(self.intraday_execution_start_time()),
|
||||||
|
end_time: Some(self.intraday_execution_start_time()),
|
||||||
reason: "seasonal_stop_window".to_string(),
|
reason: "seasonal_stop_window".to_string(),
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
|
|||||||
Reference in New Issue
Block a user