A comprehensive web application built with Django for cryptocurrency portfolio management and technical analysis with AI-powered buy/sell recommendations using Ollama LLM.
- Portfolio Management: Register and manage your cryptocurrency holdings
- Real-time Price Updates: Automatic price fetching from CoinGecko and Binance APIs
- Technical Analysis: Comprehensive technical indicators including:
- RSI (Relative Strength Index)
- MACD (Moving Average Convergence Divergence)
- SMA/EMA (Simple and Exponential Moving Averages)
- Bollinger Bands
- Stochastic Oscillator
- ADX (Average Directional Index)
- Volume indicators
- Support/Resistance levels
- AI-Powered Recommendations: LLM-based analysis using Ollama for buy/sell/hold recommendations
- Interactive Charts: Advanced price charts with zoom, pan, and technical indicators visualization
- User Authentication: Secure login system with user management
- Background Tasks: Configurable automatic price updates and analysis
- Responsive Design: Modern, mobile-friendly interface
- Backend: Django 4.2.7
- Database: SQLite (development) / PostgreSQL (production)
- Frontend: Bootstrap 5, Chart.js with zoom plugin
- APIs: CoinGecko, Binance
- AI: Ollama LLM
- Data Processing: Pandas, NumPy
- Deployment: Docker, Docker Compose, Gunicorn
- Python 3.10 or higher
- Docker and Docker Compose (for containerized deployment)
- Ollama server (remote or local)
- PostgreSQL (optional, for production)
- Clone the repository:
git clone https://github.com/yourusername/crypto-analysis.git
cd crypto-analysis- Create environment file:
cp .env.example .env
# Edit .env with your configuration- Build and run with Docker Compose:
docker-compose up -d --build- Access the application:
- Open http://localhost:8000 in your browser
- Default admin credentials:
admin/admin
git clone https://github.com/yourusername/crypto-analysis.git
cd crypto-analysis# Windows
python -m venv venv
.\venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtcp .env.example .env
# Edit .env with your settingspython manage.py migratepython manage.py createsuperuserpython manage.py collectstaticpython manage.py runserverAccess the application at http://127.0.0.1:8000/
Create a .env file in the project root (use .env.example as template):
# Django Settings
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Database (SQLite by default)
DATABASE_ENGINE=sqlite3
# For PostgreSQL:
# DATABASE_ENGINE=postgresql
# DB_NAME=cryptobot
# DB_USER=postgres
# DB_PASSWORD=your-password
# DB_HOST=localhost
# DB_PORT=5432
# Ollama Configuration
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=plutus
# API Configuration (optional, defaults provided)
COINGECKO_API_URL=https://api.coingecko.com/api/v3
BINANCE_API_URL=https://api.binance.com/api/v3-
Remote Ollama Server (recommended):
- Use a remote server:
https://your-ollama-server.com(update OLLAMA_BASE_URL in .env) - Ensure the server is accessible and has the required model installed
- Use a remote server:
-
Local Ollama:
- Install Ollama from https://ollama.ai/
- Pull a model:
ollama pull plutus(or your preferred model) - Update
OLLAMA_BASE_URLin.envtohttp://localhost:11434
- Log in to the application
- Navigate to "My Cryptos" (or use the direct link
/cryptos/) - Click "Add New Cryptocurrency"
- Enter symbol (e.g., BTC, ETH), name, amount, and purchase price
- The current price will be automatically fetched
- Go to "Analysis Overview" (default landing page)
- Click on any cryptocurrency to view detailed analysis
- View technical indicators, AI recommendations, and interactive charts
- Use zoom and pan controls on charts for detailed inspection
- Navigate to "Settings"
- Configure:
- Automatic price update interval
- Automatic analysis interval
- Ollama server URL and model selection
- Models are automatically loaded from the Ollama server
- Update
.envfor production:
DEBUG=False
ALLOWED_HOSTS=your-domain.com,www.your-domain.com
SECRET_KEY=your-production-secret-key
DATABASE_ENGINE=postgresql
# ... configure PostgreSQL settings- Build and deploy:
docker-compose -f docker-compose.yml up -d --build- Run migrations (if not automatic):
docker-compose exec web python manage.py migrate- Create superuser:
docker-compose exec web python manage.py createsuperuser# Build images
docker-compose build
# Start services
docker-compose up -d
# View logs
docker-compose logs -f web
# Stop services
docker-compose down
# Stop and remove volumes
docker-compose down -vGET /login/- Login pagePOST /login/- Authenticate userGET /logout/- Logout user
GET /cryptos/- List all cryptocurrenciesGET /add/- Add new cryptocurrency formPOST /add/- Create new cryptocurrencyGET /<id>/edit/- Edit cryptocurrency formPOST /<id>/edit/- Update cryptocurrencyGET /<id>/delete/- Delete confirmationPOST /<id>/delete/- Delete cryptocurrencyGET /<id>/analysis/- Detailed technical analysisPOST /<id>/update-price/- Update price (AJAX)
GET /analysis/overview/- Overview of all analysesGET /- Redirects to analysis overview
GET /settings/- Application settingsPOST /settings/- Update settingsPOST /settings/load-models/- Load Ollama models (AJAX)
GET /api/price/<symbol>/- Get current price for symbol
GET /users/- List all usersGET /users/add/- Add user formPOST /users/add/- Create userGET /users/<id>/edit/- Edit user formPOST /users/<id>/edit/- Update userGET /users/<id>/delete/- Delete confirmationPOST /users/<id>/delete/- Delete user
The application calculates the following technical indicators:
- RSI: Relative Strength Index (14 period)
- MACD: Moving Average Convergence Divergence (12, 26, 9)
- SMA: Simple Moving Average (20, 50 periods)
- EMA: Exponential Moving Average (12, 26 periods)
- Bollinger Bands: Upper, Middle, Lower bands (20 period, 2 std dev)
- Stochastic: %K and %D (14 period)
- ADX: Average Directional Index (14 period)
- Volume Indicators: Volume SMA, Volume Ratio, OBV
- Support/Resistance: Calculated from price history
CF_CryptoIQ/
├── cf_cryptoiq/ # Project settings
│ ├── settings.py # Django settings
│ ├── urls.py # Root URL configuration
│ └── wsgi.py # WSGI configuration
├── Cryptos/ # Main application
│ ├── models.py # Database models
│ ├── views.py # View functions
│ ├── urls.py # URL routing
│ ├── services/ # Business logic
│ │ ├── api_manager.py
│ │ ├── coin_gecko_service.py
│ │ ├── binance_service.py
│ │ ├── technical_indicators.py
│ │ ├── ollama_analyzer.py
│ │ └── ollama_service.py
│ ├── management/ # Django management commands
│ ├── templates/ # HTML templates
│ └── static/ # CSS, JS, images
├── static/ # Additional static files
├── requirements.txt # Python dependencies
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
└── .env.example # Environment variables template
python manage.py testThe project follows PEP 8 Python style guidelines.
- Verify Ollama server is running and accessible
- Check
OLLAMA_BASE_URLin.env - Ensure the model is installed:
ollama list(if local) - Check network connectivity to remote Ollama server
- For SQLite: Ensure write permissions on database file
- For PostgreSQL: Verify connection settings in
.env - Run migrations:
python manage.py migrate
- Collect static files:
python manage.py collectstatic - Check
STATIC_ROOTandSTATICFILES_DIRSin settings - Verify WhiteNoise middleware is enabled
- CoinGecko has rate limits (50 calls/minute)
- The application includes rate limiting and caching
- If issues persist, wait a few minutes between requests
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
Copyright (c) 2025 Carlos Fernandes
Carlos Fernandes
- Website: www.carlosfernandes.eu
- Email: eu@carlos.fernandes.eu
- Application: CF-CryptoIQ.carlosfernandes.eu
- CoinGecko API for cryptocurrency data
- Binance API for real-time market data
- Ollama for LLM capabilities
- Django community for the excellent framework
- Chart.js for interactive charting
For issues, questions, or contributions, please contact:
- Email: eu@carlos.fernandes.eu
- Website: https://www.carlosfernandes.eu