feat: ETOR

This commit is contained in:
Elijah McMorris 2025-05-24 02:23:03 -07:00
parent b25a965816
commit 948903fff0
Signed by: NexVeridian
SSH key fingerprint: SHA256:bsA1SKZxuEcEVHAy3gY1HUeM5ykRJl0U0kQHQn0hMg8

View file

@ -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<DF, Error> {
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<DF, Error> {
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(