delete crypto position func

This commit is contained in:
Justin 2023-07-11 19:30:48 +08:00 committed by GitHub
parent 32c0ea4d98
commit 17729b184f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"]) @app.route("/deletePortfolioPosition", methods=["POST"])
def deletePortfolioPosition(): def deletePortfolioPosition():
value = request.data.decode('utf-8') value = request.data.decode('utf-8')