use chrono_tz::Asia;
use super::super::StaticHoursProfile;
use crate::calendar::SessionRule;
use crate::calendar::rule::MON_FRI;
static TWSE_REGULAR_CURRENT: &[SessionRule] = &[SessionRule {
days: MON_FRI,
open_ssm: 9 * 3600,
close_ssm: 13 * 3600 + 25 * 60,
}];
static TWSE_EXTENDED_ENVELOPE: &[SessionRule] = &[
SessionRule {
days: MON_FRI,
open_ssm: 8 * 3600,
close_ssm: 8 * 3600 + 30 * 60,
},
SessionRule {
days: MON_FRI,
open_ssm: 9 * 3600,
close_ssm: 17 * 3600,
},
];
static TWSE_ORDER_ENTRY: &[SessionRule] = &[SessionRule {
days: MON_FRI,
open_ssm: 8 * 3600 + 30 * 60,
close_ssm: 9 * 3600,
}];
pub(crate) static TWSE_PROFILE_CURRENT: StaticHoursProfile = StaticHoursProfile {
tz: Asia::Taipei,
regular: TWSE_REGULAR_CURRENT,
extended: TWSE_EXTENDED_ENVELOPE,
order_entry: TWSE_ORDER_ENTRY,
has_daily_close: true,
has_weekend_close: true,
};
pub(crate) static TWSE_PROFILE_PRE_2020_03_23: StaticHoursProfile = StaticHoursProfile {
tz: Asia::Taipei,
regular: &[],
extended: TWSE_EXTENDED_ENVELOPE,
order_entry: TWSE_ORDER_ENTRY,
has_daily_close: true,
has_weekend_close: true,
};
use crate::calendar::schedules::timeline::{Revision, local_date, revisions, select_revision};
pub(crate) const CURRENT: &StaticHoursProfile = &TWSE_PROFILE_CURRENT;
static REVISIONS: &[Revision] = revisions![(
2020,
3,
23,
&TWSE_PROFILE_CURRENT,
"TWSE company history page"
),];
pub(crate) fn profile_at(as_of: chrono::DateTime<chrono::Utc>) -> &'static StaticHoursProfile {
select_revision(
local_date(as_of, CURRENT.tz),
&TWSE_PROFILE_PRE_2020_03_23,
REVISIONS,
)
}