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 {
|
pub enum Ticker {
|
||||||
ARKW,
|
ARKW,
|
||||||
CRWV,
|
CRWV,
|
||||||
|
ETOR,
|
||||||
MKFG,
|
MKFG,
|
||||||
LUNR,
|
LUNR,
|
||||||
XYZ,
|
XYZ,
|
||||||
|
@ -28,6 +29,7 @@ impl Ticker {
|
||||||
match self {
|
match self {
|
||||||
Self::ARKW => Self::arkw(df),
|
Self::ARKW => Self::arkw(df),
|
||||||
Self::CRWV => Self::crwv(df),
|
Self::CRWV => Self::crwv(df),
|
||||||
|
Self::ETOR => Self::etor(df),
|
||||||
Self::MKFG => Self::mkfg(df),
|
Self::MKFG => Self::mkfg(df),
|
||||||
Self::LUNR => Self::lunr(df),
|
Self::LUNR => Self::lunr(df),
|
||||||
Self::XYZ => Self::xyz(df),
|
Self::XYZ => Self::xyz(df),
|
||||||
|
@ -103,6 +105,24 @@ impl Ticker {
|
||||||
Ok(df.into())
|
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> {
|
fn mkfg(df: DF) -> Result<DF, Error> {
|
||||||
let mut df = df.collect()?;
|
let mut df = df.collect()?;
|
||||||
|
|
||||||
|
@ -227,6 +247,17 @@ mod tests {
|
||||||
&[Some("COREWEAVE"), Some("COREWEAVE")]
|
&[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(
|
#[case::mkfg(
|
||||||
Ticker::MKFG,
|
Ticker::MKFG,
|
||||||
defualt_df(
|
defualt_df(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue