1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2025-06-16 07:16:40 +00:00

fixed bug where data wasn't available afterhours.

This commit is contained in:
Anson Biggs 2021-02-05 15:55:23 -07:00
parent 0b01ddea15
commit 1e60528a08

View File

@ -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: