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