Skip to main content

High-Performance Fractal & Econophysics Tools for Financial Time Series using JAX (GPU-Accelerated)

Project description

FracJax 🚀

High-Performance Fractal & Econophysics Tools for Financial Time Series using JAX.

License: MIT Python JAX

FracJax is a production-grade Python library designed for quantitative finance and econophysics. It leverages Google JAX to perform heavy fractal and multifractal analysis on financial time series with GPU acceleration, achieving speeds up to 300x faster than standard CPU-based libraries (like nolds or hurst).

Key Feature: FracJax combines modern statistical robustness (Theil-Sen Estimator) with fractal theory (DFA, Wavelet Leaders) to extract noise-free, lag-free market regime signals.


⚡ Why FracJax?

Feature Standard Libs (nolds/hurst) FracJax
Backend CPU (NumPy) GPU/TPU (JAX)
Speed (1M points) ~5-10 Minutes ~1 Second
Regression Least Squares (Sensitive to noise) Theil-Sen (Robust to outliers)
Microscope Monofractal only Multifractal (Wavelet Leaders)
Stability Fails on short windows (<100) Stable on short windows

📦 Features

FracJax calculates 10+ advanced market features across multiple dimensions:

1. Fractal & Memory (The "Market Microscope")

  • DFA (Detrended Fluctuation Analysis): Robust long-term memory estimation (Trend vs. Mean Reversion).
  • Wavelet Leaders: Multifractal singularity spectrum analysis (Detects structural shocks).
  • Higuchi Fractal Dimension: Measures market roughness and complexity.

2. Microstructure & Liquidity

  • Rolling CVD Proxy: Estimates aggressive buy/sell pressure from OHLCV.
  • Amihud Illiquidity: Measures price impact per unit of volume.

3. Volatility & Risk

  • GARCH(1,1) Forecast: Forward-looking volatility prediction.
  • Realized Semivariance (RSV): Downside-specific volatility measure.
  • Hill Estimator: Tail risk and fat-tail index estimation.

4. Information Theory & Inter-market

  • Permutation Entropy: Measures time-series chaos and unpredictability.
  • Cointegration Z-Score: Robust spread analysis between asset pairs.
  • Lead-Lag Mutual Information: Measures non-linear information flow between assets (using Gaussian KDE).

🛠 Installation

pip install fracjax .

🚀 Quick Start

FracJax provides a high-level API create_market_microscope that JIT-compiles kernels for maximum speed.

import numpy as np
from fracjax import create_market_microscope

# Generate dummy price data (Random Walk)
prices = np.cumsum(np.random.randn(10000)) + 1000

# 1. Initialize Kernels (Compiles once)
# Method options: 'dfa', 'wavelet', 'higuchi', 'garch', 'cvd', etc.
calc_dfa = create_market_microscope(
    method='dfa', 
    window_size=100, 
    batch_size=4096
)

calc_wavelet = create_market_microscope(
    method='wavelet', 
    window_size=100,
    max_level=4
)

# 2. Run on Data (Ultra Fast)
hurst_dfa = calc_dfa(prices)
hurst_wavelet = calc_wavelet(prices)

print(f"DFA Signal (Last): {hurst_dfa[-1]:.4f}")

📊 Visual Showcase

FracJax reveals the hidden anatomy of the market. Below is a dashboard generated using FracJax on 7 years of Forex data (60-day zoom):

(Note: Replace this link with your actual image path after uploading)


🤝 Contributing

Contributions are welcome! Please ensure any PRs maintain JAX functional purity (no side effects) and include type hints.


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fracjax-0.1.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fracjax-0.1.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file fracjax-0.1.0.tar.gz.

File metadata

  • Download URL: fracjax-0.1.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for fracjax-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64111877f3d89a7e53f0249efed9691346a439ccf69511264b2e40252f919d96
MD5 9accf2c60209e6b6a0bcb272f0058bc5
BLAKE2b-256 1038b8b368dfd08f0488a32c2b604e9f2cbc4fb2053b5a5942216d063a64518a

See more details on using hashes here.

File details

Details for the file fracjax-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fracjax-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for fracjax-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8cf8e52863d646588ffdb2856757df9488a86cafb3ce024d5464a0d08e8cf76
MD5 3c77a8b57df8c19acc83e73cf4fe5395
BLAKE2b-256 b59a4ee5c7874d561d6945cf67b2f5d7f7c48ac78a78d75ec4d892f054f26c64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page