use current price if available
All checks were successful
Build and push / changes (push) Successful in 6s
Build and push / Lint-Python (push) Successful in 2s
Build and push / Build-and-Push-Docker (push) Successful in 1m1s
Build and push / sync-argocd-app (push) Successful in 3s
Build and push / post-status-to-discord (push) Successful in 2s
All checks were successful
Build and push / changes (push) Successful in 6s
Build and push / Lint-Python (push) Successful in 2s
Build and push / Build-and-Push-Docker (push) Successful in 1m1s
Build and push / sync-argocd-app (push) Successful in 3s
Build and push / post-status-to-discord (push) Successful in 2s
This commit is contained in:
parent
0f04866795
commit
e492e63825
@ -99,8 +99,9 @@ def get_stock(share_name, verbose=False, fast=False):
|
||||
current_price = request["lastPrice"]
|
||||
else:
|
||||
request = yf.Ticker(share_name).info
|
||||
current_change = request["ask"] - request["open"]
|
||||
current_price = request["ask"]
|
||||
|
||||
current_price = request.get("currentPrice", request["ask"])
|
||||
current_change = current_price - request["open"]
|
||||
except Exception as e:
|
||||
raise ValueError("Invalid symbol %s: empty response from Yahoo" % share_name)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user