Skip to content

Darthreign/KuCoin-EMA-Scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

English Readme is under French :

πŸš€ KuCoin EMA Scanner & Auto Trader

Un programme Python avancΓ© pour scanner automatiquement les cryptomonnaies sur KuCoin et exΓ©cuter des trades basΓ©s sur les signaux EMA20 avec gestion automatique des Stop Loss et Take Profits via les niveaux de Fibonacci.

✨ Fonctionnalités

πŸ” Scanner Intelligent

  • Scan temps rΓ©el de tous les coins sur KuCoin
  • DΓ©tection EMA20 : Identifie les coins qui franchissent leur EMA20 en timeframe 4h
  • Filtre volume : DΓ©tecte les augmentations de volume >50% par rapport Γ  la bougie prΓ©cΓ©dente
  • Filtre futures : Ne sΓ©lectionne que les coins avec contrats perpΓ©tuels disponibles
  • Nouveaux listings : Surveillance continue des nouveaux coins listΓ©s

πŸ’° Trading AutomatisΓ©

  • Ordres intelligents : Placement automatique d'ordres d'achat avec SL/TP
  • Fibonacci intΓ©grΓ© : Calcul automatique des niveaux TP basΓ©s sur les retracements/extensions Fibonacci (timeframe 15min)
  • Gestion des risques : Stop Loss configurables et Take Profits multiples (TP1, TP2, TP3)
  • Taille de position adaptative : Calcul automatique basΓ© sur le risque dΓ©fini

πŸ–₯️ Interface Utilisateur

  • Interface Streamlit moderne et intuitive
  • Dashboard en temps rΓ©el avec mΓ©triques de performance
  • Configuration flexible : ParamΓ©trage complet des stratΓ©gies
  • Logs dΓ©taillΓ©s : Suivi de toutes les transactions et signaux
  • Graphiques de performance : Visualisation des rΓ©sultats

πŸ“¦ Installation

PrΓ©requis

  • Python 3.8 ou supΓ©rieur
  • Compte KuCoin avec API activΓ©e
  • TA-Lib installΓ© sur votre systΓ¨me

Installation des dΓ©pendances

# Cloner le projet
git clone <repository-url>
cd kucoin-ema-scanner

# Installer les dΓ©pendances Python
pip install -r requirements.txt

# Installation de TA-Lib (requis pour l'analyse technique)
# Sur Windows : tΓ©lΓ©charger le wheel depuis https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib
# Sur macOS : brew install ta-lib
# Sur Ubuntu/Debian : sudo apt-get install libta-lib-dev

βš™οΈ Configuration

1. Configuration API KuCoin

CrΓ©ez un fichier .env Γ  la racine du projet :

# Configuration KuCoin API
KUCOIN_API_KEY=your_api_key_here
KUCOIN_API_SECRET=your_api_secret_here
KUCOIN_PASSPHRASE=your_passphrase_here
KUCOIN_SANDBOX=true  # false pour le trading rΓ©el

# Configuration optionnelle
LOG_LEVEL=INFO

2. Obtenir les clΓ©s API KuCoin

  1. Connectez-vous Γ  votre compte KuCoin
  2. Allez dans API Management dans les paramètres
  3. CrΓ©ez une nouvelle API avec les permissions :
    • General (lecture du compte)
    • Trade (placement d'ordres)
    • Futures (accΓ¨s aux contrats Γ  terme)
  4. Notez bien votre Passphrase lors de la crΓ©ation
  5. Configurez les restrictions IP si nΓ©cessaire

3. Configuration des paramètres

Le fichier config.py contient tous les paramètres configurables :

# Scanner
SCAN_INTERVAL = 60  # Intervalle de scan en secondes
VOLUME_THRESHOLD = 50  # Seuil d'augmentation du volume en %
EMA_PERIOD = 20  # PΓ©riode EMA

# Trading
DEFAULT_POSITION_SIZE = 100  # Taille de position en USDT
DEFAULT_SL_PERCENT = 2.0  # Stop Loss en %
TP1_PERCENT = 1.5  # Take Profit 1 en %
TP2_PERCENT = 3.0  # Take Profit 2 en %
TP3_PERCENT = 5.0  # Take Profit 3 en %

πŸš€ Utilisation

Lancement du programme

# Lancer l'interface graphique
streamlit run main.py

# Ou directement
python main.py

Tests prΓ©liminaires

# VΓ©rifier l'installation et la configuration
python main.py --test

# Afficher l'aide
python main.py --help

Utilisation de l'interface

  1. Configuration : Ajustez les paramètres dans la barre latérale
  2. DΓ©marrage : Cliquez sur "▢️ DΓ©marrer" pour lancer le scanner automatique
  3. Surveillance : Consultez l'onglet "🎯 Signaux" pour voir les détections
  4. Trading : ExΓ©cutez les trades manuellement ou configurez l'automatisation
  5. Suivi : Surveillez vos positions dans "πŸ’Ό Trades Actifs"

πŸ“Š Structure du Projet

/kucoin-ema-scanner/
β”œβ”€β”€ main.py              # Point d'entrΓ©e principal
β”œβ”€β”€ scanner.py           # Logic de scan et dΓ©tection des signaux
β”œβ”€β”€ trading.py           # Gestion des ordres et du trading
β”œβ”€β”€ gui.py              # Interface utilisateur Streamlit
β”œβ”€β”€ config.py           # Configuration globale
β”œβ”€β”€ requirements.txt    # DΓ©pendances Python
β”œβ”€β”€ README.md          # Documentation
β”œβ”€β”€ .env               # Variables d'environnement (Γ  crΓ©er)
└── trading.log        # Fichier de logs (gΓ©nΓ©rΓ© automatiquement)

πŸ›‘οΈ StratΓ©gie de Trading

Critères de Détection

  1. EMA20 Crossover : Le prix franchit l'EMA20 Γ  la hausse sur timeframe 4h
  2. Volume Spike : Augmentation du volume >50% par rapport Γ  la bougie prΓ©cΓ©dente
  3. Contrat Future : Le coin doit avoir un contrat perpΓ©tuel disponible sur KuCoin

Gestion des Positions

  • EntrΓ©e : Ordre au marchΓ© lors de la dΓ©tection du signal
  • Stop Loss : CalculΓ© automatiquement (dΓ©faut : 2% sous le prix d'entrΓ©e)
  • Take Profits : 3 niveaux basΓ©s sur les extensions de Fibonacci
    • TP1 : 1/3 de la position (niveau 1.272 ou 1.5% par dΓ©faut)
    • TP2 : 1/3 de la position (niveau 1.414 ou 3% par dΓ©faut)
    • TP3 : 1/3 de la position (niveau 1.618 ou 5% par dΓ©faut)

Calcul Fibonacci

  • Timeframe : 15 minutes pour plus de prΓ©cision
  • Swing Points : DΓ©tection automatique des hauts/bas rΓ©cents
  • Niveaux utilisΓ©s :
    • Extensions : 1.272, 1.414, 1.618, 2.0, 2.618
    • Retracements : 0.236, 0.382, 0.5, 0.618, 0.786

πŸ“ˆ FonctionnalitΓ©s AvancΓ©es

Scanner en Temps RΓ©el

  • Surveillance continue de tous les marchΓ©s KuCoin
  • DΓ©tection automatique des nouveaux listings
  • Filtrage intelligent des signaux de qualitΓ©

Interface Dashboard

  • MΓ©triques en temps rΓ©el : Solde, positions, performance
  • Graphiques interactifs : Γ‰volution des P&L, historique des trades
  • Logs dΓ©taillΓ©s : TraΓ§abilitΓ© complΓ¨te des opΓ©rations
  • Configuration dynamique : Modification des paramΓ¨tres sans redΓ©marrage

Gestion des Risques

  • Position Sizing : Calcul automatique basΓ© sur le risque dΓ©fini
  • Stop Loss adaptatif : Ajustement selon la volatilitΓ© du marchΓ©
  • Take Profits Γ©chelonnΓ©s : RΓ©duction progressive du risque
  • Limite de drawdown : Protection contre les pertes importantes

⚠️ Avertissements et Risques

Risques du Trading AutomatisΓ©

  • Pertes financiΓ¨res : Le trading comportes des risques de perte en capital
  • VolatilitΓ© : Les cryptomonnaies sont extrΓͺmement volatiles
  • Bugs logiciels : Aucun programme n'est exempt d'erreurs
  • Conditions de marchΓ© : Les stratΓ©gies peuvent ne pas fonctionner dans tous les environnements

Bonnes Pratiques

  1. Testez d'abord en sandbox avant le trading rΓ©el
  2. Commencez avec de petits montants pour valider la stratΓ©gie
  3. Surveillez régulièrement les positions ouvertes
  4. Sauvegardez vos clΓ©s API en sΓ©curitΓ©
  5. Gardez le logiciel Γ  jour pour les correctifs de sΓ©curitΓ©

Recommandations de SΓ©curitΓ©

  • Utilisez des clΓ©s API avec permissions limitΓ©es
  • Configurez des restrictions IP sur vos clΓ©s API
  • Ne partagez jamais vos clΓ©s API ou passphrase
  • Utilisez un VPN si vous tradez depuis des rΓ©seaux publics
  • Gardez des sauvegardes de votre configuration

πŸ”§ DΓ©pannage

Problèmes Courants

Erreur "Exchange non initialisΓ©"

  • VΓ©rifiez vos clΓ©s API dans le fichier .env
  • Assurez-vous que les permissions API sont correctes
  • Testez la connexion avec python main.py --test

Erreur "TA-Lib non trouvΓ©"

  • Installez TA-Lib pour votre systΓ¨me d'exploitation
  • RedΓ©marrez votre environnement Python aprΓ¨s installation

Aucun signal dΓ©tectΓ©

  • VΓ©rifiez que le seuil de volume n'est pas trop Γ©levΓ©
  • Assurez-vous que les marchΓ©s sont actifs (heures de trading)
  • Consultez les logs pour identifier d'Γ©ventuelles erreurs

Interface Streamlit ne se charge pas

  • VΓ©rifiez que le port 8501 n'est pas utilisΓ©
  • Essayez streamlit run main.py --server.port 8502
  • Videz le cache avec streamlit cache clear

πŸ“š API et Documentation

KuCoin API

Bibliothèques Utilisées

  • CCXT : Connexion aux exchanges de cryptomonnaies
  • TA-Lib : Analyse technique et calculs d'indicateurs
  • Pandas : Manipulation et analyse de donnΓ©es
  • Streamlit : Interface utilisateur web
  • Plotly : Graphiques interactifs

🀝 Contribution

Les contributions sont les bienvenues ! Pour contribuer :

  1. Forkez le projet
  2. CrΓ©ez une branche pour votre fonctionnalitΓ© (git checkout -b feature/nouvelle-fonctionnalite)
  3. Committez vos changements (git commit -am 'Ajout nouvelle fonctionnalitΓ©')
  4. Poussez vers la branche (git push origin feature/nouvelle-fonctionnalite)
  5. Ouvrez une Pull Request

IdΓ©es d'AmΓ©liorations

  • Support d'autres exchanges (Binance, OKX, etc.)
  • StratΓ©gies de trading additionnelles
  • Backtesting intΓ©grΓ©
  • Notifications (Discord, Telegram, email)
  • Mode paper trading
  • API REST pour intΓ©grations externes

πŸ“„ Licence

Ce projet est sous licence MIT. Voir le fichier LICENSE pour plus de dΓ©tails.

πŸ†˜ Support

Pour obtenir de l'aide :

  1. Issues GitHub : Signalez les bugs et demandez des fonctionnalitΓ©s
  2. Discussions : Posez vos questions dans les discussions GitHub
  3. Documentation : Consultez ce README et les commentaires du code

πŸ† Remerciements

  • KuCoin pour leur API robuste et bien documentΓ©e
  • CCXT pour l'excellente bibliothΓ¨que d'accΓ¨s aux exchanges
  • Streamlit pour l'outil de crΓ©ation d'interfaces web en Python
  • La communautΓ© open source pour les nombreuses bibliothΓ¨ques utilisΓ©es

⚠️ Avertissement Final : Ce logiciel est fourni "tel quel" sans aucune garantie. L'utilisation de ce programme pour le trading de cryptomonnaies comporte des risques financiers importants. Les utilisateurs sont entièrement responsables de leurs décisions de trading et de toute perte financière qui pourrait en résulter. Tradez uniquement avec des fonds que vous pouvez vous permettre de perdre.


πŸš€ KuCoin EMA Scanner & Auto Trader

An advanced Python program to automatically scan cryptocurrencies on KuCoin and execute trades based on EMA20 signals, with automatic Stop Loss and Take Profit management using Fibonacci levels.

✨ Features

πŸ” Smart Scanner

  • Real-time scanning of all coins on KuCoin
  • EMA20 Detection: Identifies coins crossing their 4h EMA20
  • Volume filter: Detects volume increases >50% compared to the previous candle
  • Futures filter: Only selects coins with available perpetual contracts
  • New listings: Continuous monitoring of newly listed coins

πŸ’° Automated Trading

  • Smart orders: Automatic placement of buy orders with SL/TP
  • Built-in Fibonacci: Automatic calculation of TP levels based on Fibonacci retracements/extensions (15min timeframe)
  • Risk management: Configurable Stop Loss and multiple Take Profits (TP1, TP2, TP3)
  • Adaptive position sizing: Automatically calculated based on defined risk

πŸ–₯️ User Interface

  • Modern, intuitive Streamlit interface
  • Real-time dashboard with performance metrics
  • Flexible configuration: Fully customizable strategies
  • Detailed logs: Tracks all trades and signals
  • Performance charts: Visualization of results

πŸ“¦ Installation

Prerequisites

  • Python 3.8 or higher
  • KuCoin account with API enabled
  • TA-Lib installed on your system

Installing Dependencies

# Clone the project
git clone <repository-url>
cd kucoin-ema-scanner

# Install Python dependencies
pip install -r requirements.txt

# TA-Lib installation (required for technical analysis)
# On Windows: download the wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib
# On macOS: brew install ta-lib
# On Ubuntu/Debian: sudo apt-get install libta-lib-dev

βš™οΈ Configuration

1. KuCoin API Configuration

Create a .env file in the root of the project:

# KuCoin API configuration
KUCOIN_API_KEY=your_api_key_here
KUCOIN_API_SECRET=your_api_secret_here
KUCOIN_PASSPHRASE=your_passphrase_here
KUCOIN_SANDBOX=true  # false for live trading

# Optional configuration
LOG_LEVEL=INFO

2. Get KuCoin API Keys

  1. Log into your KuCoin account

  2. Go to API Management in settings

  3. Create a new API with permissions:

    • General (account read access)
    • Trade (order placement)
    • Futures (access to futures contracts)
  4. Note your Passphrase during creation

  5. Configure IP restrictions if necessary

3. Strategy Configuration

The config.py file contains all configurable parameters:

# Scanner
SCAN_INTERVAL = 60  # Scan interval in seconds
VOLUME_THRESHOLD = 50  # Volume increase threshold in %
EMA_PERIOD = 20  # EMA period

# Trading
DEFAULT_POSITION_SIZE = 100  # Position size in USDT
DEFAULT_SL_PERCENT = 2.0  # Stop Loss in %
TP1_PERCENT = 1.5  # Take Profit 1 in %
TP2_PERCENT = 3.0  # Take Profit 2 in %
TP3_PERCENT = 5.0  # Take Profit 3 in %

πŸš€ Usage

Launch the Program

# Launch the graphical interface
streamlit run main.py

# Or directly
python main.py

Preliminary Tests

# Check installation and configuration
python main.py --test

# Display help
python main.py --help

Using the Interface

  1. Configuration: Adjust settings in the sidebar
  2. Start: Click "▢️ Start" to launch the auto-scanner
  3. Monitoring: View the "🎯 Signals" tab for detections
  4. Trading: Execute trades manually or enable automation
  5. Tracking: Monitor your positions in "πŸ’Ό Active Trades"

πŸ“Š Project Structure

/kucoin-ema-scanner/
β”œβ”€β”€ main.py              # Main entry point
β”œβ”€β”€ scanner.py           # Scan logic and signal detection
β”œβ”€β”€ trading.py           # Order and trading management
β”œβ”€β”€ gui.py               # Streamlit user interface
β”œβ”€β”€ config.py            # Global configuration
β”œβ”€β”€ requirements.txt     # Python dependencies
β”œβ”€β”€ README.md            # Documentation
β”œβ”€β”€ .env                 # Environment variables (to create)
└── trading.log          # Log file (auto-generated)

πŸ›‘οΈ Trading Strategy

Detection Criteria

  1. EMA20 Crossover: Price crosses above EMA20 on 4h timeframe
  2. Volume Spike: Volume increases >50% compared to the previous candle
  3. Futures Contract: The coin must have a perpetual contract available on KuCoin

Position Management

  • Entry: Market order upon signal detection

  • Stop Loss: Automatically calculated (default: 2% below entry price)

  • Take Profits: 3 levels based on Fibonacci extensions

    • TP1: 1/3 of position (level 1.272 or 1.5% default)
    • TP2: 1/3 of position (level 1.414 or 3% default)
    • TP3: 1/3 of position (level 1.618 or 5% default)

Fibonacci Calculation

  • Timeframe: 15 minutes for precision

  • Swing Points: Automatic detection of recent highs/lows

  • Used Levels:

    • Extensions: 1.272, 1.414, 1.618, 2.0, 2.618
    • Retracements: 0.236, 0.382, 0.5, 0.618, 0.786

πŸ“ˆ Advanced Features

Real-Time Scanner

  • Continuous monitoring of all KuCoin markets
  • Automatic detection of new listings
  • Smart filtering of high-quality signals

Dashboard Interface

  • Real-time metrics: Balance, positions, performance
  • Interactive charts: P&L evolution, trade history
  • Detailed logs: Full traceability of operations
  • Dynamic configuration: Modify parameters without restarting

Risk Management

  • Position sizing: Automatically calculated based on defined risk
  • Adaptive Stop Loss: Adjusted according to market volatility
  • Staggered Take Profits: Gradual risk reduction
  • Drawdown limit: Protection from significant losses

⚠️ Warnings and Risks

Risks of Automated Trading

  • Financial loss: Trading carries the risk of capital loss
  • Volatility: Cryptocurrencies are extremely volatile
  • Software bugs: No software is bug-free
  • Market conditions: Strategies may not work in all environments

Best Practices

  1. Test in sandbox first before going live
  2. Start with small amounts to validate the strategy
  3. Monitor open positions regularly
  4. Keep your API keys secure
  5. Keep the software updated for security patches

Security Recommendations

  • Use API keys with limited permissions
  • Configure IP restrictions for your API keys
  • Never share your API keys or passphrase
  • Use a VPN when trading from public networks
  • Keep backups of your configuration

πŸ”§ Troubleshooting

Common Issues

"Exchange not initialized" error

  • Check your API keys in the .env file
  • Ensure correct API permissions
  • Test the connection with python main.py --test

"TA-Lib not found" error

  • Install TA-Lib for your OS
  • Restart your Python environment after installation

No signals detected

  • Check if volume threshold is too high
  • Make sure markets are active (during trading hours)
  • Consult logs to identify potential errors

Streamlit interface not loading

  • Check if port 8501 is occupied
  • Try streamlit run main.py --server.port 8502
  • Clear cache with streamlit cache clear

πŸ“š API and Documentation

KuCoin API

Libraries Used

  • CCXT: Connection to cryptocurrency exchanges
  • TA-Lib: Technical analysis and indicator calculations
  • Pandas: Data manipulation and analysis
  • Streamlit: Web-based user interface
  • Plotly: Interactive charts

🀝 Contributing

Contributions are welcome! To contribute:

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/new-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/new-feature)
  5. Open a Pull Request

Improvement Ideas

  • Support for other exchanges (Binance, OKX, etc.)
  • Additional trading strategies
  • Built-in backtesting
  • Notifications (Discord, Telegram, email)
  • Paper trading mode
  • REST API for external integrations

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for more details.

πŸ†˜ Support

For help:

  1. GitHub Issues: Report bugs and request features
  2. Discussions: Ask questions in GitHub Discussions
  3. Documentation: Refer to this README and code comments

πŸ† Acknowledgments

  • KuCoin for their robust and well-documented API
  • CCXT for the excellent exchange library
  • Streamlit for making Python web UIs easy
  • The open-source community for countless libraries used

⚠️ Final Disclaimer: This software is provided "as is" with no warranty. Using this tool for cryptocurrency trading carries significant financial risk. Users are fully responsible for their trading decisions and any financial loss incurred. Only trade with funds you can afford to lose.


About

Scan Breakout for KuCoin Future tradable coin

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages