From 985fb8392d4c45539ef5163d403280172517fba8 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 17 Mar 2023 16:53:07 +0800 Subject: [PATCH] delete portfolio settings --- server.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/server.py b/server.py index 2387d38..c858b2e 100755 --- a/server.py +++ b/server.py @@ -732,6 +732,33 @@ def savePortfolioSettings(): return index() +@app.route("/deletePortfolioSettings", methods = ['PUT', 'POST']) +def deletePortfolioSettings(): + + data= request.data.decode('utf-8') + settings = json.loads(data) + + try: + g = open('csv/portfolio_settings.json') + portfolio = json.load(g) + g.close() + + symbol = settings + # DELETE SYMBOLS FUNCTION + try: + portfolio['symbols'].pop(symbol) + except: + pass + + f = open("csv/portfolio_settings.json", 'w+') + json.dump(portfolio, f) + f.close() + except: + pass + + return index() + + @app.route("/screensaver", methods = ['PUT', 'POST']) def screensaver(): global displaying_screensaver