use chrono::{DateTime, Utc};
use crate::calendar::schedules::ALWAYS_OPEN_PROFILE;
use crate::calendar::schedules::equities::{africa_middle_east, americas, apac, europe, us};
use crate::calendar::schedules::from_profile;
use crate::calendar::schedules::futures::{international, us as futures_us};
use crate::calendar::{Exchange, MarketHours};
#[must_use]
pub fn hours_for_exchange(exch: Exchange, as_of: DateTime<Utc>) -> MarketHours {
let profile = match exch {
Exchange::Nasdaq => us::nasdaq_profile_at(as_of),
Exchange::NasdaqBx => us::nasdaq_bx_profile_at(as_of),
Exchange::NasdaqPsx => us::nasdaq_psx_profile_at(as_of),
Exchange::CboeEdgx => us::edgx_profile_at(as_of),
Exchange::CboeBzx => us::bzx_profile_at(as_of),
Exchange::CboeByx => us::byx_profile_at(as_of),
Exchange::CboeEdga => us::edga_profile_at(as_of),
Exchange::Nyse => us::nyse_profile_at(as_of),
Exchange::NyseArca => us::nyse_arca_profile_at(as_of),
Exchange::CboeOptionsC1 => us::c1_profile_at(as_of),
Exchange::CboeC2Options => us::c2_options_profile_at(as_of),
Exchange::CboeBzxOptions => us::bzx_options_profile_at(as_of),
Exchange::CboeEdgxOptions => us::edgx_options_profile_at(as_of),
Exchange::NyseArcaOptions => us::nyse_arca_options_profile_at(as_of),
Exchange::NyseAmericanOptions => us::nyse_american_options_profile_at(as_of),
Exchange::NasdaqPhlx => us::nasdaq_phlx_profile_at(as_of),
Exchange::NasdaqIse => us::nasdaq_ise_profile_at(as_of),
Exchange::NasdaqNom => us::nasdaq_nom_profile_at(as_of),
Exchange::NasdaqMrx => us::nasdaq_mrx_profile_at(as_of),
Exchange::NasdaqGemx => us::nasdaq_gemx_profile_at(as_of),
Exchange::NasdaqBxOptions => us::nasdaq_bx_options_profile_at(as_of),
Exchange::MiaxOptions => us::miax_options_profile_at(as_of),
Exchange::MiaxEmeraldOptions => us::miax_emerald_options_profile_at(as_of),
Exchange::MiaxPearlOptions => us::miax_pearl_options_profile_at(as_of),
Exchange::MiaxSapphireOptions => us::miax_sapphire_options_profile_at(as_of),
Exchange::BoxOptions => us::box_options_profile_at(as_of),
Exchange::MemxOptions => us::memx_options_profile_at(as_of),
Exchange::Iex => us::iex_profile_at(as_of),
Exchange::Ltse => us::ltse_profile_at(as_of),
Exchange::TwentyFourX => us::twenty_four_x_profile_at(as_of),
Exchange::Txse => us::txse_profile_at(as_of),
Exchange::NyseAmerican => us::nyse_american_profile_at(as_of),
Exchange::NyseNational => us::nyse_national_profile_at(as_of),
Exchange::NyseTexas => us::nyse_texas_profile_at(as_of),
Exchange::BlueOceanAts => us::blue_ocean_profile_at(as_of),
Exchange::MemxEq => us::memx_profile_at(as_of),
Exchange::MiaxPearlEq => us::miax_pearl_profile_at(as_of),
Exchange::FinraTrfCarteret => us::finra_trf_carteret_profile_at(as_of),
Exchange::FinraTrfChicago => us::finra_trf_chicago_profile_at(as_of),
Exchange::FinraTrfNyse => us::finra_trf_nyse_profile_at(as_of),
Exchange::Cme => futures_us::cme_profile_at(as_of),
Exchange::Cfe => futures_us::cfe_profile_at(as_of),
Exchange::CoinbaseDerivatives => futures_us::coinbase_derivatives_profile_at(as_of),
Exchange::Smfe => futures_us::small_exchange_profile_at(as_of),
Exchange::Cbot => futures_us::cbot_profile_at(as_of),
Exchange::Comex | Exchange::Nymex => futures_us::energy_metals_profile_at(as_of),
Exchange::Iceus => futures_us::ice_us_fang_profile_at(as_of),
Exchange::Eurex => international::eurex_profile_at(as_of),
Exchange::Eex => international::eex_profile_at(as_of),
Exchange::Iceeu => international::iceeu_profile_at(as_of),
Exchange::IceEuropeCommodities => international::ice_europe_commodities_profile_at(as_of),
Exchange::IceEuropeFinancials => international::ice_europe_financials_profile_at(as_of),
Exchange::IceEndex => international::ice_endex_profile_at(as_of),
Exchange::IceAbuDhabi => international::ice_abu_dhabi_profile_at(as_of),
Exchange::IceCanada => international::ice_canada_profile_at(as_of),
Exchange::Sgx => international::sgx_profile_at(as_of),
Exchange::BinanceFutures => international::binance_profile_at(as_of),
Exchange::Oanda => international::oanda_fx_profile_at(as_of),
Exchange::Asx => apac::asx::profile_at(as_of),
Exchange::TmxAustralia => apac::tmx_australia::profile_at(as_of),
Exchange::Nzx => apac::nzx::profile_at(as_of),
Exchange::Tse => apac::tse::profile_at(as_of),
Exchange::NseIndia => apac::nse::profile_at(as_of),
Exchange::BseIndia => apac::bse::profile_at(as_of),
Exchange::Hkex => apac::hkex::profile_at(as_of),
Exchange::SgxSecurities => apac::sgx::profile_at(as_of),
Exchange::BursaMalaysia => apac::bursa::profile_at(as_of),
Exchange::SetThailand => apac::set::profile_at(as_of),
Exchange::Idx => apac::idx::profile_at(as_of),
Exchange::Pse => apac::pse::profile_at(as_of),
Exchange::Hose => apac::hose::profile_at(as_of),
Exchange::Sse => apac::sse::profile_at(as_of),
Exchange::Szse => apac::szse::profile_at(as_of),
Exchange::Krx => apac::krx::profile_at(as_of),
Exchange::Twse => apac::twse::profile_at(as_of),
Exchange::Lse => europe::lse::profile_at(as_of),
Exchange::Xetra => europe::xetra::profile_at(as_of),
Exchange::Six => europe::six::profile_at(as_of),
Exchange::EuronextParis => europe::euronext::paris_profile_at(as_of),
Exchange::EuronextAmsterdam => europe::euronext::amsterdam_profile_at(as_of),
Exchange::EuronextBrussels => europe::euronext::brussels_profile_at(as_of),
Exchange::EuronextLisbon => europe::euronext::lisbon_profile_at(as_of),
Exchange::EuronextDublin => europe::euronext::dublin_profile_at(as_of),
Exchange::EuronextMilan => europe::euronext::milan_profile_at(as_of),
Exchange::Bme => europe::bme::profile_at(as_of),
Exchange::NasdaqStockholm => europe::nasdaq_nordics::stockholm_profile_at(as_of),
Exchange::NasdaqHelsinki => europe::nasdaq_nordics::helsinki_profile_at(as_of),
Exchange::NasdaqCopenhagen => europe::nasdaq_nordics::copenhagen_profile_at(as_of),
Exchange::Vienna => europe::vienna::profile_at(as_of),
Exchange::BorsaIstanbul => europe::bist::profile_at(as_of),
Exchange::Jse => africa_middle_east::jse::profile_at(as_of),
Exchange::Tadawul => africa_middle_east::tadawul::profile_at(as_of),
Exchange::B3 => americas::b3::profile_at(as_of),
Exchange::Bmv => americas::bmv::profile_at(as_of),
Exchange::Tsx => americas::tsx::profile_at(as_of),
Exchange::Unknown => &ALWAYS_OPEN_PROFILE,
};
from_profile(exch, profile)
}