Skip to content

About

Kronos AI Market Prediction & Backtesting Web Application - A powerful Flask web app for AI-powered market forecasting with support for stocks and cryptocurrencies. Features modern UI, real-time predictions, backtesting analysis, and optimized deployment for cloud platforms.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Kronos AI Web Application

๐Ÿš€ Advanced AI-Powered Market Prediction & Backtesting Platform

A modern web application that brings the power of Kronos AI to your browser, featuring real-time market predictions and comprehensive backtesting capabilities for both stocks and cryptocurrencies.

Kronos AI Python Flask Docker

๐ŸŒŸ Features

๐Ÿ“ˆ Market Prediction

  • AI-Powered Forecasting: Generate future price predictions using advanced machine learning models
  • Multi-Asset Support: Supports both stocks and cryptocurrencies
  • Customizable Timeframes: Adjust prediction length from 30 to 500 periods
  • Real-time Visualization: Interactive charts with professional trading theme

๐Ÿ•ฐ๏ธ Backtesting Engine

  • Historical Analysis: Test prediction accuracy on historical data
  • Performance Metrics: Comprehensive statistics including accuracy, returns, and Sharpe ratio
  • Configurable Lookback: Analyze performance over 100-1000 historical periods
  • Visual Reports: Clear charts showing prediction vs actual performance

๐ŸŽจ Modern Web Interface

  • Dark Trading Theme: Professional interface designed for traders
  • Responsive Design: Works seamlessly on desktop, tablet, and mobile
  • Real-time Updates: AJAX-powered interface with loading indicators
  • Symbol Management: Add custom symbols beyond the popular lists

๐Ÿš€ Deployment Ready

  • Docker Support: Containerized for easy deployment
  • vast.ai Compatible: Optimized for GPU cloud deployment
  • Production Ready: Gunicorn WSGI server with multi-worker support
  • Auto-deployment: One-click deployment script included

๐Ÿ“ท Screenshots

Dark trading interface with prediction and backtesting capabilities

๐Ÿš€ Quick Start

Option 1: Docker Deployment (Recommended)

# Clone the repository
git clone https://github.com/henryzhangpku/kronos-webapp.git
cd kronos-webapp

# Run the automated deployment script
bash deploy.sh

The application will be available at http://localhost:5000

Option 2: Manual Installation

# Clone the repository
git clone https://github.com/henryzhangpku/kronos-webapp.git
cd kronos-webapp

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py

Option 3: vast.ai Deployment

  1. Create a new instance on vast.ai
  2. Upload this repository to your instance
  3. Run the deployment script:
    bash deploy.sh
  4. Access via your instance's public IP on port 5000

๐Ÿ“š API Documentation

Endpoints

POST /api/predict

Generate market predictions for a given symbol.

Request Body:

{
  "symbol": "AAPL",
  "asset_type": "stock",
  "pred_length": 120
}

Response:

{
  "success": true,
  "plot": "base64_encoded_image",
  "stats": {
    "current_price": 175.50,
    "predicted_change": 0.025
  }
}

POST /api/backtest

Run backtesting analysis for a given symbol.

Request Body:

{
  "symbol": "BTC",
  "asset_type": "crypto",
  "lookback": 512
}

Response:

{
  "success": true,
  "plot": "base64_encoded_image",
  "stats": {
    "accuracy": 0.73,
    "total_return": 0.15,
    "sharpe_ratio": 1.45
  }
}

POST /api/add_symbol

Add a custom symbol to the available list.

Request Body:

{
  "symbol": "NVDA",
  "asset_type": "stock"
}

๐Ÿ“ Project Structure

kronos-webapp/
โ”œโ”€โ”€ app.py                 # Main Flask application
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”œโ”€โ”€ Dockerfile            # Docker configuration
โ”œโ”€โ”€ deploy.sh             # Automated deployment script
โ”œโ”€โ”€ README.md             # This file
โ”œโ”€โ”€ templates/
โ”‚   โ””โ”€โ”€ index.html        # Main web interface
โ””โ”€โ”€ static/
    โ”œโ”€โ”€ css/
    โ”‚   โ””โ”€โ”€ styles.css    # Dark trading theme styles
    โ””โ”€โ”€ js/
        โ””โ”€โ”€ app.js        # Frontend JavaScript logic

๐Ÿ”ง Technical Details

Backend

  • Framework: Flask 2.3.3 with RESTful API design
  • AI Integration: Seamless integration with Kronos prediction models
  • Data Visualization: Matplotlib with base64 encoding for web delivery
  • Production Server: Gunicorn WSGI server with multiple workers

Frontend

  • Framework: Bootstrap 5 for responsive design
  • JavaScript: ES6+ with modern async/await patterns
  • Styling: Custom CSS with CSS variables for theming
  • Icons: Font Awesome for professional iconography

Deployment

  • Containerization: Docker with multi-stage builds
  • Cloud Ready: Optimized for vast.ai and other cloud platforms
  • Scalability: Configurable worker processes and timeout settings
  • Monitoring: Built-in health checks and logging

๐Ÿ“Š Supported Assets

Popular Stocks

  • AAPL, GOOGL, MSFT, AMZN, TSLA
  • NVDA, META, NFLX, ADBE, CRM
  • SPY, QQQ, IWM, GLD, TLT

Popular Cryptocurrencies

  • BTC, ETH, BNB, XRP, ADA
  • SOL, DOGE, DOT, AVAX, MATIC
  • LINK, UNI, LTC, BCH, ETC

Custom symbols can be added through the web interface

๐Ÿ” Configuration

Environment Variables

# Flask Configuration
FLASK_APP=app.py
FLASK_ENV=production
PYTHONPATH=/app

# Application Settings (optional)
MAX_PREDICTION_LENGTH=500
MAX_LOOKBACK_PERIOD=1000
DEFAULT_PREDICTION_LENGTH=120
DEFAULT_LOOKBACK_PERIOD=512

Docker Configuration

The included Dockerfile uses:

  • Python 3.11 slim base image
  • Multi-worker Gunicorn server
  • 120-second timeout for ML operations
  • Automatic port exposure on 5000

๐Ÿ› Troubleshooting

Common Issues

  1. Port Already in Use

    # Kill process on port 5000
    sudo lsof -t -i tcp:5000 | xargs kill -9
  2. Docker Build Fails

    # Clean Docker cache
    docker system prune -a
  3. AI Models Not Loading

    • Ensure the original Kronos AI codebase is available
    • Check the import paths in app.py
    • Verify all dependencies are installed
  4. Memory Issues

    • Reduce the number of Gunicorn workers
    • Increase Docker memory allocation
    • Use smaller prediction/lookback periods

Logs and Debugging

# View container logs
docker logs kronos-app

# Check container status
docker ps -a

# Enter container for debugging
docker exec -it kronos-app bash

๐Ÿ“œ License

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

๐Ÿค Contributing

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

๐Ÿ“ง Support

For support, please:

  1. Check the troubleshooting section above
  2. Review existing GitHub issues
  3. Create a new issue with detailed information

๐Ÿ”ฎ Future Enhancements

  • Real-time market data streaming
  • Portfolio management features
  • Multi-timeframe analysis
  • Alert system for predictions
  • Export functionality for reports
  • User authentication and sessions
  • Historical prediction tracking
  • Advanced charting with TradingView

Built with โค๏ธ by the Kronos AI Team

Empowering traders with artificial intelligence since 2024

About

Kronos AI Market Prediction & Backtesting Web Application - A powerful Flask web app for AI-powered market forecasting with support for stocks and cryptocurrencies. Features modern UI, real-time predictions, backtesting analysis, and optimized deployment for cloud platforms.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages