def low_float(num: int, export: str):
    """Prints top N low float stocks from https://www.lowfloat.com

    Parameters
    ----------
    num: int
        Number of stocks to display
    export : str
        Export dataframe data to csv,json,xlsx file
    """
    df_low_float = shortinterest_model.get_low_float()
    df_low_float = df_low_float.iloc[1:].head(n=num)

    print_rich_table(
        df_low_float,
        headers=list(df_low_float.columns),
        show_index=False,
        title="Top Float Stocks",
    )

    export_data(
        export,
        os.path.dirname(os.path.abspath(__file__)),
        "lowfloat",
        df_low_float,
    )
Пример #2
0
def low_float(num: int, export: str):
    """Prints top N low float stocks from https://www.lowfloat.com

    Parameters
    ----------
    num: int
        Number of stocks to display
    export : str
        Export dataframe data to csv,json,xlsx file
    """
    df_low_float = shortinterest_model.get_low_float()
    df_low_float = df_low_float.iloc[1:].head(n=num)

    print(
        tabulate(
            df_low_float,
            headers=df_low_float.columns,
            floatfmt=".2f",
            showindex=False,
            tablefmt="fancy_grid",
        ),
        "\n",
    )

    export_data(
        export,
        os.path.dirname(os.path.abspath(__file__)),
        "lowfloat",
        df_low_float,
    )
    def test_get_low_float(self, mock_request_get, mock_low_float, expected_result):
        mock_request_get.get().text = mock_low_float

        df_low_float = get_low_float()

        assertions.assertEqual.__self__.maxDiff = None
        assertions.assertEqual(
            df_low_float.to_csv().replace("\r\n", "\n"),
            expected_result.replace("\r\n", "\n"),
        )
Пример #4
0
def test_get_low_float(recorder):
    df_low_float = shortinterest_model.get_low_float()
    recorder.capture(df_low_float)