use serde::{Deserialize, Serialize};
macro_rules! exchanges {
(
$(#[$enum_meta:meta])*
$vis:vis enum $name:ident {
$(
$(#[$variant_meta:meta])*
$variant:ident => $canonical:literal
),+ $(,)?
}
) => {
$(#[$enum_meta])*
$vis enum $name {
$(
$(#[$variant_meta])*
$variant,
)+
}
impl $name {
$vis const ALL: &'static [$name] = &[$($name::$variant,)+];
#[must_use]
$vis const fn as_str(self) -> &'static str {
match self {
$($name::$variant => $canonical,)+
}
}
}
};
}
exchanges! {
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Exchange {
Unknown => "unknown",
Nasdaq => "nasdaq",
NasdaqBx => "nasdaq_bx",
NasdaqPsx => "nasdaq_psx",
CboeBzx => "cboe_bzx",
CboeByx => "cboe_byx",
CboeEdga => "cboe_edga",
CboeEdgx => "cboe_edgx",
Nyse => "nyse",
NyseArca => "nyse_arca",
NyseAmerican => "nyse_american",
NyseNational => "nyse_national",
NyseTexas => "nyse_texas",
MemxEq => "memx_eq",
MiaxPearlEq => "miax_pearl_eq",
Iex => "iex",
IntelligentcrossIqx => "intelligentcross_iqx",
BlueOceanAts => "blue_ocean_ats",
FinraTrfCarteret => "finra_trf_carteret",
FinraTrfChicago => "finra_trf_chicago",
FinraTrfNyse => "finra_trf_nyse",
CboeOptionsC1 => "cboe_options_c1",
CboeC2Options => "cboe_c2_options",
CboeBzxOptions => "cboe_bzx_options",
CboeEdgxOptions => "cboe_edgx_options",
NyseArcaOptions => "nyse_arca_options",
NyseAmericanOptions => "nyse_american_options",
NasdaqPhlx => "nasdaq_phlx",
NasdaqIse => "nasdaq_ise",
NasdaqNom => "nasdaq_nom",
NasdaqMrx => "nasdaq_mrx",
NasdaqGemx => "nasdaq_gemx",
NasdaqBxOptions => "nasdaq_bx_options",
MiaxOptions => "miax_options",
MiaxEmeraldOptions => "miax_emerald_options",
MiaxPearlOptions => "miax_pearl_options",
MiaxSapphireOptions => "miax_sapphire_options",
BoxOptions => "box_options",
MemxOptions => "memx_options",
Cme => "cme",
Cbot => "cbot",
Comex => "comex",
Nymex => "nymex",
Cfe => "cfe",
Eurex => "eurex",
Eex => "eex",
Iceus => "iceus",
Iceeu => "iceeu",
IceEuropeCommodities => "ice_europe_commodities",
IceEuropeFinancials => "ice_europe_financials",
IceEndex => "ice_endex",
IceAbuDhabi => "ice_abu_dhabi",
IceCanada => "ice_canada",
Sgx => "sgx",
Lse => "lse",
Xetra => "xetra",
Six => "six",
EuronextParis => "euronext_paris",
EuronextAmsterdam => "euronext_amsterdam",
EuronextBrussels => "euronext_brussels",
EuronextLisbon => "euronext_lisbon",
EuronextDublin => "euronext_dublin",
EuronextMilan => "euronext_milan",
Bme => "bme",
NasdaqStockholm => "nasdaq_stockholm",
NasdaqHelsinki => "nasdaq_helsinki",
NasdaqCopenhagen => "nasdaq_copenhagen",
Vienna => "vienna",
BinanceFutures => "binance_futures",
}
}