A modified version of alphalens with updated dependencies and fixes
Project description
AlphaLens Modify
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
The Information Coefficient measures the predictive power of alpha factors, showing the correlation between factor values and future returns.
📈 Cumulative Return Analysis
Cumulative returns demonstrate the long-term performance of factor-based investment strategies over time.
📊 Group Mean Return Analysis
Group analysis shows how different factor quantiles perform, helping identify the most effective investment segments.
🔄 Factor 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:
- Data Preparation: Clean and prepare factor and price data
- Performance Metrics: Calculate IC, returns, turnover metrics
- Visualization: Generate comprehensive charts and plots
- 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:
- Go to the GitHub repository
- Navigate to the
test_datafolder - Download all the files in the
test_datafolder - Place them in a
test_datadirectory 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9a53ee215c097cc5e1acac3c5f396385c2c92c190bd4ce0ab62ec1ce200339f
|
|
| MD5 |
733cd8460aec0aeb5e58c7ea7fef421f
|
|
| BLAKE2b-256 |
5105b2c2d1a898ba212d685d0200336fc27ea9b06f0b74e30309773ff2fb5fb4
|
File details
Details for the file alphalens_modify-0.1.0-py3-none-any.whl.
File metadata
- Download URL: alphalens_modify-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a4d647af3a3f7895af5d070d867424f7b24ec43152d8555b61bae3b3213d08c
|
|
| MD5 |
0e409e72ff1e35d47bc434d1adf9d9f6
|
|
| BLAKE2b-256 |
17b5e04c447b978d964358dab2ac06dfc89fd587040268bb9c77812d80a82dac
|