Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

📈 Machine learning for cryptocurrency chart pattern detection and technical analysis using Python and deep learning models

License

NotificationsYou must be signed in to change notification settings

tysoncung/crypto-chart-patterns

Repository files navigation

Test and Demo

Advanced technical analysis tool for detecting chart patterns in cryptocurrency markets.

🎯 Overview

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.

🚀 Features

Basic Patterns

  • Inverse Head and Shoulders (IHS) - Bullish reversal
  • Head and Shoulders (HS) - Bearish reversal
  • Double Top (DT) - Bearish reversal
  • Double Bottom (DB) - Bullish reversal

Enhanced Patterns

  • 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

Capabilities

  • 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

📋 Requirements

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

🛠️ Installation

git clone https://github.com/tysoncung/crypto-chart-patterns.gitcd crypto-chart-patternspip install -r requirements.txt

📊 Quick Start

Command Line Usage

# 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

Python API

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)

🧪 Testing

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

🚀 CI/CD

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

📈 Pattern Types

Basic Patterns

  1. Inverse Head and Shoulders (IHS) - Bullish reversal
  2. Head and Shoulders (HS) - Bearish reversal
  3. Double Top (DT) - Bearish reversal
  4. Double Bottom (DB) - Bullish reversal

Triangle Patterns

  1. Ascending Triangle - Bullish continuation (flat top, rising bottom)
  2. Descending Triangle - Bearish continuation (falling top, flat bottom)
  3. Symmetrical Triangle - Neutral (converging lines)

Wedge Patterns

  1. Rising Wedge - Bearish reversal (converging upward)
  2. Falling Wedge - Bullish reversal (converging downward)

Flag Patterns

  1. Bull Flag - Bullish continuation after strong upward move
  2. Bear Flag - Bearish continuation after strong downward move

Channel Patterns

  1. Ascending Channel - Upward trending parallel lines
  2. Descending Channel - Downward trending parallel lines
  3. Horizontal Channel - Sideways trading range

Special Patterns

  1. Cup and Handle - Bullish continuation (U-shape with handle)

⚠️ Disclaimer

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.

🤝 Contributing

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

📝 License

MIT License - see LICENSE file for details

🔗 Resources

👤 Author

Tyson Cung

🙏 Acknowledgments

  • 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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp