async def supplier_command(ctx, ticker=""): """Displays suppliers of the company [CSIMarket]""" try: # Debug user input if cfg.DEBUG: logger.debug("!stocks.dd.supplier %s", ticker) if ticker == "": raise Exception("A ticker is required") tickers = csimarket_model.get_suppliers(ticker) if tickers == "": raise Exception("Enter a valid ticker") # Debug user output if cfg.DEBUG: logger.debug(tickers) # Output data embed = discord.Embed( title="Stocks: [CSIMarket] Company Suppliers", description=tickers, 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 Stocks: [CSIMarket] Company Suppliers", colour=cfg.COLOR, description=e, ) embed.set_author( name=cfg.AUTHOR_NAME, icon_url=cfg.AUTHOR_ICON_URL, ) await ctx.send(embed=embed)
def suppliers(ticker: str, export: str): """Display suppliers from ticker provided. [Source: CSIMarket] Parameters ---------- ticker: str Ticker to select suppliers from export : str Export dataframe data to csv,json,xlsx file """ tickers = csimarket_model.get_suppliers(ticker) console.print(tickers) export_data( export, os.path.dirname(os.path.abspath(__file__)), "supplier", pd.DataFrame(tickers.split(",")), )
def supplier_command(ticker=""): """Displays suppliers of the company [CSIMarket]""" # Debug user input if cfg.DEBUG: logger.debug("dd-supplier %s", ticker) if not ticker: raise Exception("A ticker is required") tickers = csimarket_model.get_suppliers(ticker) if not tickers: raise Exception("Enter a valid ticker") # Debug user output if cfg.DEBUG: logger.debug(tickers) # Output data return { "title": "Stocks: [CSIMarket] Company Suppliers", "description": tickers, }
def test_get_suppliers_invalid(recorder): result_txt = csimarket_model.get_suppliers(ticker="INVALID_TICKER") recorder.capture(result_txt)
def test_get_suppliers(recorder): result_txt = csimarket_model.get_suppliers(ticker="TSLA") recorder.capture(result_txt)