use strum_macros::{Display, EnumString};
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, EnumString, Display)]
pub enum Market {
#[strum(disabled)]
Unknown,
US,
HK,
CN,
SG,
}
impl_default_for_enum_string!(Market);
impl_serde_for_enum_string!(Market);
impl From<longport_candlesticks::Market> for Market {
fn from(market: longport_candlesticks::Market) -> Self {
match market {
longport_candlesticks::Market::HK => Market::HK,
longport_candlesticks::Market::US => Market::US,
longport_candlesticks::Market::SH | longport_candlesticks::Market::SZ => Market::CN,
longport_candlesticks::Market::SG => Market::SG,
}
}
}