Skip to content

RanuK12/algorithmic-trading-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Crypto Analysis Dashboard

A professional system for cryptocurrency market analysis and algorithmic trading strategies, featuring a modern web interface for real-time market insights and historical performance analysis. This project combines advanced data processing, machine learning, and real-time monitoring to provide comprehensive cryptocurrency market analysis.

🌟 Key Features

Real-time Market Analysis

  • Interactive dashboard with real-time cryptocurrency data
  • Technical indicators visualization (RSI, MACD, Bollinger Bands)
  • Multi-language support (English/Spanish)
  • Customizable time periods for analysis
  • Market trend identification and recommendations
  • Direct integration with Binance API for real-time crypto data

Advanced Data Processing

  • ETL pipeline for efficient data processing
  • Real-time data extraction from multiple sources:
    • Binance API for cryptocurrency data
    • Yahoo Finance for additional market data
  • Advanced data transformation and feature engineering
  • Efficient data loading and storage
  • Historical data analysis and backtesting

Trading Strategy Implementation

  • Moving Average Crossover strategy
  • Backtesting system with performance metrics
  • Risk analysis and performance evaluation
  • Advanced metrics calculation (Sharpe, Sortino, VaR, etc.)
  • Strategy optimization and parameter tuning

Monitoring and Alerts

  • Real-time market monitoring
  • Customizable price alerts
  • Trend change notifications
  • Volume spike detection
  • Performance tracking and reporting

Telegram Bot Integration

Our Telegram bot provides real-time market insights and automated trading signals. Here's what you can do with it:

  1. Market Analysis

    • Get real-time price updates
    • Receive technical analysis reports
    • View trend predictions
    • Monitor volume and volatility
  2. Trading Signals

    • Automated buy/sell signals
    • Price alerts
    • Trend change notifications
    • Volume spike alerts
  3. Custom Commands

    /start - Initialize the bot
    /help - Show available commands
    /analyze <symbol> - Get technical analysis
    /list - Show available cryptocurrencies
    /alert <symbol> - Set price alerts
    /trend <symbol> - Get trend analysis
    /volume <symbol> - Check volume analysis
    

Telegram Bot Interface Telegram bot interface showing real-time market analysis and commands

Supported Cryptocurrencies

  • Bitcoin (BTC)
  • Ethereum (ETH)
  • Binance Coin (BNB)
  • Stellar (XLM)
  • Ripple (XRP)
  • Dogecoin (DOGE)

πŸ–₯️ Dashboard Preview

Dashboard Overview Main dashboard interface showing real-time market data and technical analysis

Technical Analysis Detailed technical analysis with multiple indicators

Market Trends Market trend analysis and recommendations

Language Selection Multi-language support with English and Spanish interfaces

Cryptocurrency Selection Cryptocurrency selection interface with real-time price updates

πŸ“Έ Screenshots

Here's an overview of the dashboard's functionalities through screenshots:

Main Dashboard

This image shows the main dashboard interface, including language and cryptocurrency selection, along with key real-time market metrics. Main Dashboard

Technical Analysis Chart

Visualize detailed technical analysis with indicators like SMA 20, SMA 50, Bollinger Bands, and MACD, essential for understanding market trends. Technical Analysis Chart

Investor Report and Historical Data

A combined view of the dynamic investor report, offering a summary of the period, recommendations, and an explanation of the market trend, along with the historical data table. Investor Report and Historical Data

πŸ› οΈ Technical Architecture

System Components

  1. Data Processing Layer

    • ETL pipeline for data extraction and transformation
    • Real-time data processing
    • Historical data management
    • Feature engineering
  2. Analysis Layer

    • Technical analysis engine
    • Strategy implementation
    • Backtesting system
    • Performance metrics calculation
  3. Presentation Layer

    • Streamlit web interface
    • Telegram bot integration
    • Real-time alerts system
    • Data visualization
  4. Monitoring Layer

    • Prometheus metrics
    • Performance monitoring
    • System health checks
    • Alert management

Technology Stack

  • Backend: Python 3.8+
  • Web Framework: Streamlit
  • Data Processing: Pandas, NumPy
  • Data Sources:
    • Binance API (primary source for crypto data)
    • Yahoo Finance (supplementary market data)
  • Machine Learning: Scikit-learn
  • Visualization: Plotly
  • Monitoring: Prometheus
  • Containerization: Docker
  • Orchestration: Docker Compose
  • Workflow Management: Apache Airflow

πŸ“‹ Requirements

  • Python 3.8+
  • Dependencies listed in requirements.txt
  • Streamlit for web interface
  • Binance API for cryptocurrency data
  • YFinance for supplementary market data
  • python-telegram-bot for Telegram integration
  • Docker and Docker Compose (optional)
  • Prometheus (optional)

πŸš€ Installation

  1. Clone the repository:
git clone https://github.com/RanuK12/algorithmic-trading-python.git
cd algorithmic-trading-python
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure API Keys:

    • Create a Binance account and get your API keys
    • Add the keys to your environment variables or .env file:
      BINANCE_API_KEY=your_api_key_here
      BINANCE_API_SECRET=your_api_secret_here
      
  2. Configure Telegram Bot:

    • Create a new bot using @BotFather
    • Get your bot token
    • Add the token to your environment variables or .env file:
      TELEGRAM_BOT_TOKEN=your_bot_token_here
      
  3. Run the dashboard:

python -m streamlit run main.py
  1. Start the Telegram bot (in a separate terminal):
python telegram_bot.py

Docker Installation (Optional)

docker-compose up -d

πŸ’» Usage

Dashboard Interface

The dashboard provides several key features:

  1. Language Selection: Choose between English and Spanish interfaces
  2. Cryptocurrency Selection: Select from supported cryptocurrencies
  3. Time Period Selection: Choose analysis period (1d to 1y)
  4. Technical Indicators:
    • RSI (Relative Strength Index)
    • MACD (Moving Average Convergence Divergence)
    • Bollinger Bands
    • Moving Averages (20 and 50 periods)

Telegram Bot Usage

  1. Start the Bot

    • Send /start to initialize the bot
    • Use /help to see available commands
  2. Market Analysis

    • Use /analyze BTC to get technical analysis for Bitcoin
    • Receive technical analysis reports
    • View trend predictions
    • Monitor volume and volatility
  3. Price Alerts

    • Set price alerts with /alert BTC 50000
    • Get notified when price targets are reached
    • Receive trend change notifications
  4. Real-time Updates

    • Get instant market updates
    • Receive trading signals
    • Monitor portfolio performance

πŸ“Š Analysis Examples

Example Analysis

Here's an example of the analysis output for Bitcoin:

Trading Analysis - BTC
==================================================

1. Overall Performance:
   - Total Return: -27.87%
   - Annualized Return: -18.32%
   - Sharpe Ratio: -0.37
   - Sortino Ratio: -0.50

2. Trading Activity:
   - Number of Trades: 378
   - Success Rate: 49.21%
   - Profit Factor: 0.94
   - Average Gain/Loss Ratio: 0.97

3. Risk Analysis:
   - Annual Volatility: 39.22%
   - Maximum Drawdown: -55.93%
   - Calmar Ratio: -0.33
   - VaR (95%) : -3.98%
   - Expected Shortfall (95%) : -5.74%

Backtesting Results

PEPE (2024-05-01 to 2025-06-13)

PEPE Backtest Results

BTC (2024-05-01 to 2025-06-13)

BTC Backtest Results

DOGE (2024-05-01 to 2025-06-13)

DOGE Backtest Results

πŸ“ˆ Trading Metrics Guide

Performance Metrics

  • Total Return: Overall percentage gain/loss
    • Positive: Strategy is profitable
    • Negative: Strategy is losing money
  • Annualized Return: Yearly equivalent return
    • 20%: Excellent

    • 10-20%: Good
    • < 10%: Poor
  • Sharpe Ratio: Risk-adjusted returns
    • 1: Good

    • 2: Very Good

    • 3: Excellent

  • Sortino Ratio: Downside risk-adjusted returns
    • 1: Good

    • 2: Very Good

    • 3: Excellent

Trading Activity Metrics

  • Number of Trades: Total executed trades
    • High: > 100 trades/month
    • Medium: 50-100 trades/month
    • Low: < 50 trades/month
  • Success Rate: Percentage of profitable trades
    • 50%: Good

    • 60%: Very Good

    • 70%: Excellent

  • Profit Factor: Gross profit to gross loss ratio
    • 1: Profitable

    • 1.5: Good

    • 2: Excellent

  • Average Gain/Loss Ratio: Profit per winning trade vs loss per losing trade
    • 1: Good

    • 1.5: Very Good

    • 2: Excellent

Risk Metrics

  • Annual Volatility: Standard deviation of returns
    • < 20%: Low risk
    • 20-40%: Medium risk
    • 40%: High risk

  • Maximum Drawdown: Largest peak-to-trough decline
    • < 20%: Low risk
    • 20-40%: Medium risk
    • 40%: High risk

  • VaR (95%): Maximum expected loss with 95% confidence
    • < 5%: Low risk
    • 5-10%: Medium risk
    • 10%: High risk

  • Expected Shortfall: Average of losses beyond VaR
    • < 7%: Low risk
    • 7-15%: Medium risk
    • 15%: High risk

  • Calmar Ratio: Annualized return to maximum drawdown
    • 1: Good

    • 2: Very Good

    • 3: Excellent

Market Analysis Metrics

  • Volume Analysis
    • Volume trend
    • Volume vs price correlation
    • Volume spikes detection
  • Trend Analysis
    • Moving average crossovers
    • Support/resistance levels
    • Trend strength indicators
  • Momentum Indicators
    • RSI overbought/oversold levels
    • MACD signal crossovers
    • Stochastic oscillator signals

πŸ”§ Project Structure

β”œβ”€β”€ main.py              # Main Streamlit application
β”œβ”€β”€ telegram_bot.py      # Telegram bot implementation
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── exchange.py  # Market data handling
β”‚   β”œβ”€β”€ strategies/
β”‚   β”‚   β”œβ”€β”€ base.py     # Base strategy class
β”‚   β”‚   └── moving_average.py
β”‚   β”œβ”€β”€ backtest/
β”‚   β”‚   β”œβ”€β”€ runner.py   # Backtesting system
β”‚   β”‚   └── __main__.py
β”‚   β”œβ”€β”€ analysis/
β”‚   β”‚   └── technical.py # Technical analysis
β”‚   └── utils/
β”‚       └── helpers.py   # Utility functions
β”œβ”€β”€ notebooks/
β”‚   └── analysis/       # Jupyter notebooks for analysis
β”œβ”€β”€ docs/
β”‚   └── images/         # Documentation images
β”œβ”€β”€ tests/              # Test suite
β”œβ”€β”€ monitoring/
β”‚   └── prometheus/     # Prometheus setup
β”œβ”€β”€ airflow/           # Airflow DAGs
β”‚   └── dags/          # Workflow definitions
└── requirements.txt    # Project dependencies

🀝 Contributing

We welcome contributions! Here's how you can help:

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

Development Guidelines

  • Follow PEP 8 style guide
  • Write unit tests for new features
  • Update documentation as needed
  • Use meaningful commit messages

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Contact

RanuK12 - @RanuK12

Project Link: https://github.com/RanuK12/crypto-analysis-dashboard

πŸ™ Acknowledgments

  • Yahoo Finance for market data
  • Streamlit for the web framework
  • Plotly for interactive visualizations
  • Python-Telegram-Bot for bot integration
  • All contributors and supporters of the project

Licencia

MIT β€” Β© 2026 Ranuk IT Solutions | ranuk.dev

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages