Skip to main content

A modified version of alphalens with updated dependencies and fixes

Project description

AlphaLens Modify

🇨🇳 中文 | 🇺🇸 English

Author: XiaoYinXu

AlphaLens Modify is a modified version of the original AlphaLens library with updated dependencies and compatibility fixes for modern Python environments.

📊 Analysis Results Showcase

This project includes comprehensive factor analysis capabilities. Here are some example results:

本项目包含全面的因子分析功能。以下是一些示例结果:

🔍 Information Coefficient (IC) Analysis

IC Value Distribution

The Information Coefficient measures the predictive power of alpha factors, showing the correlation between factor values and future returns.

📈 Cumulative Return Analysis

Cumulative Returns

Cumulative returns demonstrate the long-term performance of factor-based investment strategies over time.

📊 Group Mean Return Analysis

Group Mean Returns

Group analysis shows how different factor quantiles perform, helping identify the most effective investment segments.

🔄 Factor Turnover Analysis

Turnover Analysis

Turnover analysis evaluates the stability and trading frequency of factor-based strategies.

🚀 Quick Start

import alphalens_modify as al
import pandas as pd

# Load your factor data and pricing data
factor_data = pd.read_csv('factor_data.csv')
price_data = pd.read_csv('price_data.csv')

# Get clean factor and forward returns
factor_returns = al.utils.get_clean_factor_and_forward_returns(
    factor_data, 
    price_data, 
    periods=[1, 5, 10]
)

# Create comprehensive analysis
al.tears.create_summary_tear_sheet(factor_returns)
al.tears.create_returns_tear_sheet(factor_returns)
al.tears.create_information_tear_sheet(factor_returns)

📦 Installation

From PyPI

pip install alphalens-modify

From Source

git clone https://github.com/GenjiYin/alphalens-modify.git
cd alphalens-modify
pip install -e .

📋 Requirements

  • Python >= 3.12
  • pandas >= 1.0.0
  • numpy >= 1.16.0
  • empyrical >= 0.5.0
  • scipy >= 1.0.0
  • statsmodels >= 0.9.0
  • matplotlib >= 3.0.0
  • seaborn >= 0.9.0
  • IPython >= 7.0.0

🎯 Key Features

  • Factor Performance Analysis: Analyze the predictive power of alpha factors
  • Information Coefficient: Calculate and visualize IC metrics
  • Quantile Analysis: Performance analysis by factor quantiles
  • Group Analysis: Sector-based and custom group analysis
  • Turnover Analysis: Evaluate factor stability and trading frequency
  • Event Studies: Analyze factor performance around specific events

📊 Complete Analysis Pipeline

The library provides a complete factor analysis workflow:

  1. Data Preparation: Clean and prepare factor and price data
  2. Performance Metrics: Calculate IC, returns, turnover metrics
  3. Visualization: Generate comprehensive charts and plots
  4. Reporting: Create detailed tear sheets for analysis

🔧 Example Usage

See the included Jupyter notebook market_cap_factor_analys.ipynb for a complete example using market capitalization factor analysis.

Note: To run the market_cap_factor_analys.ipynb notebook, you need to download the test_data folder from the GitHub repository:

  1. Go to the GitHub repository
  2. Navigate to the test_data folder
  3. Download all the files in the test_data folder
  4. Place them in a test_data directory in your local project root

The notebook requires these data files to demonstrate the factor analysis functionality.

🤝 Support

If you encounter any issues or have questions, please open an issue on GitHub.

📄 License

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

👤 Author

XiaoYinXu - 965418170@qq.com

🙏 Acknowledgments

This project is based on the original AlphaLens library by Quantopian. Thanks to the original contributors for their work on the factor analysis framework.

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

alphalens_modify-0.1.0.tar.gz (24.0 MB view details)

Uploaded Source

Built Distribution

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

alphalens_modify-0.1.0-py3-none-any.whl (21.8 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: alphalens_modify-0.1.0.tar.gz
  • Upload date:
  • Size: 24.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for alphalens_modify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b9a53ee215c097cc5e1acac3c5f396385c2c92c190bd4ce0ab62ec1ce200339f
MD5 733cd8460aec0aeb5e58c7ea7fef421f
BLAKE2b-256 5105b2c2d1a898ba212d685d0200336fc27ea9b06f0b74e30309773ff2fb5fb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alphalens_modify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a4d647af3a3f7895af5d070d867424f7b24ec43152d8555b61bae3b3213d08c
MD5 0e409e72ff1e35d47bc434d1adf9d9f6
BLAKE2b-256 17b5e04c447b978d964358dab2ac06dfc89fd587040268bb9c77812d80a82dac

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