[stock] Add new fields to stock command
This commit is contained in:
parent
911b62dd1e
commit
45740fcd32
@ -584,6 +584,7 @@ async def source(ctx):
|
||||
async def yt(ctx):
|
||||
await youtube(ctx)
|
||||
|
||||
|
||||
@bot.command(name="youtube")
|
||||
async def youtube(ctx):
|
||||
import youtube
|
||||
|
47
app/stock.py
47
app/stock.py
@ -33,7 +33,9 @@ def get_stock(share_name):
|
||||
embed_color = 2067276
|
||||
meme_url = "https://i.ytimg.com/vi/if-2M3K1tqk/hqdefault.jpg"
|
||||
# If stock price has gone down since open, use red and a sad stonk meme
|
||||
if float(request["bid"]) < float(request["regularMarketOpen"]):
|
||||
|
||||
current_change = request["regularMarketPrice"] - request["regularMarketOpen"]
|
||||
if current_change < 0:
|
||||
change_symbol = "-"
|
||||
embed_color = 15158332
|
||||
meme_url = "https://i.ytimg.com/vi/E_XlA_IEzwM/hqdefault.jpg"
|
||||
@ -41,29 +43,50 @@ def get_stock(share_name):
|
||||
embed = discord.Embed(description="-------", color=embed_color, type="rich")
|
||||
embed.set_thumbnail(url=meme_url)
|
||||
embed.set_author(name=request["longName"])
|
||||
embed.add_field(name="Current Price", value="$%s" % request["bid"], inline=False)
|
||||
|
||||
embed.add_field(
|
||||
name="Current price", value="$%s" % request["regularMarketPrice"], inline=False
|
||||
)
|
||||
embed.add_field(
|
||||
name="Opening price", value="$%s" % request["regularMarketOpen"], inline=False
|
||||
)
|
||||
embed.add_field(
|
||||
name="Change since day open", value="$%s" % current_change, inline=False
|
||||
)
|
||||
embed.add_field(
|
||||
name="Change since day open, as %",
|
||||
value="%s%%" % (current_change * 100 / request["regularMarketOpen"]),
|
||||
inline=False,
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Previous Close",
|
||||
value="$%s" % request["regularMarketPreviousClose"],
|
||||
inline=False,
|
||||
)
|
||||
embed.add_field(
|
||||
name="Opening price", value="$%s" % request["regularMarketOpen"], inline=False
|
||||
)
|
||||
embed.add_field(
|
||||
name="Change", value="$%s" % request["regularMarketChange"], inline=False
|
||||
)
|
||||
embed.add_field(
|
||||
name="Change percent",
|
||||
value="%s%%" % request["regularMarketChangePercent"],
|
||||
name="Change since previous close",
|
||||
value="$%s" % request["regularMarketChange"],
|
||||
inline=False,
|
||||
)
|
||||
embed.add_field(
|
||||
name="Day Low", value="$%s" % request["regularMarketDayLow"], inline=False
|
||||
name="Change since previous close, as %",
|
||||
value="%s%%" % request["regularMarketChangePercent"],
|
||||
inline=False,
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Current bid price", value="$%s" % request["bid"], inline=False
|
||||
)
|
||||
embed.add_field(
|
||||
name="Day High", value="$%s" % request["regularMarketDayHigh"], inline=False
|
||||
name="Current ask price", value="$%s" % request["ask"], inline=False
|
||||
)
|
||||
embed.add_field(
|
||||
name="Current bid-ask spread",
|
||||
value="$%s" % (request["bid"] - request["ask"]),
|
||||
inline=False,
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Day's Range", value=request["regularMarketDayRange"], inline=False
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user