From 17729b184fc99766b40d3963f6fcfc42a688cf1e Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 11 Jul 2023 19:30:48 +0800 Subject: [PATCH] delete crypto position func --- server.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server.py b/server.py index c38efa9..f11f092 100755 --- a/server.py +++ b/server.py @@ -1516,6 +1516,24 @@ def setTop20or10(): +@app.route("/deletePortfolioPositionCrypto", methods=["POST"]) +def deletePortfolioPositionCrypto(): + value = request.data.decode('utf-8') + value2 = json.loads(value) + try: + with open("csv/portfolio_crypto_settings.json") as f: + data = json.load(f) + except: + data = {"symbols": {}} + try: + del data["symbols"][value2] + with open('csv/portfolio_crypto_settings.json', 'w') as f: + json.dump(data, f) + except: + pass + return index() + + @app.route("/deletePortfolioPosition", methods=["POST"]) def deletePortfolioPosition(): value = request.data.decode('utf-8')