- Notifications
You must be signed in to change notification settings - Fork2
📈 Machine learning for cryptocurrency chart pattern detection and technical analysis using Python and deep learning models
License
tysoncung/crypto-chart-patterns
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Advanced technical analysis tool for detecting chart patterns in cryptocurrency markets.
This project implements comprehensive pattern recognition algorithms to identify chart patterns in cryptocurrency price data. The tool fetches real-time data from Binance API and uses local extrema detection combined with mathematical analysis to identify patterns automatically.
- Inverse Head and Shoulders (IHS) - Bullish reversal
- Head and Shoulders (HS) - Bearish reversal
- Double Top (DT) - Bearish reversal
- Double Bottom (DB) - Bullish reversal
- Triangle Patterns - Ascending, Descending, Symmetrical
- Wedge Patterns - Rising (bearish), Falling (bullish)
- Flag Patterns - Bull flags, Bear flags
- Channel Patterns - Ascending, Descending, Horizontal
- Cup and Handle - Bullish continuation
- Real-time cryptocurrency data fetching from Binance
- Automatic pattern detection using mathematical algorithms
- Visual pattern highlighting on price charts
- Forward return analysis for pattern validation
- Multiple timeframe support (1m, 5m, 15m, 30m, 1h, 4h, 1d)
- Comprehensive testing suite with 90%+ coverage
- CI/CD with GitHub Actions
pandas>=1.3.0numpy>=1.21.0scipy>=1.7.0matplotlib>=3.4.0requests>=2.26.0tqdm>=4.62.0pytest>=7.0.0pytest-cov>=3.0.0
git clone https://github.com/tysoncung/crypto-chart-patterns.gitcd crypto-chart-patternspip install -r requirements.txt# Detect patterns for a specific symbolpython pattern_detector.py --symbol ETHUSDT --interval 4h# Run demo with all patternspython demo.py --symbol BTCUSDT --interval 1h# Generate comprehensive reportpython generate_report.py# Run testspytest test_patterns.py -v
frompattern_detectorimportPatternDetectorfromenhanced_patternsimportEnhancedPatternDetector# Initialize detectordetector=PatternDetector("BTCUSDT","1h")# Run complete analysisresults=detector.run_analysis()# Or step by step:klines=detector.get_data(limit=500)prices=detector.binance_to_df(klines)max_min=detector.get_max_min(prices)patterns=detector.find_patterns(max_min)# Enhanced patternsenhanced=EnhancedPatternDetector()all_patterns=enhanced.detect_all_patterns(prices,max_min)
Run the comprehensive test suite:
# Run all testspytest test_patterns.py -v# Run with coveragepytest test_patterns.py --cov=pattern_detector --cov=enhanced_patterns# Run specific testpytest test_patterns.py::TestPatternDetector::test_triangle_pattern_detection
This project uses GitHub Actions for continuous integration:
- Automated Testing: Multiple Python versions (3.8-3.11)
- Coverage Reporting: Integration with Codecov
- Daily Demos: Scheduled pattern detection runs
- Artifact Generation: Analysis reports and visualizations
- Inverse Head and Shoulders (IHS) - Bullish reversal
- Head and Shoulders (HS) - Bearish reversal
- Double Top (DT) - Bearish reversal
- Double Bottom (DB) - Bullish reversal
- Ascending Triangle - Bullish continuation (flat top, rising bottom)
- Descending Triangle - Bearish continuation (falling top, flat bottom)
- Symmetrical Triangle - Neutral (converging lines)
- Rising Wedge - Bearish reversal (converging upward)
- Falling Wedge - Bullish reversal (converging downward)
- Bull Flag - Bullish continuation after strong upward move
- Bear Flag - Bearish continuation after strong downward move
- Ascending Channel - Upward trending parallel lines
- Descending Channel - Downward trending parallel lines
- Horizontal Channel - Sideways trading range
- Cup and Handle - Bullish continuation (U-shape with handle)
This tool is for educational and research purposes only. Cryptocurrency trading involves substantial risk of loss. Past pattern performance does not guarantee future results. Always do your own research and consider consulting with a financial advisor.
Contributions are welcome! Please feel free to submit a Pull Request. Areas for improvement:
- Add more chart patterns (Triangle, Flag, Wedge, etc.)
- Implement machine learning for pattern validation
- Add backtesting capabilities
- Support for more exchanges
- Real-time pattern alerts
MIT License - see LICENSE file for details
Tyson Cung
- GitHub:@tysoncung
- Binance for providing free API access
- The Python scientific computing community
- Technical analysis researchers and practitioners
About
📈 Machine learning for cryptocurrency chart pattern detection and technical analysis using Python and deep learning models
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.