mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-07-28 03:07:53 +00:00
0346b0d632
Refactor the JavaScript code to use a single modal for both forex and stock profiles. Update error handling to display server error messages. Remove unused app.py and fetch.py files. Adjust various routes and strategies for consistency.
24 lines
783 B
Python
24 lines
783 B
Python
# core/routes/api_forex.py
|
|
|
|
from flask import Blueprint, jsonify
|
|
from core.utils.symbols import get_forex_symbols
|
|
from core.utils.external import get_mt5_symbol_profile
|
|
|
|
api_forex = Blueprint('api_forex', __name__)
|
|
|
|
@api_forex.route('/api/forex-data')
|
|
def get_forex_data():
|
|
"""
|
|
Mengembalikan daftar simbol forex, diurutkan berdasarkan popularitas (volume harian).
|
|
Formatnya adalah array JSON, bukan dictionary, agar urutan tetap terjaga.
|
|
"""
|
|
forex_symbols = get_forex_symbols()
|
|
return jsonify(forex_symbols)
|
|
|
|
@api_forex.route('/api/forex/<symbol>/profile')
|
|
def get_forex_profile(symbol):
|
|
profile = get_mt5_symbol_profile(symbol)
|
|
if profile:
|
|
return jsonify(profile)
|
|
return jsonify({"error": "Could not fetch symbol profile from MT5"}), 404
|