Ajout analyse de rapports
This commit is contained in:
22
src/app.py
22
src/app.py
@@ -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', '')
|
||||
|
||||
Reference in New Issue
Block a user