mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 05:21:48 +00:00
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
import discord
|
|
import discordbot.config_discordbot as cfg
|
|
|
|
from gamestonk_terminal.economy import wsj_model
|
|
|
|
|
|
async def overview_command(ctx):
|
|
"""Market data overview [Wall St. Journal]"""
|
|
|
|
try:
|
|
# Debug user input
|
|
if cfg.DEBUG:
|
|
print("\n!economy.overview")
|
|
|
|
# Retrieve data
|
|
df_data = wsj_model.market_overview()
|
|
|
|
# Debug user output
|
|
if cfg.DEBUG:
|
|
print(df_data.to_string())
|
|
|
|
# Output data
|
|
if df_data.empty:
|
|
df_data_str = "No overview data available"
|
|
else:
|
|
df_data_str = "```" + df_data.to_string(index=False) + "```"
|
|
|
|
embed = discord.Embed(
|
|
title="Economy: [WSJ] Market Overview",
|
|
description=df_data_str,
|
|
colour=cfg.COLOR,
|
|
)
|
|
embed.set_author(
|
|
name=cfg.AUTHOR_NAME,
|
|
icon_url=cfg.AUTHOR_ICON_URL,
|
|
)
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
except Exception as e:
|
|
embed = discord.Embed(
|
|
title="ERROR Economy: [WSJ] Market Overview",
|
|
colour=cfg.COLOR,
|
|
description=e,
|
|
)
|
|
embed.set_author(
|
|
name=cfg.AUTHOR_NAME,
|
|
icon_url=cfg.AUTHOR_ICON_URL,
|
|
)
|
|
|
|
await ctx.send(embed=embed)
|