mirror of
https://github.com/Magnus167/msyrs.git
synced 2025-08-20 07:20:01 +00:00
adding blacklist ability
This commit is contained in:
parent
b7368a366e
commit
3559a90ad2
27
src/utils/qdf/blacklist.rs
Normal file
27
src/utils/qdf/blacklist.rs
Normal 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)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user