Files
OpenBB/bots/cmds/disc_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

101 lines
2.9 KiB
Python

from __future__ import annotations
import disnake
from disnake.ext import commands
from bots.helpers import ShowView, ticker_autocomp
from bots.stocks.disc.active import active_command
from bots.stocks.disc.ford import ford_command
from bots.stocks.disc.topgainers import gainers_command
from bots.stocks.disc.toplosers import losers_command
from bots.stocks.disc.ugs import ugs_command
from bots.stocks.disc.upcoming import earnings_command
from bots.stocks.insider.lins import lins_command
class DiscoverCommands(commands.Cog):
"""Discover menu."""
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.slash_command(name="disc")
async def discovery(self, inter):
pass
@discovery.sub_command(name="tops")
async def tops(
self,
inter: disnake.AppCmdInter,
sort: str = commands.Param(
choices={
"Top Gainers",
"Top Losers",
"Most Active",
},
),
num: int = 10,
):
"""Displays Top Gainers/Losers, or Most Active Stocks [Yahoo Finance]
Parameters
-----------
sort: Sort by Top Gainers/Losers, or Most Active Stocks
num: Number of stocks to display Default: 10
"""
func = {
"Top Gainers": gainers_command,
"Top Losers": losers_command,
"Most Active": active_command,
}
await ShowView().discord(func[sort], inter, "disc", num)
@discovery.sub_command(name="ugs")
async def ugs(
self,
inter: disnake.AppCmdInter,
num: int = 10,
):
"""Displays Undervalued Growth Stocks [Yahoo Finance]
Parameters
-----------
num: Number of stocks to display Default: 10
"""
await ShowView().discord(ugs_command, inter, "ugs", num)
@discovery.sub_command(name="fidelity")
async def fidelity(self, inter: disnake.AppCmdInter):
"""Display Orders by Fidelity Customers. [Fidelity]
Parameters
-----------
num: Number of stocks to display
"""
await ShowView().discord(ford_command, inter, "disc fidelity")
@commands.slash_command(name="earnings")
async def earnings(self, inter: disnake.AppCmdInter):
"""Display Upcoming Earnings. [Source: Seeking Alpha]"""
await ShowView().discord(earnings_command, inter, "earnings")
@commands.slash_command(name="ins-last")
async def lins(
self,
inter: disnake.AppCmdInter,
ticker: str = commands.Param(autocomplete=ticker_autocomp),
num: int = 10,
):
"""Display insider activity for a given stock ticker. [Finviz]
Parameters
----------
ticker : Stock Ticker
num : Number of latest insider activity to display
"""
await ShowView().discord(lins_command, inter, "ins-last", ticker, num)
def setup(bot: commands.Bot):
bot.add_cog(DiscoverCommands(bot))