mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-08-01 05:07:45 +00:00
348acc6f43
This major commit introduces a new advanced trading strategy, resolves critical trading logic errors, and significantly enhances system stability and UI data accuracy.
Key Changes:
- **New Features & Strategies**:
- **Quantum Velocity Strategy**: Added 'quantum_velocity.py', a new hybrid strategy combining a long-term trend filter (EMA 200) with a volatility-based entry trigger (Bollinger Squeeze).
- **Hybrid Pro Backtester**: Added 'lab/backtester_hybrid_pro.py' to facilitate advanced, offline testing and optimization of the QuantumBotX Hybrid strategy.
- **Critical Trading Logic Fixes**:
- Resolved 'Invalid Stops' and 'Unsupported filling mode' errors by refactoring 'core/mt5/trade.py' to use dynamic point calculation and the FOK fill policy.
- Fixed a recurring 'KeyError' in 'BollingerSqueezeStrategy' by ensuring consistent naming for Bollinger Bands columns.
- **System Stability & Robustness**:
- Hardened the graceful shutdown handler in 'app.py' to prevent crashes from repeated Ctrl+C signals, ensuring a clean shutdown process.
- Enhanced the notification system by adding an 'is_notification' flag to logs, allowing for a clear distinction between critical alerts and general activity.
- **Dashboard & UI Enhancements**:
- Fixed the 'Total Bots' card on the dashboard by correcting the backend API ('api_dashboard.py') to send the complete stats payload.
- Replaced static '0' values on dashboard cards with loading spinners for a more professional user experience.
- The 'Create/Edit Bot' modal button now dynamically changes its text to 'Ubah Bot' when in edit mode.
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
# core/routes/api_notifications.py
|
|
|
|
from core.db import queries
|
|
from flask import Blueprint, jsonify
|
|
|
|
api_notifications = Blueprint('api_notifications', __name__)
|
|
|
|
@api_notifications.route('/api/notifications', methods=['GET'])
|
|
def get_notifications_route():
|
|
"""Mengembalikan daftar notifikasi penting."""
|
|
try:
|
|
notifications = queries.get_notifications()
|
|
return jsonify(notifications)
|
|
except Exception as e:
|
|
return jsonify({"error": f"Gagal mengambil notifikasi: {e}"}), 500
|
|
|
|
@api_notifications.route('/api/notifications/unread-count')
|
|
def get_unread_notifications_count():
|
|
"""Mengembalikan jumlah notifikasi yang belum dibaca."""
|
|
try:
|
|
count = queries.get_unread_notifications_count()
|
|
return jsonify(count)
|
|
except Exception as e:
|
|
return jsonify({"error": f"Gagal menghitung notifikasi: {e}"}), 500
|
|
|
|
@api_notifications.route('/api/notifications/mark-as-read', methods=['POST'])
|
|
def mark_notifications_as_read():
|
|
"""Menandai semua notifikasi sebagai sudah dibaca."""
|
|
try:
|
|
queries.mark_notifications_as_read()
|
|
return jsonify({'message': 'Semua notifikasi ditandai sudah dibaca.'})
|
|
except Exception as e:
|
|
return jsonify({"error": f"Gagal menandai notifikasi: {e}"}), 500
|