adding blacklist ability

This commit is contained in:
Palash Tyagi 2025-04-14 00:25:09 +01:00
parent b7368a366e
commit 3559a90ad2

View File

@ -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<String>,
start: Option<String>,
end: Option<String>,
) -> Result<HashMap<String, Vec<String>>, Box<dyn Error>> {
// Verify that the DataFrame follows the Quantamental structure.
check_quantamental_dataframe(df)?;
let mut blacklist: HashMap<String, Vec<String>> = HashMap::new();
// Use the provided metric or default to "value".
let metric = metric.unwrap_or_else(|| "value".into());
Ok(blacklist)
}