Skip to content

BloodyRose0714/crypto-analyzer-gpt

Repository files navigation

🚀 Crypto Analyzer GPT

Professional cryptocurrency analysis API with real-time market data, technical indicators, and AI-powered insights.

Version Python FastAPI License Deploy

📋 Overview

Crypto Analyzer GPT is a professional-grade REST API designed for cryptocurrency analysis and AI integration. Built with FastAPI, it provides comprehensive market data, technical analysis, sentiment tracking, and news aggregation for informed trading decisions.

🎯 Key Features

  • 📊 Real-time Market Data - Live OHLCV data and orderbook information
  • 📈 Technical Analysis - 15+ technical indicators (RSI, MACD, SMA, EMA, Bollinger Bands)
  • 📰 News Aggregation - Multi-source crypto news with sentiment analysis
  • 😱 Market Sentiment - Fear & Greed Index and social sentiment tracking
  • 🔮 Futures Data - Funding rates and open interest from perpetual contracts
  • 🤖 AI Integration - Optimized for CustomGPT and AI trading systems
  • 🛡️ Security - API key authentication and rate limiting
  • ⚡ Performance - Redis caching and optimized response times
  • 💹 Futures Data - Funding rates and Open Interest
  • 🚀 AI-optimized - Specifically developed for CustomGPT and other AI systems

🛠️ Tech Stack

  • Backend: FastAPI, Python 3.11+
  • Database: PostgreSQL, Redis (Caching)
  • APIs: Bitget, NewsAPI, CryptoPanic, Fear & Greed Index
  • Deployment: Docker, Render Cloud
  • Monitoring: Structured Logging, Health Checks

🚀 Quick Start

Prerequisites

  • Python 3.11 or higher
  • Redis Server
  • PostgreSQL (for Production)
  • Docker (for Development)

🏗️ Development Setup (Recommended)

For local development with Docker (recommended approach):

# Clone and setup
git clone https://github.com/ghiemer/crypto-analyzer-gpt.git
cd crypto-analyzer-gpt

# Quick setup
./quick-setup.sh

# Configure .env with your settings
nano .env

# Start development environment
./dev.sh setup
./dev.sh start

Development Features:

  • 🐳 Docker-based development environment
  • 🔄 Hot reloading for rapid development
  • 🗃️ Uses external Render database for realistic testing
  • 🔒 Isolated develop branch keeps main stable
  • 🧪 Built-in testing and linting tools

See DEVELOPMENT.md for detailed development instructions.

📦 Production Setup

git clone https://github.com/ghiemer/crypto-analyzer-gpt.git
cd crypto-analyzer-gpt

2. Create Virtual Environment

# With pyenv (recommended)
pyenv virtualenv 3.11.3 crypto-analyzer-gpt
pyenv activate crypto-analyzer-gpt

# Or with venv
python -m venv venv
source venv/bin/activate  # Linux/Mac
# venv\Scripts\activate   # Windows

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment

# Create .env file
cp config/.env.example .env

# Configure at least these values:
# API_KEY=your-secure-api-key-here
# REDIS_URL=redis://localhost:6379/0

5. Start Application

# Development Server
uvicorn app.main:app --reload --port 8000

# Production Server
gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000

6. Test API

# Health Check
curl -H "X-API-Key: your-api-key" http://localhost:8000/health

# Bitcoin data with indicators
curl -H "X-API-Key: your-api-key" "http://localhost:8000/candles?symbol=BTCUSDT&indicators=rsi14,sma50"

📚 Documentation

🔧 Configuration

All configuration files are located in the config/ directory:

  • config/.env.example - Environment variables template
  • config/pyproject.toml - Python project configuration
  • config/pyrightconfig.json - Type checking configuration

🚀 Production Deployment

1. Render.com Deployment

# 1. Create Render account
# 2. Create PostgreSQL service
# 3. Create Redis service
# 4. Create Web service with this repository

2. Environment Setup

# Render Dashboard -> Environment Variables
API_KEY=your-production-api-key
REDIS_URL=redis://your-redis-instance
DATABASE_URL=postgresql://user:pass@host:port/db
ENVIRONMENT=production
LOG_LEVEL=INFO

3. Health Check

# Check after deployment
curl -H "X-API-Key: your-key" https://your-app.onrender.com/health

4. Monitoring

  • Logs: Render Dashboard -> Logs
  • Metrics: /metrics Endpoint
  • Alerts: Telegram Bot Integration

🔐 Security

API Authentication

# All requests require API-Key header
curl -H "X-API-Key: your-secret-key" https://api.example.com/endpoint

Rate Limiting

  • Default: 100 requests per minute
  • Configurable via Environment Variables
  • IP-based with automatic recovery

Input Validation

  • All parameters are validated
  • SQL injection protection
  • XSS protection through security headers

🔌 CustomGPT Integration

Setup

  1. Generate API-Key:

    openssl rand -hex 32
  2. Configure CustomGPT:

    • Base URL: https://your-app.onrender.com
    • Authentication: Custom Header
    • Header: X-API-Key: your-key
  3. Example Prompts:

    "Analyze Bitcoin with RSI and SMA"
    "Show me Ethereum news"
    "What's the market sentiment today?"
    

Optimized Endpoints

# Simplified queries for AI
GET /candles?symbol=BTCUSDT&indicators=all
GET /news?coin=bitcoin
GET /misc/feargreed

📊 Monitoring & Logging

Logs

# Local logs
tail -f logs/app.log

# Render logs
render logs --service your-service-name

Metrics

# Prometheus metrics
curl https://your-app.onrender.com/metrics

# Custom metrics
- Request Count
- Response Time
- Cache Hit Rate
- Error Rate

🧪 Testing

Unit Tests

# Run tests
python -m pytest tests/

# With coverage
python -m pytest --cov=app tests/

API Tests

# Postman Collection
./tests/postman/crypto-analyzer.postman_collection.json

# Manual testing
curl -H "X-API-Key: test-key" http://localhost:8000/health

🤝 Contributing

  1. Fork the repository
  2. Create branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Create Pull Request

Development Guidelines

  • Code Style: Black, isort, flake8
  • Documentation: Docstrings for all functions
  • Tests: Minimum 80% coverage
  • Type Hints: Complete typing

📄 License

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

🙏 Acknowledgments

  • FastAPI - Modern Python web framework
  • Bitget - Crypto exchange API
  • Render - Cloud hosting platform
  • Redis - In-memory caching
  • PostgreSQL - Relational database

📞 Support


Like this project? Give us a star on GitHub!

Developed with ❤️ for the crypto community

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published