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

Coin formatting for price reply

This commit is contained in:
Anson Biggs 2021-03-27 18:24:33 -07:00
parent 6ab7f2c25d
commit 367fab669f

View File

@ -134,18 +134,18 @@ class cg_Crypto:
except KeyError: except KeyError:
return f"{symbol} returned an error." return f"{symbol} returned an error."
message = f"The current coin price of {name} is $**{price}**" message = f"The current coin price of {name} is $**{price:,}**"
# Determine wording of change text # Determine wording of change text
if change > 0: if change > 0:
message += f", the coin is currently **up {change}%**" message += f", the coin is currently **up {change:.3f}%** for today"
elif change < 0: elif change < 0:
message += f", the coin is currently **down {change}%**" message += f", the coin is currently **down {change:.3f}%** for today"
else: else:
message += ", the coin hasn't shown any movement today." message += ", the coin hasn't shown any movement today."
else: else:
message = f"The symbol: {symbol} was not found." message = f"The Coin: {symbol.name} was not found."
return message return message