diff --git a/src/panel/historic_vol.rs b/src/panel/historic_vol.rs index d5d16b2..c650146 100644 --- a/src/panel/historic_vol.rs +++ b/src/panel/historic_vol.rs @@ -248,7 +248,7 @@ fn get_period_indices( } /// Calculate historic volatility. -/// Arguments: +/// # Arguments: /// - `df`: A Quantamental DataFrame. /// - `xcat`: The category to calculate the historic volatility for. /// - `cids`: A list of cross-sections. If none are provided, all cross-sections available diff --git a/src/panel/mod.rs b/src/panel/mod.rs index a2846e8..4d81923 100644 --- a/src/panel/mod.rs +++ b/src/panel/mod.rs @@ -1,3 +1,3 @@ pub mod historic_vol; - +pub mod linear_composite; diff --git a/src/utils/qdf/pivots.rs b/src/utils/qdf/pivots.rs index 8e6bd9b..c4bfd77 100644 --- a/src/utils/qdf/pivots.rs +++ b/src/utils/qdf/pivots.rs @@ -19,7 +19,12 @@ fn get_ticker_from_qdf(df: &DataFrame) -> Result> { Ok(ticker) } -/// Pivots a dataframe to a format where each ticker a column. +/// Pivots a dataframe to a format where each ticker is a column. +/// # Arguments: +/// * `df` - The dataframe to pivot. +/// * `metric` - The metric to pivot on. If None, defaults to "value". +/// # Returns: +/// * `DataFrame` - The pivoted dataframe. #[allow(dead_code)] pub fn pivot_dataframe_by_ticker( df: DataFrame, @@ -67,6 +72,11 @@ pub fn pivot_dataframe_by_ticker( } /// Pivot ticker dataframe to qdf. +/// # Arguments: +/// * `df` - The dataframe to pivot. +/// * `metric` - The metric to pivot on. If None, defaults to "value". +/// # Returns: +/// * `DataFrame` - The pivoted dataframe. #[allow(dead_code)] pub fn pivot_wide_dataframe_to_qdf( df: DataFrame, @@ -102,6 +112,11 @@ pub fn pivot_wide_dataframe_to_qdf( } /// Splits a dataframe by ticker. +/// # Arguments: +/// * `df` - The dataframe to split. +/// * `metrics` - The metrics to split on. If None, defaults to all metrics. +/// # Returns: +/// * `HashMap` - A hashmap where the key is the ticker and the value is the dataframe. #[allow(dead_code)] fn split_df_by_tickers( df: &DataFrame, @@ -146,6 +161,10 @@ fn split_df_by_tickers( /// Splits a QDF container data for a single ticker into a Vec of DataFrames (one per metric). /// The resulting DataFrames will have the "real_date" column and the metric column. +/// # Arguments: +/// * `df` - The dataframe to split. +/// # Returns: +/// * `Vec` - A vector of dataframes, each containing the "real_date" and a metric column. #[allow(dead_code)] fn single_ticker_qdf_to_timeseries(mut df: DataFrame) -> Result, Box> { let mut df_vec = Vec::new(); diff --git a/src/utils/qdf/reduce_df.rs b/src/utils/qdf/reduce_df.rs index 8511374..0f510dc 100644 --- a/src/utils/qdf/reduce_df.rs +++ b/src/utils/qdf/reduce_df.rs @@ -7,6 +7,7 @@ use std::error::Error; const QDF_INDEX_COLUMNS: [&str; 3] = ["real_date", "cid", "xcat"]; /// Filter a dataframe based on the given parameters. +/// # Arguments: /// - `cids`: Filter by cross-sectional identifiers /// - `xcats`: Filter by extended categories /// - `metrics`: Filter by metrics diff --git a/src/utils/qdf/update_df.rs b/src/utils/qdf/update_df.rs index da711e0..0544432 100644 --- a/src/utils/qdf/update_df.rs +++ b/src/utils/qdf/update_df.rs @@ -5,8 +5,10 @@ use std::error::Error; const QDF_INDEX_COLUMNS: [&str; 3] = ["real_date", "cid", "xcat"]; /// Update a Quantamental DataFrame with new data. +/// # Arguments: /// - `df`: The original DataFrame /// - `df_add`: The new DataFrame to add +/// - `xcat_replace`: !NOT IMPLEMENTED! If true, replace existing xcats with new ones. /// pub fn update_dataframe( df: &DataFrame,