Пример #1
0
def view_comparisons(symbols: List[str], export: str):
    """Show ETF comparisons

    Parameters
    ----------
    symbols: List[str]
        List of ETF symbols
    export: str
        Format to export data
    """

    etf_list = stockanalysis_model.get_all_names_symbols()[0]
    for etf in symbols:
        if etf not in etf_list:
            console.print(f"{etf} not a known symbol.\n")
            etf_list.remove(etf)

    data = stockanalysis_model.compare_etfs(symbols)
    if data.empty:
        console.print("No data found for given ETFs\n")
        return
    print_rich_table(data, headers=list(data.columns), title="ETF Comparisons")
    console.print("")
    export_data(export, os.path.dirname(os.path.abspath(__file__)), "overview",
                data)
def view_comparisons(symbols: List[str], export: str):
    """Show ETF comparisons

    Parameters
    ----------
    symbols: List[str]
        List of ETF symbols
    export: str
        Format to export data
    """

    etf_list = stockanalysis_model.get_all_names_symbols()[0]
    for etf in symbols:
        if etf not in etf_list:
            print(f"{etf} not a known symbol.\n")
            etf_list.remove(etf)

    data = stockanalysis_model.compare_etfs(symbols)
    if data.empty:
        print("No data found for given ETFs\n")
        return
    if gtff.USE_TABULATE_DF:
        print(tabulate(data, headers=data.columns, tablefmt="fancy_grid"), "\n")
    else:
        print(data.to_string())
    export_data(export, os.path.dirname(os.path.abspath(__file__)), "overview", data)
Пример #3
0
 def call_compare(self, other_args):
     """Process compare command"""
     compare_etfs(other_args)
def test_compare_etfs(recorder, symbols):
    result_df = stockanalysis_model.compare_etfs(symbols)

    assert not result_df.empty
    recorder.capture(result_df)