Ajout analyse de rapports

This commit is contained in:
Jérôme Delacotte
2025-05-10 17:09:59 +02:00
parent c8fd868b6b
commit adef1736e5
5 changed files with 89 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ import os
import pickle
import joblib
from io import TextIOWrapper
from ydata_profiling import ProfileReport
app = Flask(__name__)
FREQTRADE_USERDATA_DIR = '/mnt/external'
@@ -126,6 +126,26 @@ def read_feather(filename):
print(e)
return jsonify({"error": str(e)}), 500
@app.route('/generate_report')
def generate_report():
filename = request.args.get('filename', '')
path = os.path.join(FREQTRADE_USERDATA_DIR + "/data/binance/", filename)
print(path)
indicators = request.args.get('indicators', '').split(',')
print(indicators)
try:
dataframe = pd.read_feather(path)
print(dataframe.columns)
df = dataframe[indicators]
profile = ProfileReport(df.loc[1:100], tsmode=True, sortby="date", title="Time-Series EDA")
profile.to_file(FREQTRADE_USERDATA_DIR + "/reports/report_timeseries.html")
return dataframe.to_json(orient="records")
except Exception as e:
print(e)
return jsonify({"error": str(e)}), 500
@app.route('/get_chart_data')
def get_chart_data():
filename = request.args.get('filename', '')