mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-07-27 18:57:47 +00:00
chore: remove Vercel configuration and cleanup dependencies
This commit is contained in:
+7
-7
@@ -15,7 +15,7 @@
|
||||
## ⚡ Quick Setup (3 Steps)
|
||||
|
||||
### Step 1: Install MT5 Platform
|
||||
```
|
||||
```text
|
||||
1. Download MT5 from: https://www.metatrader5.com/en/download
|
||||
2. Install in default location: C:\Program Files\MetaTrader 5
|
||||
3. Launch MT5 and login to your account (demo recommended)
|
||||
@@ -113,7 +113,7 @@ MT5_SERVER=YourBroker-ServerName
|
||||
python lab/download_data.py
|
||||
```
|
||||
**Expected Output:**
|
||||
```
|
||||
```text
|
||||
✅ Successfully connected to MT5
|
||||
📡 Server: FBS-Demo
|
||||
👤 Account: 12345678
|
||||
@@ -125,7 +125,7 @@ python lab/download_data.py
|
||||
```
|
||||
|
||||
### Test 2: Web Interface
|
||||
```
|
||||
```text
|
||||
1. Start QuantumBotX: python run.py
|
||||
2. Open: http://localhost:5000/backtest
|
||||
3. Click: "Download Data MT5" button
|
||||
@@ -147,7 +147,7 @@ pip install MetaTrader5-5.0.34-cp39-cp39-win_amd64.whl
|
||||
```
|
||||
|
||||
### Error: "Failed to initialize MT5"
|
||||
```
|
||||
```text
|
||||
✅ Check MT5 is running
|
||||
✅ Verify account credentials in .env
|
||||
✅ Try Demo account first
|
||||
@@ -155,7 +155,7 @@ pip install MetaTrader5-5.0.34-cp39-cp39-win_amd64.whl
|
||||
```
|
||||
|
||||
### Error: "Symbol not found"
|
||||
```
|
||||
```text
|
||||
✅ MT5 shows: "Enable Auto Trading" in algo settings
|
||||
✅ Check if symbol is visible in MT5 Market Watch
|
||||
✅ Some symbols need manual activation in MT5
|
||||
@@ -163,7 +163,7 @@ pip install MetaTrader5-5.0.34-cp39-cp39-win_amd64.whl
|
||||
```
|
||||
|
||||
### Error: "Download timed out"
|
||||
```
|
||||
```text
|
||||
✅ Reduce download period in script if needed
|
||||
✅ Check internet connection stability
|
||||
✅ Some brokers are faster than others
|
||||
@@ -207,7 +207,7 @@ print(f"Latest close: {df['close'].iloc[-1]}")
|
||||
```
|
||||
|
||||
**Expected Output:**
|
||||
```
|
||||
```text
|
||||
Rows: 15800+ (4+ years of H1 data)
|
||||
Date range: 2020-01-01 to current_date
|
||||
Latest close: matches MT5 current price
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+2
-1
@@ -74,7 +74,8 @@ Since MetaTrader 5 requires **Windows OS and persistent terminal connections**,
|
||||
2. **Create requirements.txt** (use `streamlit_requirements.txt`)
|
||||
|
||||
3. **Create Procfile**:
|
||||
```
|
||||
|
||||
```bash
|
||||
web: streamlit run streamlit_demo.py --server.port $PORT --server.headless true
|
||||
```
|
||||
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
import os
|
||||
from core import create_app
|
||||
|
||||
# Set environment to skip MT5 initialization on Vercel
|
||||
os.environ['SKIP_MT5_INIT'] = '1'
|
||||
|
||||
app = create_app()
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import math # Import modul math
|
||||
import logging # Import modul logging
|
||||
import os # Import for environment variables
|
||||
from core.strategies.strategy_map import STRATEGY_MAP
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -214,7 +213,7 @@ def run_backtest(strategy_id, params, historical_data_df, symbol_name=None):
|
||||
# Final safety check - never allow lot size above 0.03 for gold
|
||||
if lot_size > 0.03:
|
||||
lot_size = 0.03
|
||||
logger.warning(f"GOLD SAFETY: Lot capped at 0.03")
|
||||
logger.warning("GOLD SAFETY: Lot capped at 0.03")
|
||||
|
||||
# Round to valid lot size increments
|
||||
lot_size = round(lot_size, 2)
|
||||
@@ -304,7 +303,7 @@ def run_backtest(strategy_id, params, historical_data_df, symbol_name=None):
|
||||
logger.info(f"Backtest Complete: {len(trades)} trades, ${total_profit_clean:+.0f} profit, {win_rate_clean:.0f}% win rate")
|
||||
|
||||
# Debug detailed results
|
||||
logger.debug(f"=== DETAILED BACKTEST RESULTS ===")
|
||||
logger.debug("=== DETAILED BACKTEST RESULTS ===")
|
||||
logger.debug(f"Initial Capital: {initial_capital}")
|
||||
logger.debug(f"Final Capital: {capital}")
|
||||
logger.debug(f"Total Profit: {total_profit}")
|
||||
|
||||
@@ -5,7 +5,7 @@ Routes untuk menampilkan laporan AI mentor dan interaksi pengguna
|
||||
"""
|
||||
|
||||
from flask import Blueprint, render_template, request, jsonify, flash, redirect, url_for
|
||||
from datetime import datetime, date, timedelta
|
||||
from datetime import datetime, date
|
||||
from core.ai.trading_mentor_ai import IndonesianTradingMentorAI, TradingSession
|
||||
from core.db.models import (
|
||||
get_trading_session_data, save_ai_mentor_report,
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"broker": "FBS-Demo",
|
||||
"company": "FBS Markets Inc.",
|
||||
"last_check": "2025-10-16T03:19:13.829792"
|
||||
"last_check": "2025-10-22T14:43:57.762205"
|
||||
}
|
||||
@@ -4,7 +4,6 @@ charset-normalizer==3.4.2
|
||||
click==8.2.1
|
||||
colorama==0.4.6
|
||||
Flask==3.1.1
|
||||
gunicorn==22.0.0
|
||||
idna==3.10
|
||||
itsdangerous==2.2.0
|
||||
Jinja2==3.1.6
|
||||
|
||||
@@ -82,7 +82,7 @@ def create_desktop_shortcut():
|
||||
try:
|
||||
# Get user's desktop path
|
||||
desktop = Path.home() / "Desktop"
|
||||
shortcut_path = desktop / "QuantumBotX.lnk"
|
||||
desktop / "QuantumBotX.lnk"
|
||||
|
||||
# Create a simple batch file that will be the shortcut target
|
||||
shortcut_bat = '''@echo off
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import streamlit as st
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from datetime import datetime, timedelta
|
||||
import time
|
||||
import random
|
||||
|
||||
# Page configuration
|
||||
|
||||
@@ -16,7 +16,7 @@ After comprehensive testing, I identified the **PRIMARY ISSUE**:
|
||||
|
||||
The enhanced backtesting engine was calculating spread costs that were **100% of the risk amount per trade**:
|
||||
|
||||
```
|
||||
```text
|
||||
Original Calculation:
|
||||
- Risk per trade: $100 (1% of $10,000)
|
||||
- Spread cost: $100 (100% of risk!)
|
||||
@@ -54,7 +54,7 @@ spread_cost = spread_pips * 1.0 * lot_size # $0.50 for 0.5 lot
|
||||
## 📊 BEFORE vs AFTER COMPARISON
|
||||
|
||||
### **BEFORE (Broken)**
|
||||
```
|
||||
```text
|
||||
EURUSD Bollinger Squeeze Test:
|
||||
- Gross Profit: -$10,000.03
|
||||
- Spread Costs: -$7,414.00
|
||||
@@ -64,7 +64,7 @@ EURUSD Bollinger Squeeze Test:
|
||||
```
|
||||
|
||||
### **AFTER (Fixed)**
|
||||
```
|
||||
```text
|
||||
EURUSD Test Results:
|
||||
- Spread costs: ~0.5% of risk per trade
|
||||
- Reasonable drawdowns (<50%)
|
||||
|
||||
@@ -47,7 +47,7 @@ try:
|
||||
|
||||
def check_crypto_symbols():
|
||||
"""Check if crypto symbols are available and get current prices"""
|
||||
print(f"\\n💰 CRYPTO MARKET CHECK")
|
||||
print("\\n💰 CRYPTO MARKET CHECK")
|
||||
print("=" * 30)
|
||||
|
||||
if not mt5.initialize():
|
||||
@@ -96,7 +96,7 @@ try:
|
||||
|
||||
def create_trading_plan():
|
||||
"""Create a trading plan for SatoshiJakarta"""
|
||||
print(f"\\n📋 SATOSHIJAKARTA TRADING PLAN")
|
||||
print("\\n📋 SATOSHIJAKARTA TRADING PLAN")
|
||||
print("=" * 40)
|
||||
|
||||
plan = {
|
||||
@@ -137,11 +137,11 @@ try:
|
||||
print(f" Size: {plan['secondary_pair']['position_size']}")
|
||||
print(f" Why: {plan['secondary_pair']['reasoning']}")
|
||||
|
||||
print(f"\\n🛡️ Risk Management:")
|
||||
print("\\n🛡️ Risk Management:")
|
||||
for key, value in plan['risk_management'].items():
|
||||
print(f" {key.replace('_', ' ').title()}: {value}")
|
||||
|
||||
print(f"\\n⏰ Trading Schedule:")
|
||||
print("\\n⏰ Trading Schedule:")
|
||||
for day, activity in plan['schedule'].items():
|
||||
print(f" {day.title()}: {activity}")
|
||||
|
||||
@@ -149,7 +149,7 @@ try:
|
||||
|
||||
def show_next_steps():
|
||||
"""Show immediate next steps"""
|
||||
print(f"\\n🎯 IMMEDIATE NEXT STEPS")
|
||||
print("\\n🎯 IMMEDIATE NEXT STEPS")
|
||||
print("=" * 30)
|
||||
|
||||
steps = [
|
||||
@@ -185,12 +185,12 @@ try:
|
||||
print(f" 🎯 Action: {step_info['action']}")
|
||||
print(f" ⏱️ Time: {step_info['time']}")
|
||||
|
||||
print(f"\\n🔥 TOTAL SETUP TIME: 12 minutes!")
|
||||
print(f"Then you'll have 24/7 crypto profit machine! 🚀")
|
||||
print("\\n🔥 TOTAL SETUP TIME: 12 minutes!")
|
||||
print("Then you'll have 24/7 crypto profit machine! 🚀")
|
||||
|
||||
def show_crypto_advantages():
|
||||
"""Show why crypto trading is perfect for Indonesian traders"""
|
||||
print(f"\\n🇮🇩 WHY CRYPTO IS PERFECT FOR INDONESIA")
|
||||
print("\\n🇮🇩 WHY CRYPTO IS PERFECT FOR INDONESIA")
|
||||
print("=" * 45)
|
||||
|
||||
advantages = [
|
||||
@@ -230,7 +230,7 @@ try:
|
||||
# Show next steps
|
||||
show_next_steps()
|
||||
|
||||
print(f"\\n" + "=" * 60)
|
||||
print("\\n" + "=" * 60)
|
||||
print("🎉 SATOSHIJAKARTA IS READY!")
|
||||
print("=" * 60)
|
||||
print("✅ Bot configured for Bitcoin & Ethereum")
|
||||
@@ -239,10 +239,10 @@ try:
|
||||
print("✅ Weekend mode active for 24/7 profits")
|
||||
print("✅ Perfect for your timezone and goals")
|
||||
|
||||
print(f"\\n🚀 FROM JAKARTA TO THE MOON!")
|
||||
print("\\n🚀 FROM JAKARTA TO THE MOON!")
|
||||
print("Your crypto trading journey starts NOW! 🌙🇮🇩")
|
||||
|
||||
print(f"\\n💎 REMEMBER:")
|
||||
print("\\n💎 REMEMBER:")
|
||||
print("Satoshi Nakamoto gave us Bitcoin...")
|
||||
print("SatoshiJakarta will give you PROFITS! ₿💰")
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import sys
|
||||
import os
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
# Add the project root to the path
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
@@ -153,7 +152,7 @@ def test_crypto_strategy_performance():
|
||||
total_profit += strategy_stats['profit']
|
||||
total_trades += strategy_stats['trades']
|
||||
|
||||
print(f"\\n🏆 Overall Results:")
|
||||
print("\\n🏆 Overall Results:")
|
||||
print(f" Total Profit: ${total_profit:,.2f}")
|
||||
print(f" Total Trades: {total_trades}")
|
||||
print(f" Average Profit per Trade: ${total_profit/max(total_trades,1):,.2f}")
|
||||
|
||||
@@ -65,7 +65,6 @@ def debug_enhanced_backtest():
|
||||
df_with_signals = strategy.analyze_df(df.copy())
|
||||
|
||||
# Add ATR
|
||||
import pandas_ta as ta
|
||||
df_with_signals.ta.atr(length=14, append=True)
|
||||
df_with_signals.dropna(inplace=True)
|
||||
df_with_signals.reset_index(inplace=True)
|
||||
@@ -78,7 +77,7 @@ def debug_enhanced_backtest():
|
||||
|
||||
# Show signal bars
|
||||
signal_bars = df_with_signals[df_with_signals['signal'] != 'HOLD']
|
||||
print(f"Signal bars:")
|
||||
print("Signal bars:")
|
||||
for i, row in signal_bars.iterrows():
|
||||
print(f" Index {i}: {row['signal']} | Close: {row['close']:.5f} | ATR: {row.get('ATRr_14', 'Missing')}")
|
||||
|
||||
@@ -87,7 +86,7 @@ def debug_enhanced_backtest():
|
||||
return
|
||||
|
||||
# Manual backtest loop simulation
|
||||
print(f"\\n🔄 SIMULATING BACKTEST LOOP...")
|
||||
print("\\n🔄 SIMULATING BACKTEST LOOP...")
|
||||
|
||||
# Initialize
|
||||
engine = EnhancedBacktestEngine()
|
||||
@@ -102,7 +101,7 @@ def debug_enhanced_backtest():
|
||||
sl_atr_multiplier = float(params.get('sl_atr_multiplier', params.get('sl_pips', 2.0)))
|
||||
tp_atr_multiplier = float(params.get('tp_atr_multiplier', params.get('tp_pips', 4.0)))
|
||||
|
||||
print(f"Engine parameters:")
|
||||
print("Engine parameters:")
|
||||
print(f" Risk: {risk_percent}%")
|
||||
print(f" SL: {sl_atr_multiplier}x ATR")
|
||||
print(f" TP: {tp_atr_multiplier}x ATR")
|
||||
@@ -129,7 +128,7 @@ def debug_enhanced_backtest():
|
||||
print(f" ATR: {atr_value}")
|
||||
|
||||
if atr_value <= 0:
|
||||
print(f" ❌ Invalid ATR - skipping")
|
||||
print(" ❌ Invalid ATR - skipping")
|
||||
continue
|
||||
|
||||
# Calculate distances
|
||||
@@ -147,7 +146,7 @@ def debug_enhanced_backtest():
|
||||
print(f" Calculated lot size: {lot_size}")
|
||||
|
||||
if lot_size <= 0:
|
||||
print(f" ❌ Invalid lot size - skipping")
|
||||
print(" ❌ Invalid lot size - skipping")
|
||||
continue
|
||||
|
||||
# Calculate entry price
|
||||
@@ -174,10 +173,10 @@ def debug_enhanced_backtest():
|
||||
estimated_risk = sl_distance * lot_size * config['contract_size']
|
||||
max_risk_dollar = capital * config.get('emergency_brake_percent', 0.05)
|
||||
if estimated_risk > max_risk_dollar:
|
||||
print(f" 🚨 Emergency brake triggered - skipping")
|
||||
print(" 🚨 Emergency brake triggered - skipping")
|
||||
continue
|
||||
|
||||
print(f" ✅ Trade would be executed!")
|
||||
print(" ✅ Trade would be executed!")
|
||||
|
||||
# For debugging, let's see if we can find the next exit
|
||||
for j in range(i+1, len(df_with_signals)):
|
||||
@@ -199,7 +198,7 @@ def debug_enhanced_backtest():
|
||||
break
|
||||
|
||||
if j > i + 10: # Only check next 10 bars
|
||||
print(f" ⏰ No exit in next 10 bars")
|
||||
print(" ⏰ No exit in next 10 bars")
|
||||
break
|
||||
|
||||
trades.append({'signal': signal, 'entry': entry_price})
|
||||
@@ -207,14 +206,14 @@ def debug_enhanced_backtest():
|
||||
if len(trades) >= 3: # Limit debug output
|
||||
break
|
||||
|
||||
print(f"\\n📋 DEBUG SUMMARY:")
|
||||
print("\\n📋 DEBUG SUMMARY:")
|
||||
print(f"Processed {len(trades)} potential trades")
|
||||
|
||||
if len(trades) > 0:
|
||||
print(f"✅ Trade logic is working - trades should execute")
|
||||
print(f"❓ The issue might be in the actual enhanced_engine implementation")
|
||||
print("✅ Trade logic is working - trades should execute")
|
||||
print("❓ The issue might be in the actual enhanced_engine implementation")
|
||||
else:
|
||||
print(f"❌ No trades processed - issue in trade logic")
|
||||
print("❌ No trades processed - issue in trade logic")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error in debug: {e}")
|
||||
|
||||
@@ -9,7 +9,7 @@ import sys
|
||||
import os
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from datetime import date, datetime, timedelta
|
||||
from datetime import date, timedelta
|
||||
from core.ai.trading_mentor_ai import IndonesianTradingMentorAI, TradingSession
|
||||
from core.db.models import (
|
||||
create_trading_session, log_trade_for_ai_analysis,
|
||||
@@ -127,7 +127,7 @@ def test_historical_reports():
|
||||
emotions_cycle = ['tenang', 'serakah', 'frustasi', 'takut', 'tenang', 'serakah', 'tenang']
|
||||
|
||||
for test_date, emotion in zip(historical_dates, emotions_cycle):
|
||||
session_id = create_trading_session(
|
||||
create_trading_session(
|
||||
session_date=test_date,
|
||||
emotions=emotion,
|
||||
market_conditions='normal',
|
||||
|
||||
@@ -31,7 +31,7 @@ try:
|
||||
# Check if bot 3 is in active_bots
|
||||
if bot_id in active_bots:
|
||||
bot_instance = active_bots[bot_id]
|
||||
print(f"Bot instance found:")
|
||||
print("Bot instance found:")
|
||||
print(f" - Alive: {bot_instance.is_alive()}")
|
||||
print(f" - Status: {bot_instance.status}")
|
||||
if hasattr(bot_instance, 'last_analysis'):
|
||||
@@ -42,7 +42,7 @@ try:
|
||||
# Get bot from database
|
||||
bot_data = queries.get_bot_by_id(bot_id)
|
||||
if bot_data:
|
||||
print(f"\\nBot in database:")
|
||||
print("\\nBot in database:")
|
||||
print(f" - Name: {bot_data['name']}")
|
||||
print(f" - Market: {bot_data['market']}")
|
||||
print(f" - Status: {bot_data['status']}")
|
||||
|
||||
@@ -69,7 +69,7 @@ def test_atr_education_system():
|
||||
print(f" Risk-to-Reward: {example['risk_to_reward_ratio']}")
|
||||
|
||||
if example['protection_active']:
|
||||
print(f" 🛡️ PROTECTION: System reduced risk for safety!")
|
||||
print(" 🛡️ PROTECTION: System reduced risk for safety!")
|
||||
|
||||
# Test 3: Parameter validation
|
||||
print("\n3. ⚙️ Parameter Validation:")
|
||||
@@ -161,7 +161,7 @@ def demonstrate_atr_protection():
|
||||
print(f" 💰 PROTECTION SAVED: ${savings:.0f}")
|
||||
print(f" 🎯 System automatically reduced risk by {(savings/example['amount_to_risk_target']*100):.0f}%")
|
||||
|
||||
print(f"\\n 📝 Explanation:")
|
||||
print("\\n 📝 Explanation:")
|
||||
for exp in example['explanation']:
|
||||
print(f" {exp}")
|
||||
|
||||
|
||||
@@ -8,10 +8,7 @@ import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
# Set up logging to see what's happening
|
||||
logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(name)s:%(message)s')
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"routes": [
|
||||
{
|
||||
"src": "/(.*)",
|
||||
"dest": "/api/app.py"
|
||||
}
|
||||
],
|
||||
"env": {
|
||||
"SKIP_MT5_INIT": "1"
|
||||
}
|
||||
],
|
||||
"env": {
|
||||
"SKIP_MT5_INIT": "1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user