diff --git a/gamestonk_terminal/behavioural_analysis/README.md b/gamestonk_terminal/behavioural_analysis/README.md index 4a926a0c1e7..18a7cda7b10 100644 --- a/gamestonk_terminal/behavioural_analysis/README.md +++ b/gamestonk_terminal/behavioural_analysis/README.md @@ -84,7 +84,6 @@ usage: popular [-l N_LIMIT] [-s S_SUBREDDIT] [-d N_DAYS] Print latest popular tickers. [Source: Reddit] * -l : limit of posts retrieved per sub reddit. Default 50. * -s : subreddits to look for tickers, e.g. pennystocks,stocks. Default: pennystocks, RobinHoodPennyStocks, Daytrading, StockMarket, stocks, investing, wallstreetbets. - * -d : look for the tickers from those n past days. Default 1. popular @@ -106,7 +105,6 @@ usage: spac [-h] [-l N_LIMIT] [-d N_DAYS] ``` Print other users SPACs announcement under subreddit 'SPACs'. [Source: Reddit] * -l : limit of posts with SPACs retrieved. Default 5. - * -d : look for the tickers from those n past days.. Default 5. spac diff --git a/gamestonk_terminal/behavioural_analysis/reddit_view.py b/gamestonk_terminal/behavioural_analysis/reddit_view.py index ae51bde4e86..f77655181f8 100644 --- a/gamestonk_terminal/behavioural_analysis/reddit_view.py +++ b/gamestonk_terminal/behavioural_analysis/reddit_view.py @@ -1,6 +1,5 @@ import argparse import warnings -from datetime import datetime, timedelta import pandas as pd from prawcore.exceptions import ResponseException from requests import HTTPError @@ -10,7 +9,6 @@ import finviz from gamestonk_terminal.helper_funcs import check_positive, parse_known_args_and_warn from gamestonk_terminal import config_terminal as cfg from gamestonk_terminal.reddit_helpers import ( - get_last_time_market_was_open, print_and_record_reddit_post, find_tickers, ) @@ -60,13 +58,13 @@ def watchlist(l_args): password=cfg.API_REDDIT_PASSWORD, ) - dt_last_time_market_close = get_last_time_market_was_open( - datetime.now() - timedelta(hours=24) - ) - n_ts_after = int(dt_last_time_market_close.timestamp()) + # dt_last_time_market_close = get_last_time_market_was_open( + # datetime.now() - timedelta(hours=24) + # ) + # n_ts_after = int(dt_last_time_market_close.timestamp()) psaw_api = PushshiftAPI() submissions = psaw_api.search_submissions( - after=n_ts_after, + # after=n_ts_after, subreddit=l_sub_reddits, q="WATCHLIST|Watchlist|watchlist", filter=["id"], @@ -140,9 +138,9 @@ def watchlist(l_args): if int(t_ticker[1]) > 1: s_watchlist_tickers += f"{t_ticker[1]} {t_ticker[0]}, " n_tickers += 1 - except Exception as e: - print(e, "\n") - # pass + except Exception: + # print(e, "\n") + pass if n_tickers: print( "The following stock tickers have been mentioned more than once across the previous watchlists:" @@ -191,6 +189,7 @@ def popular_tickers(l_args): wallstreetbets """, ) + """ parser.add_argument( "-d", "--days", @@ -200,15 +199,16 @@ def popular_tickers(l_args): default=1, help="look for the tickers from those n past days.", ) + """ try: ns_parser = parse_known_args_and_warn(parser, l_args) if not ns_parser: return - n_ts_after = int( - (datetime.today() - timedelta(days=ns_parser.n_days)).timestamp() - ) + # n_ts_after = int( + # (datetime.today() - timedelta(days=ns_parser.n_days)).timestamp() + # ) if ns_parser.s_subreddit: if "," in ns_parser.s_subreddit: @@ -246,7 +246,7 @@ def popular_tickers(l_args): f"Search for latest tickers under {ns_parser.n_limit} '{s_sub_reddit}' posts" ) submissions = psaw_api.search_submissions( - after=int(n_ts_after), + # after=int(n_ts_after), subreddit=s_sub_reddit, limit=ns_parser.n_limit, filter=["id"], @@ -345,9 +345,7 @@ def popular_tickers(l_args): ], ) - print( - f"\nThe following TOP {ns_parser.n_top} tickers have been mentioned in the last {ns_parser.n_days} days:" - ) + print(f"\nThe following TOP {ns_parser.n_top} tickers have been mentioned:") print(popular_tickers_df, "\n") else: @@ -471,8 +469,10 @@ def spac_community(l_args): if int(t_ticker[1]) > 1: s_watchlist_tickers += f"{t_ticker[1]} {t_ticker[0]}, " n_tickers += 1 - except Exception as e: - print(e, "\n") + except Exception: + # print(e, "\n") + pass + if n_tickers: print( "The following stock tickers have been mentioned more than once across the previous SPACs:" @@ -499,6 +499,7 @@ def spac(l_args): default=5, help="limit of posts with SPACs retrieved.", ) + """ parser.add_argument( "-d", "--days", @@ -508,6 +509,7 @@ def spac(l_args): default=5, help="look for the tickers from those n past days.", ) + """ try: ns_parser = parse_known_args_and_warn(parser, l_args) @@ -527,9 +529,9 @@ def spac(l_args): l_watchlist_links = list() l_watchlist_author = list() - n_ts_after = int( - (datetime.today() - timedelta(days=ns_parser.n_days)).timestamp() - ) + # n_ts_after = int( + # (datetime.today() - timedelta(days=ns_parser.n_days)).timestamp() + # ) l_sub_reddits = [ "pennystocks", "RobinHoodPennyStocks", @@ -543,7 +545,7 @@ def spac(l_args): warnings.filterwarnings("ignore") # To avoid printing the warning psaw_api = PushshiftAPI() submissions = psaw_api.search_submissions( - after=n_ts_after, + # after=n_ts_after, subreddit=l_sub_reddits, q="SPAC|Spac|spac|Spacs|spacs", filter=["id"], @@ -616,9 +618,9 @@ def spac(l_args): if int(t_ticker[1]) > 1: s_watchlist_tickers += f"{t_ticker[1]} {t_ticker[0]}, " n_tickers += 1 - except Exception as e: - print(e, "\n") - # pass + except Exception: + # print(e, "\n") + pass if n_tickers: print( "The following stock tickers have been mentioned more than once across the previous SPACs:"