Function calculate_roc
Source pub fn calculate_roc(
df: &DataFrame,
window: usize,
column: &str,
) -> PolarsResult<Series>
Expand description
Calculates Rate of Change (ROC)
Formula: ((price / prevPrice) - 1) * 100
§Arguments
df
- DataFrame containing the price data
window
- Window size for ROC (typically 10)
column
- Column name to use for calculations (default “close”)
§Returns
Returns a PolarsResult containing the ROC Series