use std::fmt;
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum YfCurrencyPurpose {
Trading,
Reporting,
CorporateAction,
AnalystEstimate,
}
impl fmt::Display for YfCurrencyPurpose {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let value = match self {
Self::Trading => "trading",
Self::Reporting => "reporting",
Self::CorporateAction => "corporate-action",
Self::AnalystEstimate => "analyst-estimate",
};
f.write_str(value)
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum YfCurrencyInference {
ListingHeuristic,
ProfileCountryHeuristic,
}
impl fmt::Display for YfCurrencyInference {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let value = match self {
Self::ListingHeuristic => "listing heuristic",
Self::ProfileCountryHeuristic => "profile-country heuristic",
};
f.write_str(value)
}
}
impl From<crate::core::currency_resolver::CurrencyPurpose> for YfCurrencyPurpose {
fn from(value: crate::core::currency_resolver::CurrencyPurpose) -> Self {
match value {
crate::core::currency_resolver::CurrencyPurpose::Trading => Self::Trading,
crate::core::currency_resolver::CurrencyPurpose::Reporting => Self::Reporting,
crate::core::currency_resolver::CurrencyPurpose::CorporateAction => {
Self::CorporateAction
}
crate::core::currency_resolver::CurrencyPurpose::AnalystEstimate => {
Self::AnalystEstimate
}
}
}
}
impl From<crate::core::currency_resolver::CurrencyInference> for YfCurrencyInference {
fn from(value: crate::core::currency_resolver::CurrencyInference) -> Self {
match value {
crate::core::currency_resolver::CurrencyInference::ListingHeuristic => {
Self::ListingHeuristic
}
crate::core::currency_resolver::CurrencyInference::ProfileCountryHeuristic => {
Self::ProfileCountryHeuristic
}
}
}
}