Files
OpenBB/bots/cmds/etf_cmds.py
teh_coderer 50cafd500e Discord bot massive improvement (#1481)
* allow logs feature flag

* Adding log collection md

* upload last log at startup

* additions/refractor

* refactor

* lint/black ++

* disc

* TimeRotating Logger and upload to s3

* corrected regex error

* makeup for config

* logging/disc/sia/etf/++

* append .log before uploading

* process to upload logs to s3

* candle ta/etfmcds

* fix

* ta candles

* implement presignedURL

* fixed regex

* ma's in 1 cmd, delete older files

* refactor ta candle

* updates

* black

* moon?

* Logger uploader

* rotate every hour

* only archive if successful

* chavis suggestions

* windows

* ta

* commands_dict update

* discord tacmds

* log_collection error fix

* fix

* fix

* pylint

* bb fix

* only log filesize

* fixes

* discord logs

* Delete log_collection.md

* fixes for other bots on images

* bots image upload fix

* updated helpers/load candle

* more ta cc/housekeeping/refactors/slashcmds

* update bots cmds_dict

* adjustments to font size/fixes

* test fixs/disc earnings

* missed a spot

* fixes had > revesred

* reversed the >< again oops

* remove logger branch code blocking tests

* black fix

* fix missing sources in docstr/daily candle dt tz

* load_candle refactor with docstring

* moved insiders to disc

* Lucas logging changes

* Fixing log_collection.md

* testing scenario

* more ta converted

* more ta

* Update config_terminal : remove print of verbosity

* table cfg/fix matplt/ screener +

* fix

* what's sleep? 1 more line.. or 2. scr df2img

* juan more. fix news 1m chart issue

* ticker.upper() fixes

* Update log collection

* Updating log collection - change tmp folder

Co-authored-by: LBolte29 <lbolte@gmx.net>
Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
Co-authored-by: LBolte29 <97528701+LBolte29@users.noreply.github.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>
2022-03-16 10:21:27 +00:00

86 lines
2.1 KiB
Python

from __future__ import annotations
import disnake
from disnake.ext import commands
from bots.etf.holdings import holdings_command
from bots.etf.tops import etfs_disc_command
from bots.etf.whatetf import by_ticker_command
from bots.helpers import ShowView
class EtfCommands(commands.Cog):
"""Discover menu."""
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.slash_command()
async def etf(self, inter):
pass
@etf.sub_command_group()
async def disc(self, inter):
pass
@disc.sub_command(name="tops")
async def etf_tops(
inter: disnake.AppCmdInter,
sort: str = commands.Param(
choices={
"Top Gainers": "gainers",
"Top Decliners": "decliners",
"Most Active": "active",
},
),
):
"""Displays ETF's Top Gainers/Decliners, Most Active [Wall Street Journal]
Parameters
-----------
sort: Sort by Top Gainers, Top Decliners, or Most Active
"""
await ShowView().discord(etfs_disc_command, inter, "etf disc-tops", sort)
@etf.sub_command_group()
async def holdings(self, inter):
pass
@holdings.sub_command(name="by-etf")
async def by_etf(
inter: disnake.AppCmdInter,
etf: str,
num: int = 15,
):
"""Displays ETF's Holdings [StockAnalysis]
Parameters
-----------
etf: ETF Symbol
num: Amount of holdings to display Default 15
"""
await ShowView().discord(
holdings_command, inter, "etf holdings by-etf", etf, num
)
@holdings.sub_command(name="by-ticker")
async def by_ticker(
inter: disnake.AppCmdInter,
ticker: str,
num: int = 15,
):
"""Displays ETF Holdings By Ticker [ETF DataBase]
Parameters
-----------
ticker: Ticker to Search
num: Amount of ETFs to display Default 15
"""
await ShowView().discord(
by_ticker_command, inter, "etf holdings by-ticker", ticker, num
)
def setup(bot: commands.Bot):
bot.add_cog(EtfCommands(bot))