mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2025-06-16 15:17:28 +00:00
fix price_reply again
This commit is contained in:
parent
6df703bd1e
commit
f5195700a6
@ -178,16 +178,19 @@ class IEX_Symbol:
|
|||||||
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']}**"
|
||||||
|
if change := IEXData.get("changePercent", 0):
|
||||||
|
change = round(change * 100, 2)
|
||||||
|
else:
|
||||||
|
change = 0
|
||||||
else:
|
else:
|
||||||
message = (
|
message = (
|
||||||
f"{IEXData['companyName']} closed at $**{IEXData['latestPrice']}**,"
|
f"{IEXData['companyName']} closed at $**{IEXData['latestPrice']}**,"
|
||||||
+ f" after hours _(15 minutes delayed)_ the stock price is $**{IEXData['extendedPrice']}**"
|
+ f" after hours _(15 minutes delayed)_ the stock price is $**{IEXData['extendedPrice']}**"
|
||||||
)
|
)
|
||||||
if change := IEXData.get("extendedChangePercent", 0):
|
if change := IEXData.get("extendedChangePercent", 0):
|
||||||
change = round(change * 100, 2)
|
change = round(change * 100, 2)
|
||||||
else:
|
else:
|
||||||
change = 0
|
change = 0
|
||||||
|
|
||||||
# Determine wording of change text
|
# Determine wording of change text
|
||||||
if change > 0:
|
if change > 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user