From e122a0bb55c6f2d628a8aec89d35bfd15f30c7f7 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Tue, 8 Aug 2023 14:41:40 -0400 Subject: [PATCH] fix wsb/deprecate spacc --- .../behavioural_analysis/reddit_view.py | 7 ++-- .../behavioural_analysis/ba_controller.py | 36 ------------------- .../test_ba_controller.py | 11 ------ .../test_ba_controller/test_print_help.txt | 1 - 4 files changed, 4 insertions(+), 51 deletions(-) diff --git a/openbb_terminal/common/behavioural_analysis/reddit_view.py b/openbb_terminal/common/behavioural_analysis/reddit_view.py index 2855c5349cc..0c0f87c46f9 100644 --- a/openbb_terminal/common/behavioural_analysis/reddit_view.py +++ b/openbb_terminal/common/behavioural_analysis/reddit_view.py @@ -1,6 +1,7 @@ """Reddit View.""" __docformat__ = "numpy" +import io import logging import os import textwrap @@ -212,10 +213,10 @@ def display_wsb_community(limit: int = 10, new: bool = False): Flag to sort by new instead of hot, by default False """ subs = reddit_model.get_wsb_community(limit, new) + # I am not proud of this, but it works to eliminate the max recursion bug + subs = pd.read_csv(io.StringIO(subs.to_csv()), index_col=0).fillna("-") if not subs.empty: - # for sub in subs.iterrows(): - # print_reddit_post(sub) - print(print_rich_table(subs)) + print_rich_table(subs) @log_start_end(log=logger) diff --git a/openbb_terminal/stocks/behavioural_analysis/ba_controller.py b/openbb_terminal/stocks/behavioural_analysis/ba_controller.py index 30cf872117e..00953436ee6 100644 --- a/openbb_terminal/stocks/behavioural_analysis/ba_controller.py +++ b/openbb_terminal/stocks/behavioural_analysis/ba_controller.py @@ -47,7 +47,6 @@ class BehaviouralAnalysisController(StockBaseController): "load", "wsb", "popular", - "spacc", "getdd", "redditsent", "bullbear", @@ -97,7 +96,6 @@ class BehaviouralAnalysisController(StockBaseController): mt.add_cmd("snews", self.ticker) mt.add_cmd("wsb") mt.add_cmd("popular") - mt.add_cmd("spacc") mt.add_cmd("getdd") mt.add_cmd("redditsent", self.ticker) mt.add_cmd("trending") @@ -137,40 +135,6 @@ class BehaviouralAnalysisController(StockBaseController): symbol=self.ticker, export=ns_parser.export ) - @log_start_end(log=logger) - def call_spacc(self, other_args: List[str]): - """Process spacc command.""" - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="spacc", - description="""Print other users SPACs announcement under subreddit 'SPACs'. [Source: Reddit]""", - ) - parser.add_argument( - "-l", - "--limit", - action="store", - dest="n_limit", - type=check_positive, - default=10, - help="limit of posts with SPACs retrieved", - ) - parser.add_argument( - "-p", - "--popular", - action="store_true", - default=False, - dest="b_popular", - help="popular flag, if true the posts retrieved are based on score rather than time", - ) - if other_args and "-" not in other_args[0][0]: - other_args.insert(0, "-l") - ns_parser = self.parse_known_args_and_warn(parser, other_args) - if ns_parser: - reddit_view.display_spac_community( - limit=ns_parser.n_limit, popular=ns_parser.b_popular - ) - @log_start_end(log=logger) def call_wsb(self, other_args: List[str]): """Process wsb command.""" diff --git a/tests/openbb_terminal/stocks/behavioural_analysis/test_ba_controller.py b/tests/openbb_terminal/stocks/behavioural_analysis/test_ba_controller.py index b3e4d94c635..888a0ac6936 100644 --- a/tests/openbb_terminal/stocks/behavioural_analysis/test_ba_controller.py +++ b/tests/openbb_terminal/stocks/behavioural_analysis/test_ba_controller.py @@ -238,16 +238,6 @@ def test_call_func_expect_queue(expected_queue, queue, func): @pytest.mark.parametrize( "tested_func, other_args, mocked_func, called_args, called_kwargs", [ - ( - "call_spacc", - ["--limit=5", "--popular"], - "reddit_view.display_spac_community", - [], - dict( - limit=5, - popular=True, - ), - ), ( "call_wsb", ["--limit=5", "--new"], @@ -426,7 +416,6 @@ def test_call_func( @pytest.mark.parametrize( "func", [ - "call_spacc", "call_wsb", "call_popular", "call_bullbear", diff --git a/tests/openbb_terminal/stocks/behavioural_analysis/txt/test_ba_controller/test_print_help.txt b/tests/openbb_terminal/stocks/behavioural_analysis/txt/test_ba_controller/test_print_help.txt index b8c9ecfe68a..e2a9a232e0b 100644 --- a/tests/openbb_terminal/stocks/behavioural_analysis/txt/test_ba_controller/test_print_help.txt +++ b/tests/openbb_terminal/stocks/behavioural_analysis/txt/test_ba_controller/test_print_help.txt @@ -6,7 +6,6 @@ Ticker: TSLA snews stock price displayed over sentiment of news headlines [Finnhub] wsb show what WSB gang is up to in subreddit wallstreetbets [Reddit] popular show popular tickers [Reddit] - spacc show other users spacs announcements from subreddit SPACs [Reddit] getdd gets due diligence from another user's post [Reddit] redditsent searches reddit for ticker and finds reddit sentiment [Reddit] trending trending stocks [Stocktwits]