mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2025-06-15 23:06:40 +00:00
fixed bug where data wasn't available afterhours.
This commit is contained in:
parent
0b01ddea15
commit
1e60528a08
@ -192,7 +192,11 @@ _Donations can only be made in a chat directly with @simplestockbot_
|
||||
if response.status_code == 200:
|
||||
IEXData = response.json()
|
||||
|
||||
if IEXData["isUSMarketOpen"]: # Check if market is open.
|
||||
if (
|
||||
IEXData["isUSMarketOpen"]
|
||||
or (IEXData["extendedChangePercent"] == None)
|
||||
or (IEXData["extendedPrice"] == None)
|
||||
): # Check if market is open.
|
||||
message = f"The current stock price of {IEXData['companyName']} is $**{IEXData['latestPrice']}**"
|
||||
change = round(IEXData["changePercent"] * 100, 2)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user