Files
OpenBB/bots/cmds/economy_cmds.py
Colin Delahunty fae93c67ad Refactor Bot (#1326)
* First commit

* Renamed to bot

* change from discordbot to bots imports

* refractor cmds

+ autocomplete helpers
+ updated dps plots/candle
+ quote cmd

* isort fix

* Update helpers.py

* Added first refactor

* Added commands and refactor

* Added description handler

* Through grains

* ta + image border helper

* Added indices

* merged

* Finished econ

* options refactor

* dark_pool_shorts, candle, quote done

* pagination/dropdown logic to helpers + fixes

* dd/disc/insider done + add image logic to helpers

* linting

* removed plt style

* Almost done with Gov

* fixing conflicts

* Finished gov (excpect ones mentioned)

* screener done

* Test bug refactor

* Store changes to switch

* Finished refactor

* Fixed error

* Delete ::40

* Fixed issue

* Fixed black

* finished

* fixes

Co-authored-by: teh_coderer <me@tehcoderer.com>
Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>
2022-02-20 10:36:59 -05:00

150 lines
5.1 KiB
Python

import disnake
from disnake.ext import commands
from bots.economy.currencies import currencies_command
from bots.economy.energy import energy_command
from bots.economy.feargreed import feargreed_command
from bots.economy.futures import futures_command
from bots.economy.glbonds import glbonds_command
from bots.economy.grains import grains_command
from bots.economy.indices import indices_command
from bots.economy.meats import meats_command
from bots.economy.metals import metals_command
from bots.economy.overview import overview_command
from bots.economy.performance import performance_command
from bots.economy.softs import softs_command
from bots.economy.usbonds import usbonds_command
from bots.economy.valuation import valuation_command
from bots.helpers import ShowView
group = [
"basic_materials",
"capitalization",
"communication_services",
"consumer_cyclical",
"consumer_defensive",
"country",
"energy",
"financial",
"healthcare",
"industry",
"industrials",
"real_estate",
"sector",
"technology",
"utilities",
]
fgind = {
"Junk Bond Demand": "jbd",
"Market Volatility": "mv",
"Put and Call Options": "pco",
"Market Momentum": "mm",
"Stock Price Strength": "sps",
"Stock Price Breadth": "spb",
"Safe Heaven Demand": "shd",
}
class EconomyCommands(commands.Cog):
"""Economy Commands menu"""
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.slash_command(name="econ-feargreed")
async def feargreed(self, inter: disnake.AppCmdInter):
"""Feargreed command [CNN]"""
await ShowView().discord(feargreed_command, inter, "econ-feargreed")
@commands.slash_command(name="econ-overview")
async def overview(self, inter: disnake.AppCmdInter):
"""Market data overview [Wall St. Journal]"""
await ShowView().discord(overview_command, inter, "econ-overview")
@commands.slash_command(name="econ-indices")
async def indices(self, inter: disnake.AppCmdInter):
"""US indices overview [Wall St. Journal]"""
await ShowView().discord(indices_command, inter, "econ-indices")
@commands.slash_command(name="econ-futures")
async def futures(self, inter: disnake.AppCmdInter):
"""Futures and commodities overview [Wall St. Journal]"""
await ShowView().discord(futures_command, inter, "econ-futures")
@commands.slash_command(name="econ-usbonds")
async def usbonds(self, inter: disnake.AppCmdInter):
"""US bonds overview [Wall St. Journal]"""
await ShowView().discord(usbonds_command, inter, "econ-usbonds")
@commands.slash_command(name="econ-glbonds")
async def glbonds(self, inter: disnake.AppCmdInter):
"""Global bonds overview [Wall St. Journal]"""
await ShowView().discord(glbonds_command, inter, "econ-glbonds")
@commands.slash_command(name="econ-energy")
async def energy(self, inter: disnake.AppCmdInter):
"""Displays energy futures data [Finviz]"""
await ShowView().discord(energy_command, inter, "econ-energy")
@commands.slash_command(name="econ-metals")
async def metals(self, inter: disnake.AppCmdInter):
"""Displays metals futures data [Finviz]"""
await ShowView().discord(metals_command, inter, "econ-metals")
@commands.slash_command(name="econ-meats")
async def meats(self, inter: disnake.AppCmdInter):
"""Displays meats futures data [Finviz]"""
await ShowView().discord(meats_command, inter, "econ-meats")
@commands.slash_command(name="econ-grains")
async def grains(self, inter: disnake.AppCmdInter):
"""Displays grains futures data [Finviz]"""
await ShowView().discord(grains_command, inter, "econ-grains")
@commands.slash_command(name="econ-softs")
async def softs(self, inter: disnake.AppCmdInter):
"""Displays softs futures data [Finviz]"""
await ShowView().discord(softs_command, inter, "econ-softs")
@commands.slash_command(name="econ-currencies")
async def currencies(self, inter: disnake.AppCmdInter):
"""Currencies overview [Wall St. Journal]"""
await ShowView().discord(currencies_command, inter, "econ-currencies")
@commands.slash_command(name="econ-valuation")
async def valuation(
self,
inter: disnake.AppCmdInter,
economy_group: str = commands.Param(choices=group),
):
"""Valuation of sectors, industry, country [Finviz]
Parameters
-----------
economy_group: Economy Group
"""
await ShowView().discord(
valuation_command, inter, "econ-valuation", economy_group
)
@commands.slash_command(name="econ-performance")
async def performance(
self,
inter: disnake.AppCmdInter,
economy_group: str = commands.Param(choices=group),
):
"""Performance of sectors, industry, country [Finviz]
Parameters
-----------
economy_group: Economy Group
"""
await ShowView().discord(
performance_command, inter, "econ-performance", economy_group
)
def setup(bot: commands.Bot):
bot.add_cog(EconomyCommands(bot))