From 3559a90ad276088f381c2c1156974c3ec73d4828 Mon Sep 17 00:00:00 2001 From: Palash Tyagi <23239946+Magnus167@users.noreply.github.com> Date: Mon, 14 Apr 2025 00:25:09 +0100 Subject: [PATCH] adding blacklist ability --- src/utils/qdf/blacklist.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/utils/qdf/blacklist.rs diff --git a/src/utils/qdf/blacklist.rs b/src/utils/qdf/blacklist.rs new file mode 100644 index 0000000..9fb8537 --- /dev/null +++ b/src/utils/qdf/blacklist.rs @@ -0,0 +1,27 @@ +use crate::utils::dateutils::{get_bdates_series_default_opt, get_min_max_real_dates}; +use crate::utils::qdf::core::*; +use chrono::{Duration, NaiveDate}; +use polars::prelude::*; +use std::collections::HashMap; +use std::error::Error; + +use super::pivots::pivot_dataframe_by_ticker; + +/// The required columns for a Quantamental DataFrame. +const QDF_INDEX_COLUMNS: [&str; 3] = ["real_date", "cid", "xcat"]; + +pub fn create_blacklist_from_qdf( + df: &DataFrame, + metric: Option, + start: Option, + end: Option, +) -> Result>, Box> { + // Verify that the DataFrame follows the Quantamental structure. + check_quantamental_dataframe(df)?; + let mut blacklist: HashMap> = HashMap::new(); + + // Use the provided metric or default to "value". + let metric = metric.unwrap_or_else(|| "value".into()); + + Ok(blacklist) +}