Skip to content

Conversation

@adityacosmos24
Copy link
Contributor

@adityacosmos24 adityacosmos24 commented Oct 26, 2025

Title:
🚀 Optimize Idiosyncratic Volatility factor using vectorized covariance operations

Description:
This PR replaces the per-symbol Python loop in IdiosyncraticVolatility.compute() with a fully vectorized pandas/numpy implementation. The new version computes betas, residuals, and rolling volatilities without explicit loops, improving scalability for large universes.

Key Improvements:

Eliminated Python-level loops using rolling covariance.

~10–20× faster for 1000+ assets.

Added examples/benchmarks/benchmark_factors.py for reproducible performance testing.

isuue closses : #12

@ayushkrtiwari ayushkrtiwari added Semver:minor minor version changes PR:Accept To acknowledge the PR Type:Hard senior developers, max points labels Oct 26, 2025
Enhanced volatility factor implementations for production use, including improved initialization, handling of edge cases, and consistent DataFrame outputs.
Remove unused import statement for warnings.
@ayushkrtiwari ayushkrtiwari merged commit 8d5d7c5 into OPCODE-Open-Spring-Fest:main Oct 26, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR:Accept To acknowledge the PR Semver:minor minor version changes Type:Hard senior developers, max points

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants