Repository: OpenBB-finance/OpenBBTerminal
File: gamestonk_terminal/stocks/stocks_helper.py (Python)

Code before:
                s_start = ns_parser.s_start_date

        s_intraday = (f"Intraday {s_interval}", "Daily")[ns_parser.n_interval == 1440]

        print(
            f"Loading {s_intraday} {ns_parser.s_ticker.upper()} stock "
            f"with starting period {s_start.strftime('%Y-%m-%d')} for analysis.\n"
        )

        return [
            ns_parser.s_ticker.upper(),
            s_start,
            str(ns_parser.n_interval) + "min",
            df_stock_candidate,
        ]

    except Exception as e:
        print(e, "\nEither the ticker or the API_KEY are invalids. Try again!\n")
        return [s_ticker, s_start, s_interval, df_stock]

    except SystemExit:
        print("")
        return [s_ticker, s_start, s_interval, df_stock]


def candle(s_ticker: str, ns_parser: argparse.Namespace):
    """Shows candle plot of loaded ticker

    Parameters
    ----------
    s_ticker: str
        Ticker to display
    ns_parser: argparse.Namespace
        Parsed namespace

    """
    # TODO: Add option to customize plot even further

    df_stock = trend.load_ticker(s_ticker, ns_parser.s_start)
    df_stock["ma20"] = df_stock["Close"].rolling(20).mean().fillna(method="bfill")
    df_stock["ma50"] = df_stock["Close"].rolling(50).mean().fillna(method="bfill")

    df_stock = trend.find_trendline(df_stock, "OC_High", "high")
    df_stock = trend.find_trendline(df_stock, "OC_Low", "low")
    if not ns_parser.plotly:
        mc = mpf.make_marketcolors(
            up="green",
            down="red",
            edge="black",
            wick="black",
            volume="in",

Review comment (suggestion):
I don't like this taking ns_parser, just seems very redundant to me. Also, if someone was to use candle, they would have no idea what things this takes.

Could we maybe redo this function to just `display_candle` and then just use the arguments needed here.

Code after:
                s_start = ns_parser.s_start_date

        s_intraday = (f"Intraday {s_interval}", "Daily")[ns_parser.n_interval == 1440]

        print(
            f"Loading {s_intraday} {ns_parser.s_ticker.upper()} stock "
            f"with starting period {s_start.strftime('%Y-%m-%d')} for analysis.\n"
        )

        return [
            ns_parser.s_ticker.upper(),
            s_start,
            str(ns_parser.n_interval) + "min",
            df_stock_candidate,
        ]

    except Exception as e:
        print(e, "\nEither the ticker or the API_KEY are invalids. Try again!\n")
        return [s_ticker, s_start, s_interval, df_stock]

    except SystemExit:
        print("")
        return [s_ticker, s_start, s_interval, df_stock]


def display_candle(s_ticker: str, s_start: datetime, plotly: bool):
    """Shows candle plot of loaded ticker

    Parameters
    ----------
    s_ticker: str
        Ticker to display
    s_start: datetime
        Starting date for candle
    plotly: bool
        Flag to show interactive plotly chart

    """
    # TODO: Add option to customize plot even further
    print(type(s_start))
    df_stock = trend.load_ticker(s_ticker, s_start)
    df_stock["ma20"] = df_stock["Close"].rolling(20).mean().fillna(method="bfill")
    df_stock["ma50"] = df_stock["Close"].rolling(50).mean().fillna(method="bfill")

    df_stock = trend.find_trendline(df_stock, "OC_High", "high")
    df_stock = trend.find_trendline(df_stock, "OC_Low", "low")
    if not plotly:
        mc = mpf.make_marketcolors(
            up="green",
            down="red",
            edge="black",