From 5c441bd7d138f8adccb374fa34acde8a089108da Mon Sep 17 00:00:00 2001 From: chrisnov-it Date: Tue, 19 May 2026 12:48:00 +0800 Subject: [PATCH] Remove obsolete Streamlit and Vercel demo files --- .env.example | 2 +- README_STREAMLIT.md | 213 ------------------------------------ run.py | 2 +- streamlit_demo.py | 218 ------------------------------------- streamlit_requirements.txt | 5 - 5 files changed, 2 insertions(+), 438 deletions(-) delete mode 100644 README_STREAMLIT.md delete mode 100644 streamlit_demo.py delete mode 100644 streamlit_requirements.txt diff --git a/.env.example b/.env.example index 79ba8e9..463b7db 100644 --- a/.env.example +++ b/.env.example @@ -8,5 +8,5 @@ MT5_LOGIN=your_mt5_account_number MT5_PASSWORD=your_mt5_password MT5_SERVER=your_mt5_server -# Skip MT5 initialization in deployment environments (Vercel, etc.) +# Skip MT5 initialization for import checks and local diagnostics. SKIP_MT5_INIT=0 diff --git a/README_STREAMLIT.md b/README_STREAMLIT.md deleted file mode 100644 index 3571b85..0000000 --- a/README_STREAMLIT.md +++ /dev/null @@ -1,213 +0,0 @@ -# 🚀 QuantumBotX Streamlit Demo Deployment Guide - -## Overview - -Since MetaTrader 5 requires **Windows OS and persistent terminal connections**, enabling Railway or other cloud platforms for live trading is not technically feasible. However, for **public demonstration** purposes, we've created a beautiful Streamlit demo that showcases all QuantumBotX features without requiring MT5. - -## Why Streamlit Demo? - -### ✅ Advantages: -- **No MT5 Dependency**: Works on any cloud platform (Railway, Vercel, Heroku, etc.) -- **Interactive Demo**: Realistic trading simulation with live data -- **Easy Deployment**: Single command deployment with pip installs -- **Public Showcase**: Perfect for demonstrating capabilities to potential users -- **Cost Effective**: Free tier available on most platforms -- **Fast Loading**: Lightweight compared to full Flask app - -### ❌ Limitations: -- No live trading execution (by design for safety) -- Simulated data only -- No MT5 integration -- Read-only demonstration - -## Quick Deployment Options - -### Option 1: Streamlit Cloud (Easiest) - -1. **Create Account**: Go to [share.streamlit.io](https://share.streamlit.io) -2. **Connect Repository**: Link your GitHub account -3. **Deploy**: - ```bash - git add streamlit_demo.py streamlit_requirements.txt - git commit -m "Add Streamlit demo for QuantumBotX" - git push origin main - ``` -4. **Configuration**: - - Main file path: `streamlit_demo.py` - - Requirements file: `streamlit_requirements.txt` - -### Option 2: Railway + Streamlit - -1. **Initialize Railway Project**: - ```bash - railway init - ``` - -2. **Create Railway Configuration**: - ```bash - # railway.toml - [build] - builder = "NIXPACKS" - - [deploy] - startCommand = "streamlit run streamlit_demo.py --server.port $PORT --server.headless true" - ``` - -3. **Environment Variables** (optional): - - No MT5 credentials needed (demo only) - -4. **Deploy**: - ```bash - git add . - git commit -m "Add Railway config for Streamlit demo" - git push origin main - railway up - ``` - -### Option 3: Heroku + Streamlit - -1. **Create Heroku App**: - ```bash - heroku create quantum-botx-demo - ``` - -2. **Create requirements.txt** (use `streamlit_requirements.txt`) - -3. **Create Procfile**: - - ```bash - web: streamlit run streamlit_demo.py --server.port $PORT --server.headless true - ``` - -4. **Deploy**: - ```bash - git push heroku main - ``` - -### Option 4: Vercel + Streamlit (Experimental) - -1. **Create vercel.json**: - ```json - { - "version": 2, - "builds": [ - { - "src": "streamlit_demo.py", - "use": "@vercel/python" - } - ], - "routes": [ - { - "src": "/(.*)", - "dest": "streamlit_demo.py" - } - ] - } - ``` - -2. **Deploy**: - ```bash - vercel --prod - ``` - -## Demo Features Showcased - -### 📊 Interactive Dashboard: -- **Live Metrics**: Balance, strategies, profits, bots running -- **Strategy Showcase**: MA Crossover & Bollinger Band explanations -- **Charts**: Example price movements with indicators -- **Trading History**: Filtered historic demo trades - -### 🎯 Strategy Highlights: -- **Beginner Friendly**: Clear explanations and examples -- **Risk Management**: ATR-based sizing demonstrations -- **Multi-Asset**: FOREX, Gold, Crypto, Indices examples -- **AI Features**: Strategy complexity ratings, mentor system - -### 🚀 Professional Presentation: -- **Clean UI**: Modern Streamlit interface -- **Responsive Design**: Works on mobile and desktop -- **Educational Content**: Feature explanations and guides -- **Call-to-Action**: Download links and system requirements - -## Files Created - -- **`streamlit_demo.py`**: Complete demo application -- **`streamlit_requirements.txt`**: Minimal dependencies for cloud deployment -- **`README_STREAMLIT.md`**: This deployment guide - -## Testing Locally - -Before deploying, test the demo locally: - -```bash -# Install dependencies -pip install -r streamlit_requirements.txt - -# Run the demo -streamlit run streamlit_demo.py -``` - -**Expected Result**: Demo app opens in browser showing QuantumBotX features - -## Deployment Commands - -### Streamlit Cloud (Recommended): -```bash -streamlit run streamlit_demo.py --server.port 8501 --server.headless false -``` - -### Railway: -```bash -railway init -railway up -``` - -### Heroku: -```bash -heroku create your-app-name -git push heroku main -``` - -## Cost Comparison - -| Platform | Free Tier | Cost for Demo | Best For | -|----------|-----------|---------------|----------| -| **Streamlit Cloud** | 100 hours/month | Free | Best choice | -| **Railway** | $5/month | $5/month | Good alternative | -| **Heroku** | 550 hours/month | Free | Simple option | -| **Vercel** | Generous free | Free | If preferring Vercel | - -## Why Not Live Trading Deployment? - -### Technical Barriers: - -1. **MT5 Windows-Only**: Terminal requires Windows OS -2. **Persistent Connection**: Needs continuous MT5 session -3. **GUI Requirement**: MT5 needs display server for login -4. **License Issues**: MT5 EULA may prohibit containerization - -### Railway Specifically: -- Railway uses **Linux containers** (Ubuntu/CentOS) -- **Wine complications**: MT5 + Wine = unreliable connections -- **No Windows support**: Railway doesn't offer Windows containers -- **Cost ineffective**: Persistent VMs for MT5 would be expensive - -## Next Steps - -1. **Choose Platform**: Streamlit Cloud for easiest deployment -2. **Test Demo**: Run locally first -3. **Deploy**: Push to chosen platform -4. **Share**: Send demo link to potential users -5. **Monitor**: Check analytics and user feedback - -## Support - -- **Demo Issues**: Test locally first, then check deployment logs -- **Streamlit Docs**: [docs.streamlit.io](https://docs.streamlit.io) -- **Platform Support**: Each platform has detailed documentation -- **QuantumBotX**: Full version requires Windows + MT5 setup - ---- - -**Happy Showcasing! 🎯🤖** diff --git a/run.py b/run.py index f42eca2..a2d1c86 100644 --- a/run.py +++ b/run.py @@ -33,7 +33,7 @@ def health_check(): return jsonify({"status": "ok", "message": "Server is running", "mt5": mt5_status}) if __name__ == '__main__': - # Skip MT5 initialization if SKIP_MT5_INIT is set (for Vercel deployment) + # Skip MT5 initialization for import checks and local diagnostics. if os.getenv('SKIP_MT5_INIT') == '1': logging.info("Skipping MT5 initialization (deployment mode).") app.run( diff --git a/streamlit_demo.py b/streamlit_demo.py deleted file mode 100644 index fc4b35a..0000000 --- a/streamlit_demo.py +++ /dev/null @@ -1,218 +0,0 @@ -import streamlit as st -import pandas as pd -from datetime import datetime, timedelta -import random - -# Page configuration -st.set_page_config( - page_title="QuantumBotX Trading Bot Demo", - page_icon="🤖", - layout="wide", - initial_sidebar_state="expanded" -) - -# Header -st.title("🤖 QuantumBotX - AI Trading Bot Demo") -st.markdown("*Experience the power of algorithmic trading without risking real money*") - -# Portfolio Overview -col1, col2, col3, col4 = st.columns(4) - -with col1: - st.metric("Total Balance", "$10,000", "+2.3%") -with col2: - st.metric("Active Strategies", "4", "+1") -with col3: - st.metric("Total Profit", "$234.56", "+5.2%") -with col4: - st.metric("Bots Running", "3", "Online") - -# Demo Data Generation -def generate_demo_data(): - # Generate realistic trading data - symbols = ['EURUSD', 'GBPUSD', 'XAUUSD', 'BTCUSD'] - strategies = ['MA Crossover', 'RSI Momentum', 'Quantum Velocity', 'Ichimoku Cloud'] - data = [] - - base_date = datetime.now() - timedelta(days=30) - - for i in range(30): - for symbol in symbols[:2]: # Only EURUSD and GBPUSD for demo - profit = random.uniform(-50, 150) if random.random() > 0.3 else random.uniform(-100, 200) - data.append({ - 'date': (base_date + timedelta(days=i)).strftime('%Y-%m-%d'), - 'symbol': symbol, - 'strategy': random.choice(strategies), - 'profit': round(profit, 2), - 'status': 'Closed' if random.random() > 0.2 else 'Open' - }) - - return pd.DataFrame(data) - -# Strategy Showcase -st.header("🎯 Featured Trading Strategies") - -col1, col2 = st.columns(2) - -with col1: - st.subheader("📈 MA Crossover Strategy") - st.write(""" - **Perfect for beginners!** This classic strategy identifies trend changes using moving average crossovers. - - Uses 50 & 200 period moving averages - - Works beautifully in trending markets - - Risk management: 1% per trade - - EURUSD & GBPUSD optimized - """) - - # Example chart placeholder - chart_data = pd.DataFrame({ - 'Price': [1.0850, 1.0875, 1.0920, 1.0885, 1.0910, 1.0935, 1.0960, 1.0945], - 'SMA50': [1.0800, 1.0815, 1.0830, 1.0845, 1.0860, 1.0875, 1.0890, 1.0905], - 'SMA200': [1.0750, 1.0765, 1.0780, 1.0795, 1.0810, 1.0825, 1.0840, 1.0855] - }) - st.line_chart(chart_data) - -with col2: - st.subheader("🎪 Bollinger Band Reversal") - st.write(""" - **Advanced mean reversion strategy** that profits from price returning to the mean. - - Uses Bollinger Bands for entry signals - - RSI confirmation for momentum timing - - Excellent in ranging markets - - Perfect for FOREX pairs - """) - - # Bollinger bands visualization - bb_data = pd.DataFrame({ - 'Price': [1.0850, 1.0835, 1.0860, 1.0825, 1.0875, 1.0800, 1.0885, 1.0840], - 'Upper BB': [1.0910, 1.0925, 1.0900, 1.0935, 1.0920, 1.0945, 1.0930, 1.0915], - 'Lower BB': [1.0790, 1.0775, 1.0800, 1.0765, 1.0780, 1.0755, 1.0770, 1.0785] - }) - st.line_chart(bb_data) - -# Live Demo Section -st.header("📊 Live Bot Performance") - -# Demo trading data -demo_data = generate_demo_data() - -# Filter options -col1, col2, col3 = st.columns(3) -with col1: - symbol_filter = st.selectbox("Filter by Symbol:", ["All"] + demo_data['symbol'].unique().tolist()) -with col2: - strategy_filter = st.selectbox("Filter by Strategy:", ["All"] + demo_data['strategy'].unique().tolist()) -with col3: - status_filter = st.selectbox("Filter by Status:", ["All"] + demo_data['status'].unique().tolist()) - -# Apply filters -filtered_data = demo_data.copy() -if symbol_filter != "All": - filtered_data = filtered_data[filtered_data['symbol'] == symbol_filter] -if strategy_filter != "All": - filtered_data = filtered_data[filtered_data['strategy'] == strategy_filter] -if status_filter != "All": - filtered_data = filtered_data[filtered_data['status'] == status_filter] - -# Display trades table -st.dataframe( - filtered_data.sort_values('date', ascending=False), - use_container_width=True -) - -# Performance Summary -st.subheader("📈 Performance Summary") - -col1, col2, col3, col4 = st.columns(4) - -with col1: - total_trades = len(filtered_data) - st.metric("Total Trades", total_trades) - -with col2: - profitable_trades = len(filtered_data[filtered_data['profit'] > 0]) - win_rate = (profitable_trades / total_trades * 100) if total_trades > 0 else 0 - st.metric("Win Rate", ".1f") - -with col3: - avg_profit = filtered_data['profit'].mean() - st.metric("Avg Profit/Trade", ".2f") - -with col4: - total_profit = filtered_data['profit'].sum() - st.metric("Total P&L", ".2f") - -# Features Showcase -st.header("🚀 Key Features") - -feature_col1, feature_col2 = st.columns(2) - -with feature_col1: - st.subheader("🛡️ Risk Management") - st.write(""" - - **ATR-Based Sizing**: Dynamic position sizing that adapts to volatility - - **1% Risk Rule**: Conservative approach protects your capital - - **XAUUSD Protection**: Special safeguards for gold trading - - **Emergency Brake**: Auto-halting during extreme market conditions - """) - - st.subheader("🎓 AI Educational System") - st.write(""" - - **Strategy Complexity Ratings**: 2-12 scale for beginners to experts - - **Day-by-Day Learning**: Progressive experience from Week 1 to Month 3 - - **AI Mentor**: Indonesian AI mentor with cultural intelligence - - **Parameter Explanations**: Every setting explained in plain language - """) - -with feature_col2: - st.subheader("📊 Multi-Asset Trading") - st.write(""" - - **FOREX**: EURUSD, GBPUSD, JPY pairs with trend-following - - **Gold**: Ultra-conservative XAUUSD with ATR limits - - **Crypto**: BTCUSD/ETHUSD with 24/7 weekend trading - - **Indices**: US500, US30 with momentum strategies - - **Multi-Broker**: XM Global, FBS, IC Markets support - """) - - st.subheader("🌟 Unique Features") - st.write(""" - - **Strategy Switcher**: AI automatically selects best strategy - - **Holiday Detection**: Christmas & Ramadan mode activation - - **Cultural Awareness**: Islamic finance features and Zakat calculator - - **Live Dashboard**: Real-time monitoring and performance tracking - """) - -# Call to Action -st.header("🎯 Ready to Start Your Trading Journey?") - -st.info(""" -**QuantumBotX Demo Limitations:** -- This is a *simulation* of the actual trading bot -- Real trading requires Windows + MetaTrader 5 terminal -- All data shown is generated for demonstration purposes -- The actual bot provides live MT5 integration and real-time trading -""") - -st.markdown(""" -### How to Get Started: -1. **Download the full application** from our GitHub repository -2. **Install MetaTrader 5** on your Windows computer -3. **Set up your demo account** with any MT5 broker -4. **Configure and start trading** with $50 minimum deposit - -### System Requirements: -- Windows 10/11 (64-bit) -- MetaTrader 5 terminal -- Python 3.10 or higher -- At least 4GB RAM -""") - -# Footer -st.markdown("---") -st.markdown(""" -
-

QuantumBotX - Making Algorithmic Trading Accessible for Everyone

-

Developed with ❤️ by Chrisnov IT Solutions

-

View on GitHubDocumentation

-
-""", unsafe_allow_html=True) diff --git a/streamlit_requirements.txt b/streamlit_requirements.txt deleted file mode 100644 index 567ac77..0000000 --- a/streamlit_requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -streamlit==1.29.0 -pandas==2.3.1 -numpy==1.23.5 -python-dateutil==2.9.0.post0 -pytz==2025.2