From 948903fff0ee23de9a48041bc61e0a841772a3d0 Mon Sep 17 00:00:00 2001 From: NexVeridian Date: Sat, 24 May 2025 02:23:03 -0700 Subject: [PATCH] feat: ETOR --- src/util/format/ticker.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/util/format/ticker.rs b/src/util/format/ticker.rs index 397890f..3bb3ee0 100644 --- a/src/util/format/ticker.rs +++ b/src/util/format/ticker.rs @@ -10,6 +10,7 @@ use crate::util::df::DF; pub enum Ticker { ARKW, CRWV, + ETOR, MKFG, LUNR, XYZ, @@ -28,6 +29,7 @@ impl Ticker { match self { Self::ARKW => Self::arkw(df), Self::CRWV => Self::crwv(df), + Self::ETOR => Self::etor(df), Self::MKFG => Self::mkfg(df), Self::LUNR => Self::lunr(df), Self::XYZ => Self::xyz(df), @@ -103,6 +105,24 @@ impl Ticker { Ok(df.into()) } + fn etor(df: DF) -> Result { + let mut df = df.collect()?; + + if let Ok(x) = df + .clone() + .lazy() + .with_columns(vec![when(col("company").eq(lit("ETORO GROUP"))) + .then(lit("ETOR")) + .otherwise(col("ticker")) + .alias("ticker")]) + .collect() + { + df = x; + } + + Ok(df.into()) + } + fn mkfg(df: DF) -> Result { let mut df = df.collect()?; @@ -227,6 +247,17 @@ mod tests { &[Some("COREWEAVE"), Some("COREWEAVE")] )?, )] + #[case::etor( + Ticker::ETOR, + defualt_df( + &[Some("ETOR"), None::<&str>], + &[Some("ETORO GROUP"), Some("ETORO GROUP")], + )?, + defualt_df( + &[Some("ETOR"), Some("ETOR")], + &[Some("ETORO GROUP"), Some("ETORO GROUP")] + )?, + )] #[case::mkfg( Ticker::MKFG, defualt_df(