AI4Finance-Foundation/FinRL_Crypto
소개
FinRL_Crypto: Cryptocurrency trading of FinRL
비즈니스 및 금융측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +3
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalFinRL_Crypto: Address Overfitting DRL Agents for Cryptocurrency Trading
For financial reinforcement learning (FinRL), we provide a way to address the dreaded overfitting trap and increase your chances of success in the wild world of cryptocurrency trading. Our approach has been tested on 10 different currencies and during a market crash period, and has proven to be more profitable than the competition. So, don't just sit there, join us on our journey to the top of the crypto mountain!
Paper
Our paper
How to Use FinRL_Crypto with Binance API
This repository is ready for work with Binance API for cryptocurrency trading using Deep Reinforcement Learning (DRL).
📋 What's Already Done
✅ Updated Dependencies - All packages are compatible with Python 3.8+ (and recommended for Python 3.10).
✅ Fixed Deprecated Methods - Code is compatible with new versions of pandas and numpy.
✅ Added Error Handling - Improved stability during execution.
✅ Optimized Performance - Replaced outdated pandas methods with more efficient alternatives.
🔧 Requirements
- Python 3.10 (Recommended version)
- Binance API keys
🎯 Setup
1. Install Dependencies
For Python 3.10 (Recommended):
pip install -r requirements-python310.txt
For Python 3.11+:
pip install -r requirements.txt
2. Configure Binance API Keys
- Log in to your Binance account → API Management
- Create new API keys
- Open
config_api.pyand replace placeholders:
API_KEY_BINANCE = 'YOUR_PUBLIC_API_KEY'
API_SECRET_BINANCE = 'YOUR_SECRET_API_KEY'
3. Verify Configuration
Main settings are configured in config_main.py:
- TIMEFRAME:
'5m'- 5-minute candlesticks - TICKER_LIST: List of cryptocurrencies for trading (e.g.,
['BTC', 'ETH'])) - TECHNICAL_INDICATORS: Technical indicators (MACD, RSI, CCI, DX)
🎯 Quick Start Guide
1. Download Data
python 0_dl_trainval_data.py # Download training/validation data
python 0_dl_trade_data.py # Download trade data
2. Optimize Hyperparameters
Choose one of the following optimization schemes:
- Combinatorial Purged Cross-validation:
python 1_optimize_cpcv.py - K-Fold Cross-validation:
python 1_optimize_kcv.py - Walk-forward validation:
python 1_optimize_wf.py
3. Validate Trained Agents
python 2_validate.py
4. Backtest Trained Agents
python 4_backtest.py
🔍 Core Components
📁 Project Files
config_main.py: Main configuration file.config_api.py: Binance API keys.processor_Binance.py: Data processing for Binance API.environment_Alpaca.py(Note: Alpaca is a separate trading environment; this project focuses on Binance).drl_agents/: DRL algorithms (e.g., PPO, A2C, DDPG, TD3, SAC).
💡 Supported Cryptocurrencies
- AAVE, AVAX, BTC, ETH, LINK, LTC, MATIC, NEAR, SOL, UNI
- New cryptocurrencies can be added to
config_main.py.
📊 Technical Indicators
- MACD (Moving Average Convergence Divergence)
- RSI (Relative Strength Index)
- CCI (Commodity Channel Index)
- DX (Directional Movement Index)
⚠️ Important Notes
- API Keys: Never store API keys in public repositories.
- Testing: Test on a demo account first.
- Risks: Cryptocurrency trading involves high risks.
- Versions: Ensure you are using Python 3.8+.
🔧 Troubleshooting
Error: "API keys not configured"
- Check
config_api.py - Ensure API keys are entered correctly
Error: "No data returned"
- Check internet connectivity
- Ensure cryptocurrency symbols are correct
- Check Binance API rate limits
Dependency Issues
# Install TA-Lib (if needed)
conda install -c conda-forge ta-lib # For Anaconda
# or for macOS:
brew install ta-lib
📈 Additional Features
Visualization of Results
Results are saved in the /plots_and_metrics/ folder.
Customizing Parameters
- Modify dates in
config_main.py - Tune technical indicators (e.g., MACD parameters)
- Adjust cryptocurrency lists in
config_main.py
🆘 Support
If you encounter issues:
- Check error logs for clues.
- Verify all dependencies are installed (run
pip install -r requirements.txtorpip install -r requirements-python310.txt). - Confirm Binance API keys are correctly configured in
config_api.py.
Ready to Go! 🚀
This project is fully configured for cryptocurrency trading on Binance using advanced Deep Reinforcement Learning algorithms.
관련 프로젝트 살펴보기
불러오는 중…