fetch crypto and stock portfolio values and send back to app.js
This commit is contained in:
parent
a5e30dfc1c
commit
73a3220fb8
35
server.py
35
server.py
@ -1515,6 +1515,41 @@ def setTop20or10():
|
|||||||
return index()
|
return index()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/fetchStockPortfolio", methods=["POST"])
|
||||||
|
def fetchStockPortfolio():
|
||||||
|
value = request.data.decode('utf-8')
|
||||||
|
value2 = json.loads(value)
|
||||||
|
try:
|
||||||
|
with open("csv/portfolio_settings.json") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
except:
|
||||||
|
data = {"symbols": {}}
|
||||||
|
try:
|
||||||
|
stock_pos_info = data['symbols'][value2]
|
||||||
|
except:
|
||||||
|
stock_pos_info = {}
|
||||||
|
|
||||||
|
return (stock_pos_info)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/fetchCryptoPortfolio", methods=["POST"])
|
||||||
|
def fetchCryptoPortfolio():
|
||||||
|
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:
|
||||||
|
crypto_pos_info = data['symbols'][value2]
|
||||||
|
except:
|
||||||
|
crypto_pos_info = {}
|
||||||
|
|
||||||
|
return (crypto_pos_info)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/fetchCustomMsg", methods=["POST"])
|
@app.route("/fetchCustomMsg", methods=["POST"])
|
||||||
def fetch_custom_msg():
|
def fetch_custom_msg():
|
||||||
value = request.data.decode('utf-8')
|
value = request.data.decode('utf-8')
|
||||||
|
Loading…
Reference in New Issue
Block a user