mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2025-06-16 15:17:28 +00:00
previous update introducted errors.
This commit is contained in:
parent
2f1eb6dcd6
commit
cb8a7ccad8
12
functions.py
12
functions.py
@ -227,8 +227,8 @@ _Donations can only be made in a chat directly with @simplestockbot_
|
|||||||
"latestPrice",
|
"latestPrice",
|
||||||
"changePercent",
|
"changePercent",
|
||||||
)
|
)
|
||||||
|
[print(k, IEXData[k]) for k in keys]
|
||||||
if set(keys).issubset(IEXData) and all([IEXData[k] for k in keys]):
|
if set(keys).issubset(IEXData):
|
||||||
|
|
||||||
try: # Some symbols dont return if the market is open
|
try: # Some symbols dont return if the market is open
|
||||||
IEXData["isUSMarketOpen"]
|
IEXData["isUSMarketOpen"]
|
||||||
@ -240,8 +240,12 @@ _Donations can only be made in a chat directly with @simplestockbot_
|
|||||||
or (IEXData["extendedChangePercent"] is None)
|
or (IEXData["extendedChangePercent"] is None)
|
||||||
or (IEXData["extendedPrice"] is None)
|
or (IEXData["extendedPrice"] is None)
|
||||||
): # Check if market is open.
|
): # Check if market is open.
|
||||||
|
|
||||||
message = f"The current stock price of {IEXData['companyName']} is $**{IEXData['latestPrice']}**"
|
message = f"The current stock price of {IEXData['companyName']} is $**{IEXData['latestPrice']}**"
|
||||||
change = round(IEXData["changePercent"] * 100, 2)
|
try:
|
||||||
|
change = round(IEXData["changePercent"] * 100, 2)
|
||||||
|
except (KeyError, TypeError):
|
||||||
|
change = 0
|
||||||
else:
|
else:
|
||||||
message = (
|
message = (
|
||||||
f"{IEXData['companyName']} closed at $**{IEXData['latestPrice']}**,"
|
f"{IEXData['companyName']} closed at $**{IEXData['latestPrice']}**,"
|
||||||
@ -264,6 +268,8 @@ _Donations can only be made in a chat directly with @simplestockbot_
|
|||||||
|
|
||||||
if symbol.upper() == "GME":
|
if symbol.upper() == "GME":
|
||||||
message += "\n\n🙌💎Power to the Players💎🙌"
|
message += "\n\n🙌💎Power to the Players💎🙌"
|
||||||
|
if IEXData["latestPrice"] is None:
|
||||||
|
message = f"{symbol} has not reported price info to IEX Cloud."
|
||||||
|
|
||||||
dataMessages[symbol] = message
|
dataMessages[symbol] = message
|
||||||
return dataMessages
|
return dataMessages
|
||||||
|
Loading…
x
Reference in New Issue
Block a user