Add bar and tick strategy lifecycle

This commit is contained in:
boris
2026-04-23 19:17:04 -07:00
parent 86e4db6272
commit 1760fc6cd1
9 changed files with 525 additions and 10 deletions

View File

@@ -6,6 +6,8 @@ use crate::calendar::TradingCalendar;
pub enum ScheduleStage {
BeforeTrading,
OpenAuction,
Bar,
Tick,
OnDay,
AfterTrading,
Settlement,
@@ -222,6 +224,8 @@ pub fn default_stage_time(stage: ScheduleStage) -> Option<NaiveTime> {
match stage {
ScheduleStage::BeforeTrading => Some(NaiveTime::from_hms_opt(9, 0, 0).expect("valid time")),
ScheduleStage::OpenAuction => Some(NaiveTime::from_hms_opt(9, 31, 0).expect("valid time")),
ScheduleStage::Bar => Some(NaiveTime::from_hms_opt(10, 18, 0).expect("valid time")),
ScheduleStage::Tick => None,
ScheduleStage::OnDay => Some(NaiveTime::from_hms_opt(10, 18, 0).expect("valid time")),
ScheduleStage::AfterTrading => Some(NaiveTime::from_hms_opt(15, 0, 0).expect("valid time")),
ScheduleStage::Settlement => Some(NaiveTime::from_hms_opt(15, 1, 0).expect("valid time")),