mirror of
https://github.com/NexVeridian/ark-invest-api-rust-data.git
synced 2025-09-02 01:49:12 +00:00
feat: CRWV
This commit is contained in:
parent
7f54c97720
commit
c1ac17a26c
1 changed files with 47 additions and 16 deletions
|
@ -9,6 +9,7 @@ use crate::util::df::DF;
|
||||||
#[derive(Debug, strum_macros::Display, EnumIter, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, strum_macros::Display, EnumIter, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum Ticker {
|
pub enum Ticker {
|
||||||
ARKW,
|
ARKW,
|
||||||
|
CRWV,
|
||||||
MKFG,
|
MKFG,
|
||||||
XYZ,
|
XYZ,
|
||||||
CASH_USD,
|
CASH_USD,
|
||||||
|
@ -25,6 +26,7 @@ impl Ticker {
|
||||||
pub fn format(&self, df: DF) -> Result<DF, Error> {
|
pub fn format(&self, df: DF) -> Result<DF, Error> {
|
||||||
match self {
|
match self {
|
||||||
Self::ARKW => Self::arkw(df),
|
Self::ARKW => Self::arkw(df),
|
||||||
|
Self::CRWV => Self::crwv(df),
|
||||||
Self::MKFG => Self::mkfg(df),
|
Self::MKFG => Self::mkfg(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),
|
||||||
|
@ -81,6 +83,24 @@ impl Ticker {
|
||||||
Ok(df.into())
|
Ok(df.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn crwv(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("COREWEAVE")))
|
||||||
|
.then(lit("CRWV"))
|
||||||
|
.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()?;
|
||||||
|
|
||||||
|
@ -156,6 +176,33 @@ mod tests {
|
||||||
use rstest::rstest;
|
use rstest::rstest;
|
||||||
|
|
||||||
#[rstest]
|
#[rstest]
|
||||||
|
#[case::arkb(
|
||||||
|
Ticker::ARKW,
|
||||||
|
defualt_df(
|
||||||
|
&[None::<&str>, Some("ARKB"), Some("ARKB"), Some("ARKB")],
|
||||||
|
&[
|
||||||
|
Some("ARK BITCOIN ETF HOLDCO (ARKW)"),
|
||||||
|
Some("ARK BITCOIN ETF HOLDCO (ARKW)"),
|
||||||
|
Some("ARK BITCOIN ETF HOLDCO (ARKF)"),
|
||||||
|
Some("ARKB"),
|
||||||
|
],
|
||||||
|
)?,
|
||||||
|
defualt_df(
|
||||||
|
&[Some("ARKB"), Some("ARKB"), Some("ARKB"), Some("ARKB")],
|
||||||
|
&[Some("ARKB"), Some("ARKB"), Some("ARKB"), Some("ARKB")],
|
||||||
|
)?,
|
||||||
|
)]
|
||||||
|
#[case::crwv(
|
||||||
|
Ticker::CRWV,
|
||||||
|
defualt_df(
|
||||||
|
&[Some("CRWV"), None::<&str>],
|
||||||
|
&[Some("COREWEAVE"), Some("COREWEAVE")],
|
||||||
|
)?,
|
||||||
|
defualt_df(
|
||||||
|
&[Some("CRWV"), Some("CRWV")],
|
||||||
|
&[Some("COREWEAVE"), Some("COREWEAVE")]
|
||||||
|
)?,
|
||||||
|
)]
|
||||||
#[case::mkfg(
|
#[case::mkfg(
|
||||||
Ticker::MKFG,
|
Ticker::MKFG,
|
||||||
defualt_df(
|
defualt_df(
|
||||||
|
@ -178,22 +225,6 @@ mod tests {
|
||||||
&[Some("BLOCK"), Some("BLOCK")],
|
&[Some("BLOCK"), Some("BLOCK")],
|
||||||
)?,
|
)?,
|
||||||
)]
|
)]
|
||||||
#[case::arkb(
|
|
||||||
Ticker::ARKW,
|
|
||||||
defualt_df(
|
|
||||||
&[None::<&str>, Some("ARKB"), Some("ARKB"), Some("ARKB")],
|
|
||||||
&[
|
|
||||||
Some("ARK BITCOIN ETF HOLDCO (ARKW)"),
|
|
||||||
Some("ARK BITCOIN ETF HOLDCO (ARKW)"),
|
|
||||||
Some("ARK BITCOIN ETF HOLDCO (ARKF)"),
|
|
||||||
Some("ARKB"),
|
|
||||||
],
|
|
||||||
)?,
|
|
||||||
defualt_df(
|
|
||||||
&[Some("ARKB"), Some("ARKB"), Some("ARKB"), Some("ARKB")],
|
|
||||||
&[Some("ARKB"), Some("ARKB"), Some("ARKB"), Some("ARKB")],
|
|
||||||
)?,
|
|
||||||
)]
|
|
||||||
#[case::cash_usd(
|
#[case::cash_usd(
|
||||||
Ticker::CASH_USD,
|
Ticker::CASH_USD,
|
||||||
defualt_df(
|
defualt_df(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue