mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
* 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>
83 lines
2.5 KiB
Python
83 lines
2.5 KiB
Python
from __future__ import annotations
|
|
|
|
import disnake
|
|
import disnake.ext.commands as commands
|
|
|
|
from bots import helpers
|
|
from bots.stocks.sia.cpic import cpic_command
|
|
from bots.stocks.sia.cps import cps_command
|
|
from bots.stocks.sia.metric import metric_command
|
|
|
|
|
|
class StocksSIACommands(commands.Cog):
|
|
def __init__(self, bot):
|
|
super().__init__
|
|
self.bot: commands.Bot = bot
|
|
|
|
@commands.slash_command()
|
|
async def sia(self, inter):
|
|
pass
|
|
|
|
@sia.sub_command(name="cps")
|
|
async def sia_cps(
|
|
self,
|
|
inter: disnake.AppCmdInter,
|
|
country: str = commands.Param(autocomplete=helpers.country_autocomp),
|
|
):
|
|
"""Display number of companies per industry in a specific country. [Source: Finance Database]
|
|
|
|
Parameters
|
|
----------
|
|
country: Country to Display Companies per Sector
|
|
mktcap: Select market cap of companies to consider from Small, Mid and Large
|
|
"""
|
|
await helpers.ShowView().discord(
|
|
cps_command,
|
|
inter,
|
|
"sia cps",
|
|
country,
|
|
)
|
|
|
|
@sia.sub_command(name="cpic")
|
|
async def sia_cpic(
|
|
self,
|
|
inter: disnake.AppCmdInter,
|
|
industry: str = commands.Param(autocomplete=helpers.industry_autocomp),
|
|
):
|
|
"""Display number of companies per country in a specific industry. [Source: Finance Database]
|
|
|
|
Parameters
|
|
----------
|
|
industry: Select industry to get number of companies by each country
|
|
mktcap: Select market cap of companies to consider from Small, Mid and Large
|
|
"""
|
|
await helpers.ShowView().discord(
|
|
cpic_command,
|
|
inter,
|
|
"sia cpic",
|
|
industry,
|
|
)
|
|
|
|
@sia.sub_command(name="metrics")
|
|
async def sia_mertics(
|
|
self,
|
|
inter: disnake.AppCmdInter,
|
|
ticker: str = commands.Param(autocomplete=helpers.ticker_autocomp),
|
|
metric: str = commands.Param(autocomplete=helpers.metric_autocomp),
|
|
):
|
|
"""Visualise financial metric across filters selected [Source: Finance Database]
|
|
|
|
Parameters
|
|
----------
|
|
metric: Select financial metric
|
|
ticker: Company to use for Industry, Sector, and Market Cap
|
|
"""
|
|
met_arg = helpers.metric_yf_keys[metric]
|
|
await helpers.ShowView().discord(
|
|
metric_command, inter, "sia metrics", met_arg[0], met_arg[1], ticker
|
|
)
|
|
|
|
|
|
def setup(bot: commands.Bot):
|
|
bot.add_cog(StocksSIACommands(bot))
|