Financial Fractal Analysis
Enterprise-grade fractal analysis library for quantitative finance applications. This Rust library provides comprehensive tools for analyzing long-range dependence, multifractality, and regime changes in financial time series with statistical rigor and high performance.
Key Features
- Statistical Rigor: All estimators include bias corrections, confidence intervals, and comprehensive hypothesis testing
- Multiple Methods: Hurst exponent estimation via R/S, DFA, GPH, and wavelet methods
- Multifractal Analysis: Complete MF-DFA implementation with singularity spectrum
- Regime Detection: HMM-based detection of structural breaks and fractal regimes
- High Performance: Written in Rust for optimal speed and memory efficiency
- Enterprise Ready: Comprehensive validation, testing, and documentation
Quick Start
Installation
Add this to your Cargo.toml:
[]
= "0.1.2"
Basic Usage
use ;
use *;
use StandardNormal;
Advanced Analysis
use ;
Analysis Methods
Hurst Exponent Estimation
The library implements multiple methods for Hurst exponent estimation:
- Rescaled Range (R/S): Classical method with Lo's bias correction
- Detrended Fluctuation Analysis (DFA): Robust to non-stationarity
- GPH Periodogram: Frequency-domain estimation with HAC standard errors
- Wavelet-based: Using MODWT for scale-dependent analysis
- Whittle Estimator: Maximum likelihood in frequency domain
Multifractal Analysis
- MF-DFA: Multifractal DFA for generalized Hurst exponents
- Singularity Spectrum: f(α) characterization
- WTMM: Wavelet Transform Modulus Maxima method
Statistical Testing
- Long-range dependence: GPH, Robinson tests
- Stationarity: ADF, KPSS tests with rigorous p-values
- Structural breaks: CUSUM, Quandt-Andrews tests
- Goodness-of-fit: Anderson-Darling, Cramér-von Mises
Performance
The library is optimized for quantitative finance applications:
- FFT caching for repeated spectral calculations
- Memory pooling for large dataset processing
- Parallel processing support via Rayon
- SIMD optimizations (when enabled)
Test Status
- 236/236 unit tests passing
- 6 integration tests marked as ignored (edge cases, performance variations)
- Run ignored tests with:
cargo test -- --ignored
Known test limitations:
- Performance tests may timeout on slower hardware
- Some edge cases with extreme numerical values
- Cross-method validation shows expected variations
Documentation
Comprehensive documentation is available:
- Live Documentation - Complete API documentation with examples
- API Documentation - Official Rust documentation
- Module-level documentation in source code
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is dual-licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Important Notes
P-values for ADF and KPSS tests are APPROXIMATE based on critical value interpolation or asymptotic approximations. For regulatory compliance or critical financial decisions, use test statistics with appropriate critical value tables.