mirror of
https://github.com/NexVeridian/ark-invest-api-rust-data.git
synced 2025-09-02 01:49:12 +00:00
feat: ETOR
This commit is contained in:
parent
b25a965816
commit
948903fff0
1 changed files with 31 additions and 0 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue