mirror of
https://github.com/NexVeridian/ark-invest-api-rust-data.git
synced 2025-09-02 01:49:12 +00:00
feat: LUNR
This commit is contained in:
parent
8850d5e106
commit
b25a965816
1 changed files with 31 additions and 0 deletions
|
@ -11,6 +11,7 @@ pub enum Ticker {
|
||||||
ARKW,
|
ARKW,
|
||||||
CRWV,
|
CRWV,
|
||||||
MKFG,
|
MKFG,
|
||||||
|
LUNR,
|
||||||
XYZ,
|
XYZ,
|
||||||
CASH_USD,
|
CASH_USD,
|
||||||
}
|
}
|
||||||
|
@ -28,6 +29,7 @@ impl Ticker {
|
||||||
Self::ARKW => Self::arkw(df),
|
Self::ARKW => Self::arkw(df),
|
||||||
Self::CRWV => Self::crwv(df),
|
Self::CRWV => Self::crwv(df),
|
||||||
Self::MKFG => Self::mkfg(df),
|
Self::MKFG => Self::mkfg(df),
|
||||||
|
Self::LUNR => Self::lunr(df),
|
||||||
Self::XYZ => Self::xyz(df),
|
Self::XYZ => Self::xyz(df),
|
||||||
Self::CASH_USD => Self::cash_usd(df),
|
Self::CASH_USD => Self::cash_usd(df),
|
||||||
}
|
}
|
||||||
|
@ -119,6 +121,24 @@ impl Ticker {
|
||||||
Ok(df.into())
|
Ok(df.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn lunr(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("INTUITIVE MACHINES")))
|
||||||
|
.then(lit("LUNR"))
|
||||||
|
.otherwise(col("ticker"))
|
||||||
|
.alias("ticker")])
|
||||||
|
.collect()
|
||||||
|
{
|
||||||
|
df = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(df.into())
|
||||||
|
}
|
||||||
|
|
||||||
fn xyz(df: DF) -> Result<DF, Error> {
|
fn xyz(df: DF) -> Result<DF, Error> {
|
||||||
let mut df = df.collect()?;
|
let mut df = df.collect()?;
|
||||||
|
|
||||||
|
@ -218,6 +238,17 @@ mod tests {
|
||||||
&[Some("MARKFORGEDG"), Some("MARKFORGEDG")]
|
&[Some("MARKFORGEDG"), Some("MARKFORGEDG")]
|
||||||
)?,
|
)?,
|
||||||
)]
|
)]
|
||||||
|
#[case::lunr(
|
||||||
|
Ticker::LUNR,
|
||||||
|
defualt_df(
|
||||||
|
&[Some("LUNR"), None::<&str>],
|
||||||
|
&[Some("INTUITIVE MACHINES"), Some("INTUITIVE MACHINES")]
|
||||||
|
)?,
|
||||||
|
defualt_df(
|
||||||
|
&[Some("LUNR"), Some("LUNR")],
|
||||||
|
&[Some("INTUITIVE MACHINES"), Some("INTUITIVE MACHINES")]
|
||||||
|
)?,
|
||||||
|
)]
|
||||||
#[case::xyz(
|
#[case::xyz(
|
||||||
Ticker::XYZ,
|
Ticker::XYZ,
|
||||||
defualt_df(
|
defualt_df(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue