From 005e3edbf5d284a873228ab0ae102ee38cf4c726 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Fri, 11 Aug 2023 11:26:35 -0400 Subject: [PATCH 1/9] remove twitter functions --- .../behavioural_analysis/twitter_model.py | 212 ------------------ .../behavioural_analysis/twitter_view.py | 197 ---------------- .../behavioural_analysis/ba_controller.py | 106 --------- .../test_twitter_model.py | 0 .../behavioural_analysis/test_twitter_view.py | 0 .../test_ba_controller.py | 25 --- .../test_ba_controller/test_print_help.txt | 2 - 7 files changed, 542 deletions(-) delete mode 100644 openbb_terminal/common/behavioural_analysis/twitter_model.py delete mode 100644 openbb_terminal/common/behavioural_analysis/twitter_view.py delete mode 100644 tests/openbb_terminal/common/behavioural_analysis/test_twitter_model.py delete mode 100644 tests/openbb_terminal/common/behavioural_analysis/test_twitter_view.py diff --git a/openbb_terminal/common/behavioural_analysis/twitter_model.py b/openbb_terminal/common/behavioural_analysis/twitter_model.py deleted file mode 100644 index 034cc8341131..000000000000 --- a/openbb_terminal/common/behavioural_analysis/twitter_model.py +++ /dev/null @@ -1,212 +0,0 @@ -"""Twitter Model""" -__docformat__ = "numpy" - -import logging -from datetime import datetime, timedelta -from typing import Optional - -import pandas as pd -from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer - -from openbb_terminal.core.session.current_user import get_current_user -from openbb_terminal.decorators import check_api_key, log_start_end -from openbb_terminal.helper_funcs import clean_tweet, get_data, request -from openbb_terminal.rich_config import console - -logger = logging.getLogger(__name__) - -analyzer = SentimentIntensityAnalyzer() - - -@log_start_end(log=logger) -@check_api_key(["API_TWITTER_BEARER_TOKEN"]) -def load_analyze_tweets( - symbol: str, - limit: int = 100, - start_date: Optional[str] = "", - end_date: Optional[str] = "", -) -> pd.DataFrame: - """Load tweets from twitter API and analyzes using VADER. - - Parameters - ---------- - symbol: str - Ticker symbol to search twitter for - limit: int - Number of tweets to analyze - start_date: Optional[str] - If given, the start time to get tweets from - end_date: Optional[str] - If given, the end time to get tweets from - - Returns - ------- - df_tweet: pd.DataFrame - Dataframe of tweets and sentiment - """ - params = { - "query": rf"(\${symbol}) (lang:en)", - "max_results": str(limit), - "tweet.fields": "created_at,lang", - } - - if start_date: - # Assign from and to datetime parameters for the API - params["start_time"] = start_date - if end_date: - params["end_time"] = end_date - - # Request Twitter API - response = request( - "https://api.twitter.com/2/tweets/search/recent", - params=params, # type: ignore - headers={ - "authorization": "Bearer " - + get_current_user().credentials.API_TWITTER_BEARER_TOKEN - }, - ) - - # Create dataframe - df_tweets = pd.DataFrame() - - # Check that the API response was successful - if response.status_code == 200: - tweets = [] - for tweet in response.json()["data"]: - row = get_data(tweet) - tweets.append(row) - df_tweets = pd.DataFrame(tweets) - elif response.status_code == 401: - console.print("Twitter API Key provided is incorrect\n") - return pd.DataFrame() - elif response.status_code == 400: - console.print( - """ - Status Code 400. - This means you are requesting data from beyond the API's 7 day limit""" - ) - return pd.DataFrame() - elif response.status_code == 403: - console.print( - f""" - Status code 403. - It seems you're twitter credentials are invalid - {response.text} - """ - ) - return pd.DataFrame() - else: - console.print( - f""" - Status code {response.status_code}. - Something went wrong - {response.text} - """ - ) - return pd.DataFrame() - - sentiments = [] - pos = [] - neg = [] - neu = [] - - for s_tweet in df_tweets["text"].to_list(): - tweet = clean_tweet(s_tweet, symbol) - sentiments.append(analyzer.polarity_scores(tweet)["compound"]) - pos.append(analyzer.polarity_scores(tweet)["pos"]) - neg.append(analyzer.polarity_scores(tweet)["neg"]) - neu.append(analyzer.polarity_scores(tweet)["neu"]) - # Add sentiments to tweets dataframe - df_tweets["sentiment"] = sentiments - df_tweets["positive"] = pos - df_tweets["negative"] = neg - df_tweets["neutral"] = neu - - return df_tweets - - -@log_start_end(log=logger) -def get_sentiment( - symbol: str, - n_tweets: int = 15, - n_days_past: int = 2, -) -> pd.DataFrame: - """Get sentiments from symbol. - - Parameters - ---------- - symbol: str - Stock ticker symbol to get sentiment for - n_tweets: int - Number of tweets to get per hour - n_days_past: int - Number of days to extract tweets for - - Returns - ------- - df_sentiment: pd.DataFrame - Dataframe of sentiment - """ - # Date format string required by twitter - dt_format = "%Y-%m-%dT%H:%M:%SZ" - - # Algorithm to extract - dt_recent = datetime.utcnow() - timedelta(seconds=20) - dt_old = dt_recent - timedelta(days=n_days_past) - console.print( - f"From {dt_recent.date()} retrieving {n_tweets*24} tweets ({n_tweets} tweets/hour)" - ) - - df_tweets = pd.DataFrame( - columns=[ - "created_at", - "text", - "sentiment", - "positive", - "negative", - "neutral", - ] - ) - while True: - # Iterate until we haven't passed the old number of days - if dt_recent < dt_old: - break - # Update past datetime - dt_past = dt_recent - timedelta(minutes=60) - - temp = load_analyze_tweets( - symbol, - n_tweets, - start_date=dt_past.strftime(dt_format), - end_date=dt_recent.strftime(dt_format), - ) - - if (isinstance(temp, pd.DataFrame) and temp.empty) or ( - not isinstance(temp, pd.DataFrame) and not temp - ): - return pd.DataFrame() - - df_tweets = pd.concat([df_tweets, temp]) - - if dt_past.day < dt_recent.day: - console.print( - f"From {dt_past.date()} retrieving {n_tweets*24} tweets ({n_tweets} tweets/hour)" - ) - - # Update recent datetime - dt_recent = dt_past - - # Sort tweets per date - df_tweets.sort_index(ascending=False, inplace=True) - df_tweets["cumulative_compound"] = df_tweets["sentiment"].cumsum() - df_tweets["prob_sen"] = 1 - - # df_tweets.to_csv(r'notebooks/tweets.csv', index=False) - df_tweets.reset_index(inplace=True) - df_tweets["Month"] = pd.to_datetime(df_tweets["created_at"]).apply( - lambda x: x.month - ) - df_tweets["Day"] = pd.to_datetime(df_tweets["created_at"]).apply(lambda x: x.day) - df_tweets["date"] = pd.to_datetime(df_tweets["created_at"]) - df_tweets = df_tweets.sort_values(by="date") - df_tweets["cumulative_compound"] = df_tweets["sentiment"].cumsum() - - return df_tweets diff --git a/openbb_terminal/common/behavioural_analysis/twitter_view.py b/openbb_terminal/common/behavioural_analysis/twitter_view.py deleted file mode 100644 index fba727706288..000000000000 --- a/openbb_terminal/common/behavioural_analysis/twitter_view.py +++ /dev/null @@ -1,197 +0,0 @@ -"""Twitter view.""" -__docformat__ = "numpy" - -import logging -import os -from typing import Optional, Union - -import numpy as np -import pandas as pd -from dateutil import parser as dparse - -from openbb_terminal import OpenBBFigure, theme -from openbb_terminal.common.behavioural_analysis import twitter_model -from openbb_terminal.decorators import log_start_end -from openbb_terminal.helper_funcs import export_data, get_closing_price -from openbb_terminal.rich_config import console - -logger = logging.getLogger(__name__) - - -@log_start_end(log=logger) -def display_inference( - symbol: str, limit: int = 100, export: str = "", sheet_name: Optional[str] = None -): - """Prints Inference sentiment from past n tweets. - - Parameters - ---------- - symbol: str - Stock ticker symbol - limit: int - Number of tweets to analyze - sheet_name: str - Optionally specify the name of the sheet the data is exported to. - export: str - Format to export tweet dataframe - """ - df_tweets = twitter_model.load_analyze_tweets(symbol, limit) - - if (isinstance(df_tweets, pd.DataFrame) and df_tweets.empty) or ( - not isinstance(df_tweets, pd.DataFrame) and not df_tweets - ): - return - - # Parse tweets - dt_from = dparse.parse(df_tweets["created_at"].values[-1]) - dt_to = dparse.parse(df_tweets["created_at"].values[0]) - console.print(f"From: {dt_from.strftime('%Y-%m-%d %H:%M:%S')}") - console.print(f"To: {dt_to.strftime('%Y-%m-%d %H:%M:%S')}") - - console.print(f"{len(df_tweets)} tweets were analyzed.") - dt_delta = dt_to - dt_from - n_freq = dt_delta.total_seconds() / len(df_tweets) - console.print(f"Frequency of approx 1 tweet every {round(n_freq)} seconds.") - - pos = df_tweets["positive"] - neg = df_tweets["negative"] - - percent_pos = len(np.where(pos > neg)[0]) / len(df_tweets) - percent_neg = len(np.where(pos < neg)[0]) / len(df_tweets) - total_sent = np.round(np.sum(df_tweets["sentiment"]), 2) - mean_sent = np.round(np.mean(df_tweets["sentiment"]), 2) - console.print(f"The summed compound sentiment of {symbol} is: {total_sent}") - console.print(f"The average compound sentiment of {symbol} is: {mean_sent}") - console.print( - f"Of the last {len(df_tweets)} tweets, {100*percent_pos:.2f} % had a higher positive sentiment" - ) - console.print( - f"Of the last {len(df_tweets)} tweets, {100*percent_neg:.2f} % had a higher negative sentiment" - ) - - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "infer", - df_tweets, - sheet_name, - ) - - -@log_start_end(log=logger) -def display_sentiment( - symbol: str, - n_tweets: int = 15, - n_days_past: int = 2, - compare: bool = False, - export: str = "", - sheet_name: Optional[str] = None, - external_axes: bool = False, -) -> Union[OpenBBFigure, None]: - """Plots sentiments from symbol - - Parameters - ---------- - symbol: str - Stock ticker symbol to get sentiment for - n_tweets: int - Number of tweets to get per hour - n_days_past: int - Number of days to extract tweets for - compare: bool - Show corresponding change in stock price - sheet_name: str - Optionally specify the name of the sheet the data is exported to. - export: str - Format to export tweet dataframe - external_axes: bool, optional - Whether to return the figure object or not, by default False - """ - - df_tweets = twitter_model.get_sentiment(symbol, n_tweets, n_days_past) - - if df_tweets.empty: - return None - - if compare: - plots_kwargs = dict( - rows=3, - cols=1, - shared_xaxes=True, - vertical_spacing=0.05, - row_heights=[0.2, 0.6, 0.2], - ) - else: - plots_kwargs = dict( - rows=2, - cols=1, - shared_xaxes=True, - vertical_spacing=0.05, - row_heights=[0.6, 0.4], - ) - - fig = OpenBBFigure.create_subplots(**plots_kwargs) # type: ignore - - fig.add_scatter( - x=pd.to_datetime(df_tweets["created_at"]), - y=df_tweets["cumulative_compound"].values, - row=1, - col=1, - ) - - fig.set_yaxis_title("
Cumulative
VADER Sentiment", row=1, col=1) - - for _, day_df in df_tweets.groupby(by="Day"): - day_df["time"] = pd.to_datetime(day_df["created_at"]) - day_df = day_df.sort_values(by="time") - fig.add_scatter( - x=day_df["time"], - y=day_df["sentiment"].cumsum(), - row=1, - col=1, - ) - fig.add_bar( - x=df_tweets["date"], - y=df_tweets["positive"], - row=2, - col=1, - marker_color=theme.up_color, - ) - - fig.add_bar( - x=df_tweets["date"], - y=-1 * df_tweets["negative"], - row=2, - col=1, - marker_color=theme.down_color, - ) - fig.set_yaxis_title("VADER Polarity Scores", row=2, col=1) - - if compare: - # get stock end price for each corresponding day if compare == True - closing_price_df = get_closing_price(symbol, n_days_past) - fig.add_scatter( - x=closing_price_df["Date"], - y=closing_price_df["Close"], - name=pd.to_datetime(closing_price_df["Date"]).iloc[0].strftime("%Y-%m-%d"), - row=3, - col=1, - ) - fig.set_yaxis_title("Stock Price", row=3, col=1) - - fig.update_layout( - title=f"Twitter's {symbol} total compound sentiment over time is {round(np.sum(df_tweets['sentiment']), 2)}", - xaxis=dict(type="date"), - showlegend=False, - ) - - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "sentiment", - df_tweets, - sheet_name, - fig, - ) - - return fig.show(external=external_axes) diff --git a/openbb_terminal/stocks/behavioural_analysis/ba_controller.py b/openbb_terminal/stocks/behavioural_analysis/ba_controller.py index 30cf872117e4..f95e2e7c208a 100644 --- a/openbb_terminal/stocks/behavioural_analysis/ba_controller.py +++ b/openbb_terminal/stocks/behavioural_analysis/ba_controller.py @@ -13,7 +13,6 @@ google_view, reddit_view, stocktwits_view, - twitter_view, ) from openbb_terminal.core.session.current_user import get_current_user from openbb_terminal.custom_prompt_toolkit import NestedCompleter @@ -21,7 +20,6 @@ from openbb_terminal.helper_funcs import ( EXPORT_BOTH_RAW_DATA_AND_FIGURES, EXPORT_ONLY_RAW_DATA_ALLOWED, - check_int_range, check_non_negative, check_positive, valid_date, @@ -54,8 +52,6 @@ class BehaviouralAnalysisController(StockBaseController): "messages", "trending", "stalker", - "infer", - "sentiment", "mentions", "regions", "queries", @@ -104,8 +100,6 @@ def print_help(self): mt.add_cmd("stalker") mt.add_cmd("bullbear", self.ticker) mt.add_cmd("messages", self.ticker) - mt.add_cmd("infer", self.ticker) - mt.add_cmd("sentiment", self.ticker) mt.add_cmd("mentions", self.ticker) mt.add_cmd("regions", self.ticker) mt.add_cmd("interest", self.ticker) @@ -709,106 +703,6 @@ def call_rise(self, other_args: List[str]): else: console.print("No ticker loaded. Please load using 'load '\n") - @log_start_end(log=logger) - def call_infer(self, other_args: List[str]): - """Process infer command.""" - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="infer", - description=""" - Print quick sentiment inference from last tweets that contain the ticker. - This model splits the text into character-level tokens and uses vader sentiment analysis. - [Source: Twitter] - """, - ) - parser.add_argument( - "-l", - "--limit", - action="store", - dest="limit", - type=check_int_range(10, 100), - default=100, - help="limit of latest tweets to infer from.", - ) - 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, EXPORT_ONLY_RAW_DATA_ALLOWED - ) - if ns_parser: - if self.ticker: - twitter_view.display_inference( - symbol=self.ticker, - limit=ns_parser.limit, - export=ns_parser.export, - sheet_name=" ".join(ns_parser.sheet_name) - if ns_parser.sheet_name - else None, - ) - else: - console.print("No ticker loaded. Please load using 'load '\n") - - @log_start_end(log=logger) - def call_sentiment(self, other_args: List[str]): - """Process sentiment command.""" - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="sentiment", - description=""" - Plot in-depth sentiment predicted from tweets from last days - that contain pre-defined ticker. [Source: Twitter] - """, - ) - # in reality this argument could be 100, but after testing it takes too long - # to compute which may not be acceptable - # TODO: use https://github.com/twintproject/twint instead of twitter API - parser.add_argument( - "-l", - "--limit", - action="store", - dest="limit", - type=check_int_range(10, 62), - default=15, - help="limit of tweets to extract per hour.", - ) - parser.add_argument( - "-d", - "--days", - action="store", - dest="n_days_past", - type=check_int_range(1, 6), - default=6, - help="number of days in the past to extract tweets.", - ) - parser.add_argument( - "-c", - "--compare", - action="store_true", - dest="compare", - help="show corresponding change in stock price", - ) - 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, EXPORT_BOTH_RAW_DATA_AND_FIGURES - ) - if ns_parser: - if self.ticker: - twitter_view.display_sentiment( - symbol=self.ticker, - n_tweets=ns_parser.limit, - n_days_past=ns_parser.n_days_past, - compare=ns_parser.compare, - export=ns_parser.export, - sheet_name=" ".join(ns_parser.sheet_name) - if ns_parser.sheet_name - else None, - ) - else: - console.print("No ticker loaded. Please load using 'load '\n") - @log_start_end(log=logger) def call_headlines(self, other_args: List[str]): """Process finbrain command.""" diff --git a/tests/openbb_terminal/common/behavioural_analysis/test_twitter_model.py b/tests/openbb_terminal/common/behavioural_analysis/test_twitter_model.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/openbb_terminal/common/behavioural_analysis/test_twitter_view.py b/tests/openbb_terminal/common/behavioural_analysis/test_twitter_view.py deleted file mode 100644 index e69de29bb2d1..000000000000 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 b3e4d94c6356..fa25e83d5bf0 100644 --- a/tests/openbb_terminal/stocks/behavioural_analysis/test_ba_controller.py +++ b/tests/openbb_terminal/stocks/behavioural_analysis/test_ba_controller.py @@ -307,27 +307,6 @@ def test_call_func_expect_queue(expected_queue, queue, func): limit=5, ), ), - ( - "call_infer", - ["--limit=20", "--export=csv"], - "twitter_view.display_inference", - [], - dict(symbol="MOCK_TICKER", limit=20, export="csv", sheet_name=None), - ), - ( - "call_sentiment", - ["--limit=20", "--days=2", "--compare", "--export=csv"], - "twitter_view.display_sentiment", - [], - dict( - symbol="MOCK_TICKER", - n_tweets=20, - n_days_past=2, - compare=True, - export="csv", - sheet_name=None, - ), - ), ( "call_mentions", ["--start=2020-12-01", "--export=csv"], @@ -433,8 +412,6 @@ def test_call_func( "call_messages", "call_trending", "call_stalker", - "call_infer", - "call_sentiment", "call_mentions", "call_regions", "call_queries", @@ -467,8 +444,6 @@ def test_call_func_no_parser(func, mocker): "func", [ "call_headlines", - "call_sentiment", - "call_infer", "call_rise", "call_queries", "call_regions", 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 b8c9ecfe68ad..27086aa90edf 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 @@ -13,8 +13,6 @@ Ticker: TSLA stalker stalk stocktwits user's last messages [Stocktwits] bullbear estimate quick sentiment from last 30 messages on board [Stocktwits] messages output up to the 30 last messages on the board [Stocktwits] - infer infer about stock's sentiment from latest tweets [Twitter] - sentiment in-depth sentiment prediction from tweets over time [Twitter] mentions interest over time based on stock's mentions [Google] regions regions that show highest interest in stock [Google] interest interest over time of sentences versus stock price [Google] From 93bc21611861fdc2c1c91861abeb5de84202452b Mon Sep 17 00:00:00 2001 From: James Maslek Date: Fri, 11 Aug 2023 11:42:47 -0400 Subject: [PATCH 2/9] remove twitter functions and all references to it --- .../sdk/controllers/stocks_sdk_controller.py | 4 - .../core/sdk/models/keys_sdk_model.py | 2 - .../core/sdk/models/stocks_sdk_model.py | 8 -- openbb_terminal/core/sdk/sdk_init.py | 2 - openbb_terminal/core/sdk/trail_map.csv | 3 - openbb_terminal/keys_controller.py | 46 --------- openbb_terminal/keys_model.py | 94 ------------------- .../miscellaneous/models/all_api_keys.json | 18 ---- .../miscellaneous/models/hub_credentials.json | 3 - openbb_terminal/sdk.py | 1 - tests/openbb_terminal/test_keys_controller.py | 6 -- tests/openbb_terminal/test_keys_model.py | 28 ------ .../content/terminal/usage/guides/api-keys.md | 2 +- 13 files changed, 1 insertion(+), 216 deletions(-) diff --git a/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py b/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py index 7918c33d0179..38bb69524216 100644 --- a/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py +++ b/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py @@ -42,8 +42,6 @@ def ba(self): `getdd`: Get due diligence posts from list of subreddits [Source: reddit].\n `headlines`: Gets Sentiment analysis provided by FinBrain's API [Source: finbrain].\n `headlines_chart`: Plots Sentiment analysis from FinBrain. Prints table if raw is True. [Source: FinBrain]\n - `infer`: Load tweets from twitter API and analyzes using VADER.\n - `infer_chart`: Prints Inference sentiment from past n tweets.\n `mentions`: Get interest over time from google api [Source: google].\n `mentions_chart`: Plots weekly bars of stock's interest over time. other users watchlist. [Source: Google].\n `messages`: Get last messages for a given ticker [Source: stocktwits].\n @@ -55,8 +53,6 @@ def ba(self): `regions`: Get interest by region from google api [Source: google].\n `regions_chart`: Plots bars of regions based on stock's interest. [Source: Google].\n `rise`: Get top rising related queries with this stock's query [Source: google].\n - `sentiment`: Get sentiments from symbol.\n - `sentiment_chart`: Plots sentiments from symbol\n `snews`: Get headlines sentiment using VADER model over time. [Source: Finnhub]\n `snews_chart`: Display stock price and headlines sentiment using VADER model over time. [Source: Finnhub]\n `spacc`: Get top tickers from r/SPACs [Source: reddit].\n diff --git a/openbb_terminal/core/sdk/models/keys_sdk_model.py b/openbb_terminal/core/sdk/models/keys_sdk_model.py index 0572e6d3ded9..0ccee257bd40 100644 --- a/openbb_terminal/core/sdk/models/keys_sdk_model.py +++ b/openbb_terminal/core/sdk/models/keys_sdk_model.py @@ -42,7 +42,6 @@ class KeysRoot(Category): `stocksera`: Set Stocksera key.\n `tokenterminal`: Set Token Terminal key.\n `tradier`: Set Tradier key\n - `twitter`: Set Twitter key\n `ultima`: Set Ultima Insights key\n `walert`: Set Walert key\n """ @@ -84,6 +83,5 @@ def __init__(self): self.stocksera = lib.keys_model.set_stocksera_key self.tokenterminal = lib.keys_model.set_tokenterminal_key self.tradier = lib.keys_model.set_tradier_key - self.twitter = lib.keys_model.set_twitter_key self.ultima = lib.keys_model.set_ultima_key self.walert = lib.keys_model.set_walert_key diff --git a/openbb_terminal/core/sdk/models/stocks_sdk_model.py b/openbb_terminal/core/sdk/models/stocks_sdk_model.py index 0a2ba28f2f8b..78396c297d4d 100644 --- a/openbb_terminal/core/sdk/models/stocks_sdk_model.py +++ b/openbb_terminal/core/sdk/models/stocks_sdk_model.py @@ -42,8 +42,6 @@ class StocksBehavioralAnalysis(Category): `getdd`: Get due diligence posts from list of subreddits [Source: reddit].\n `headlines`: Gets Sentiment analysis provided by FinBrain's API [Source: finbrain].\n `headlines_chart`: Plots Sentiment analysis from FinBrain. Prints table if raw is True. [Source: FinBrain]\n - `infer`: Load tweets from twitter API and analyzes using VADER.\n - `infer_chart`: Prints Inference sentiment from past n tweets.\n `mentions`: Get interest over time from google api [Source: google].\n `mentions_chart`: Plots weekly bars of stock's interest over time. other users watchlist. [Source: Google].\n `messages`: Get last messages for a given ticker [Source: stocktwits].\n @@ -55,8 +53,6 @@ class StocksBehavioralAnalysis(Category): `regions`: Get interest by region from google api [Source: google].\n `regions_chart`: Plots bars of regions based on stock's interest. [Source: Google].\n `rise`: Get top rising related queries with this stock's query [Source: google].\n - `sentiment`: Get sentiments from symbol.\n - `sentiment_chart`: Plots sentiments from symbol\n `snews`: Get headlines sentiment using VADER model over time. [Source: Finnhub]\n `snews_chart`: Display stock price and headlines sentiment using VADER model over time. [Source: Finnhub]\n `spacc`: Get top tickers from r/SPACs [Source: reddit].\n @@ -75,8 +71,6 @@ def __init__(self): self.getdd = lib.stocks_ba_reddit_model.get_due_dilligence self.headlines = lib.stocks_ba_finbrain_model.get_sentiment self.headlines_chart = lib.stocks_ba_finbrain_view.display_sentiment_analysis - self.infer = lib.stocks_ba_twitter_model.load_analyze_tweets - self.infer_chart = lib.stocks_ba_twitter_view.display_inference self.mentions = lib.stocks_ba_google_model.get_mentions self.mentions_chart = lib.stocks_ba_google_view.display_mentions self.messages = lib.stocks_ba_stocktwits_model.get_messages @@ -88,8 +82,6 @@ def __init__(self): self.regions = lib.stocks_ba_google_model.get_regions self.regions_chart = lib.stocks_ba_google_view.display_regions self.rise = lib.stocks_ba_google_model.get_rise - self.sentiment = lib.stocks_ba_twitter_model.get_sentiment - self.sentiment_chart = lib.stocks_ba_twitter_view.display_sentiment self.snews = lib.stocks_ba_finnhub_model.get_headlines_sentiment self.snews_chart = ( lib.stocks_ba_finnhub_view.display_stock_price_headlines_sentiment diff --git a/openbb_terminal/core/sdk/sdk_init.py b/openbb_terminal/core/sdk/sdk_init.py index 571269da4159..0068ea5bd19b 100644 --- a/openbb_terminal/core/sdk/sdk_init.py +++ b/openbb_terminal/core/sdk/sdk_init.py @@ -121,8 +121,6 @@ reddit_view as stocks_ba_reddit_view, stocktwits_model as stocks_ba_stocktwits_model, stocktwits_view as stocks_ba_stocktwits_view, - twitter_model as stocks_ba_twitter_model, - twitter_view as stocks_ba_twitter_view, ) diff --git a/openbb_terminal/core/sdk/trail_map.csv b/openbb_terminal/core/sdk/trail_map.csv index 636821954246..dbd7a918f02d 100644 --- a/openbb_terminal/core/sdk/trail_map.csv +++ b/openbb_terminal/core/sdk/trail_map.csv @@ -317,7 +317,6 @@ keys.smartstake,keys_model.set_smartstake_key, keys.stocksera,keys_model.set_stocksera_key, keys.tokenterminal,keys_model.set_tokenterminal_key, keys.tradier,keys_model.set_tradier_key, -keys.twitter,keys_model.set_twitter_key, keys.ultima,keys_model.set_ultima_key, keys.walert,keys_model.set_walert_key, login,sdk_session.login, @@ -389,7 +388,6 @@ stocks.ba.bullbear,stocks_ba_stocktwits_model.get_bullbear, stocks.ba.cnews,stocks_ba_finnhub_model.get_company_news, stocks.ba.getdd,stocks_ba_reddit_model.get_due_dilligence, stocks.ba.headlines,stocks_ba_finbrain_model.get_sentiment,stocks_ba_finbrain_view.display_sentiment_analysis -stocks.ba.infer,stocks_ba_twitter_model.load_analyze_tweets,stocks_ba_twitter_view.display_inference stocks.ba.mentions,stocks_ba_google_model.get_mentions,stocks_ba_google_view.display_mentions stocks.ba.messages,stocks_ba_stocktwits_model.get_messages, stocks.ba.ns,stocks_ba_news_sentiment_model.get_data,stocks_ba_news_sentiment_view.display_articles_data @@ -398,7 +396,6 @@ stocks.ba.queries,stocks_ba_google_model.get_queries, stocks.ba.redditsent,stocks_ba_reddit_model.get_posts_about, stocks.ba.regions,stocks_ba_google_model.get_regions,stocks_ba_google_view.display_regions stocks.ba.rise,stocks_ba_google_model.get_rise, -stocks.ba.sentiment,stocks_ba_twitter_model.get_sentiment,stocks_ba_twitter_view.display_sentiment stocks.ba.snews,stocks_ba_finnhub_model.get_headlines_sentiment,stocks_ba_finnhub_view.display_stock_price_headlines_sentiment stocks.ba.spacc,stocks_ba_reddit_model.get_spac_community, stocks.ba.stalker,stocks_ba_stocktwits_model.get_stalker, diff --git a/openbb_terminal/keys_controller.py b/openbb_terminal/keys_controller.py index 3a522f68b64d..9afa96587c2e 100644 --- a/openbb_terminal/keys_controller.py +++ b/openbb_terminal/keys_controller.py @@ -573,52 +573,6 @@ def call_reddit(self, other_args: List[str]): show_output=True, ) - @log_start_end(log=logger) - def call_twitter(self, other_args: List[str]): - """Process twitter command""" - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="twitter", - description="Set Twitter API key.", - ) - parser.add_argument( - "-k", - "--key", - type=str, - dest="key", - help="Key", - required="-h" not in other_args and "--help" not in other_args, - ) - parser.add_argument( - "-s", - "--secret", - type=str, - dest="secret", - help="Secret key", - required="-h" not in other_args and "--help" not in other_args, - ) - parser.add_argument( - "-t", - "--token", - type=str, - dest="token", - help="Bearer token", - required="-h" not in other_args and "--help" not in other_args, - ) - if not other_args: - console.print("For your API Key, visit: https://developer.twitter.com") - return - ns_parser = self.parse_simple_args(parser, other_args) - if ns_parser: - self.status_dict["twitter"] = keys_model.set_twitter_key( - key=ns_parser.key, - secret=ns_parser.secret, - access_token=ns_parser.token, - persist=True, - show_output=True, - ) - @log_start_end(log=logger) def call_rh(self, other_args: List[str]): """Process rh command""" diff --git a/openbb_terminal/keys_model.py b/openbb_terminal/keys_model.py index 12d6347f6048..ba8937714d24 100644 --- a/openbb_terminal/keys_model.py +++ b/openbb_terminal/keys_model.py @@ -1160,100 +1160,6 @@ def check_bitquery_key(show_output: bool = False) -> str: return str(status) -def set_twitter_key( - key: str, - secret: str, - access_token: str, - persist: bool = False, - show_output: bool = False, -) -> str: - """Set Twitter key - - Parameters - ---------- - key: str - API key - secret: str - API secret - access_token: str - API token - persist: bool, optional - If False, api key change will be contained to where it was changed. For example, a Jupyter notebook session. - If True, api key change will be global, i.e. it will affect terminal environment variables. - By default, False. - show_output: bool, optional - Display status string or not. By default, False. - - Returns - ------- - str - Status of key set - - Examples - -------- - >>> from openbb_terminal.sdk import openbb - >>> openbb.keys.twitter( - key="example_key", - secret="example_secret", - access_token="example_access_token" - ) - """ - handle_credential("API_TWITTER_KEY", key, persist) - handle_credential("API_TWITTER_SECRET_KEY", secret, persist) - handle_credential("API_TWITTER_BEARER_TOKEN", access_token, persist) - - return check_twitter_key(show_output) - - -def check_twitter_key(show_output: bool = False) -> str: - """Check Twitter key - - Parameters - ---------- - show_output: bool, optional - Display status string or not. By default, False. - - Returns - ------- - str - Status of key set - """ - - if show_output: - console.print("Checking status...") - - current_user = get_current_user() - if current_user.credentials.API_TWITTER_BEARER_TOKEN == "REPLACE_ME": - status = KeyStatus.NOT_DEFINED - else: - params = { - "query": "(\\$AAPL) (lang:en)", - "max_results": "10", - "tweet.fields": "created_at,lang", - } - r = request( - "https://api.twitter.com/2/tweets/search/recent", - params=params, # type: ignore - headers={ - "authorization": "Bearer " - + current_user.credentials.API_TWITTER_BEARER_TOKEN - }, - ) - if r.status_code == 200: - status = KeyStatus.DEFINED_TEST_PASSED - elif r.status_code in [401, 403]: - logger.warning("Twitter key defined, test failed") - status = KeyStatus.DEFINED_TEST_FAILED - else: - logger.warning("Twitter key defined, test failed") - status = KeyStatus.DEFINED_TEST_INCONCLUSIVE - - if show_output: - console.print(status.colorize()) - - return str(status) - - def set_rh_key( username: str, password: str, diff --git a/openbb_terminal/miscellaneous/models/all_api_keys.json b/openbb_terminal/miscellaneous/models/all_api_keys.json index d9abe8d6dc97..cac66c9c54ea 100644 --- a/openbb_terminal/miscellaneous/models/all_api_keys.json +++ b/openbb_terminal/miscellaneous/models/all_api_keys.json @@ -65,24 +65,6 @@ "link": "https://polygon.io", "markdown": "Go to: https://polygon.io\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207825623-fcd7f0a3-131a-4294-808c-754c13e38e2a.png)\n\nClick on, \"Get your Free API Key\".\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207825952-ca5540ec-6ed2-4cef-a0ed-bb50b813932c.png)\n\nAfter signing up, the API Key is found at the bottom of the account dashboard page.\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207826258-b1f318fa-fd9c-41d9-bf5c-fe16722e6601.png)" }, - { - "name": "API_TWITTER_KEY", - "source": "Twitter key", - "link": "https://developer.twitter.com", - "markdown": "![Twitter API](https://pbs.twimg.com/media/FooIJF3agAIU8SN?format=png&name=medium)" - }, - { - "name": "API_TWITTER_SECRET_KEY", - "source": "Twitter secret", - "link": "https://developer.twitter.com", - "markdown": "![Twitter API](https://pbs.twimg.com/media/FooIJF3agAIU8SN?format=png&name=medium)" - }, - { - "name": "API_TWITTER_BEARER_TOKEN", - "source": "Twitter token", - "link": "https://developer.twitter.com", - "markdown": "![Twitter API](https://pbs.twimg.com/media/FooIJF3agAIU8SN?format=png&name=medium)" - }, { "name": "API_FRED_KEY", "source": "FRED", diff --git a/openbb_terminal/miscellaneous/models/hub_credentials.json b/openbb_terminal/miscellaneous/models/hub_credentials.json index c0275c172bbb..2370ee7b71d3 100644 --- a/openbb_terminal/miscellaneous/models/hub_credentials.json +++ b/openbb_terminal/miscellaneous/models/hub_credentials.json @@ -32,8 +32,5 @@ "API_REDDIT_USERNAME": "", "API_REDDIT_USER_AGENT": "", "API_REDDIT_PASSWORD": "", - "API_TWITTER_KEY": "", - "API_TWITTER_SECRET_KEY": "", - "API_TWITTER_BEARER_TOKEN": "", "API_DAPPRADAR_KEY": "" } diff --git a/openbb_terminal/sdk.py b/openbb_terminal/sdk.py index 73165a284649..1990c434c1ef 100644 --- a/openbb_terminal/sdk.py +++ b/openbb_terminal/sdk.py @@ -438,7 +438,6 @@ def keys(self): `stocksera`: Set Stocksera key.\n `tokenterminal`: Set Token Terminal key.\n `tradier`: Set Tradier key\n - `twitter`: Set Twitter key\n `ultima`: Set Ultima Insights key\n `walert`: Set Walert key\n """ diff --git a/tests/openbb_terminal/test_keys_controller.py b/tests/openbb_terminal/test_keys_controller.py index 10c2de4d5cf4..8af59ae4f4dd 100644 --- a/tests/openbb_terminal/test_keys_controller.py +++ b/tests/openbb_terminal/test_keys_controller.py @@ -148,12 +148,6 @@ def test_call_reddit(other): controller.call_reddit(other) -@pytest.mark.vcr -@pytest.mark.parametrize("other", [[], ["-k", "1234", "-s", "4567", "-t", "890"]]) -def test_call_twitter(other): - controller.call_twitter(other) - - @pytest.mark.vcr @pytest.mark.parametrize("other", [[], ["-u", "1234", "-p", "4567"]]) def test_call_rh(other): diff --git a/tests/openbb_terminal/test_keys_model.py b/tests/openbb_terminal/test_keys_model.py index 7d230a13c200..f5b2883e3dd3 100644 --- a/tests/openbb_terminal/test_keys_model.py +++ b/tests/openbb_terminal/test_keys_model.py @@ -367,34 +367,6 @@ def test_set_bitquery_key(args: List[str], persist: bool, show_output: bool, moc mock_check.assert_called_once_with(show_output) -@pytest.mark.vcr -@pytest.mark.parametrize( - "args, persist, show_output", - [ - ( - ["test_key", "test_secret", "test_access_token"], - False, - True, - ), - ( - ["test_key", "test_secret", "test_access_token"], - False, - False, - ), - ], -) -def test_set_twitter_key(args: List[str], persist: bool, show_output: bool, mocker): - mock_check = mocker.patch("openbb_terminal.keys_model.check_twitter_key") - keys_model.set_twitter_key( - key=args[0], - secret=args[1], - access_token=args[2], - persist=persist, - show_output=show_output, - ) - mock_check.assert_called_once_with(show_output) - - @pytest.mark.vcr @pytest.mark.parametrize( "args, persist, show_output", diff --git a/website/content/terminal/usage/guides/api-keys.md b/website/content/terminal/usage/guides/api-keys.md index d15f8792fd51..30f712e3cb88 100644 --- a/website/content/terminal/usage/guides/api-keys.md +++ b/website/content/terminal/usage/guides/api-keys.md @@ -2,7 +2,7 @@ title: Setting API Keys sidebar_position: 1 description: API (Application Programming Interface) keys are access credentials for accessing data from a particular source. Learn how to set, manage, and access data APIs for the OpenBB Terminal. -keywords: [api, keys, api keys, openbb terminal, data provider, data, free, alpha vantage, fred, iex, twitter, degiro, binance, coinglass, polygon, intrinio, sdk, alphavantage, bitquery, coinbase, databento, finnhub, FRED, github, glassnode, iex cloud, news API, robinhood, santiment, shroomdk, token terminal, tradier, twitter, whale alert] +keywords: [api, keys, api keys, openbb terminal, data provider, data, free, alpha vantage, fred, iex, degiro, binance, coinglass, polygon, intrinio, sdk, alphavantage, bitquery, coinbase, databento, finnhub, FRED, github, glassnode, iex cloud, news API, robinhood, santiment, shroomdk, token terminal, tradier, whale alert] --- import HeadTitle from '@site/src/components/General/HeadTitle.tsx'; From 6502a358dbb29f66bb6ec5a26d87085674da0101 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Fri, 11 Aug 2023 11:26:35 -0400 Subject: [PATCH 3/9] remove twitter functions --- .../behavioural_analysis/twitter_model.py | 212 ------------------ .../behavioural_analysis/twitter_view.py | 197 ---------------- .../behavioural_analysis/ba_controller.py | 106 --------- .../test_twitter_model.py | 0 .../behavioural_analysis/test_twitter_view.py | 0 .../test_ba_controller.py | 25 --- .../test_ba_controller/test_print_help.txt | 2 - 7 files changed, 542 deletions(-) delete mode 100644 openbb_terminal/common/behavioural_analysis/twitter_model.py delete mode 100644 openbb_terminal/common/behavioural_analysis/twitter_view.py delete mode 100644 tests/openbb_terminal/common/behavioural_analysis/test_twitter_model.py delete mode 100644 tests/openbb_terminal/common/behavioural_analysis/test_twitter_view.py diff --git a/openbb_terminal/common/behavioural_analysis/twitter_model.py b/openbb_terminal/common/behavioural_analysis/twitter_model.py deleted file mode 100644 index 034cc8341131..000000000000 --- a/openbb_terminal/common/behavioural_analysis/twitter_model.py +++ /dev/null @@ -1,212 +0,0 @@ -"""Twitter Model""" -__docformat__ = "numpy" - -import logging -from datetime import datetime, timedelta -from typing import Optional - -import pandas as pd -from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer - -from openbb_terminal.core.session.current_user import get_current_user -from openbb_terminal.decorators import check_api_key, log_start_end -from openbb_terminal.helper_funcs import clean_tweet, get_data, request -from openbb_terminal.rich_config import console - -logger = logging.getLogger(__name__) - -analyzer = SentimentIntensityAnalyzer() - - -@log_start_end(log=logger) -@check_api_key(["API_TWITTER_BEARER_TOKEN"]) -def load_analyze_tweets( - symbol: str, - limit: int = 100, - start_date: Optional[str] = "", - end_date: Optional[str] = "", -) -> pd.DataFrame: - """Load tweets from twitter API and analyzes using VADER. - - Parameters - ---------- - symbol: str - Ticker symbol to search twitter for - limit: int - Number of tweets to analyze - start_date: Optional[str] - If given, the start time to get tweets from - end_date: Optional[str] - If given, the end time to get tweets from - - Returns - ------- - df_tweet: pd.DataFrame - Dataframe of tweets and sentiment - """ - params = { - "query": rf"(\${symbol}) (lang:en)", - "max_results": str(limit), - "tweet.fields": "created_at,lang", - } - - if start_date: - # Assign from and to datetime parameters for the API - params["start_time"] = start_date - if end_date: - params["end_time"] = end_date - - # Request Twitter API - response = request( - "https://api.twitter.com/2/tweets/search/recent", - params=params, # type: ignore - headers={ - "authorization": "Bearer " - + get_current_user().credentials.API_TWITTER_BEARER_TOKEN - }, - ) - - # Create dataframe - df_tweets = pd.DataFrame() - - # Check that the API response was successful - if response.status_code == 200: - tweets = [] - for tweet in response.json()["data"]: - row = get_data(tweet) - tweets.append(row) - df_tweets = pd.DataFrame(tweets) - elif response.status_code == 401: - console.print("Twitter API Key provided is incorrect\n") - return pd.DataFrame() - elif response.status_code == 400: - console.print( - """ - Status Code 400. - This means you are requesting data from beyond the API's 7 day limit""" - ) - return pd.DataFrame() - elif response.status_code == 403: - console.print( - f""" - Status code 403. - It seems you're twitter credentials are invalid - {response.text} - """ - ) - return pd.DataFrame() - else: - console.print( - f""" - Status code {response.status_code}. - Something went wrong - {response.text} - """ - ) - return pd.DataFrame() - - sentiments = [] - pos = [] - neg = [] - neu = [] - - for s_tweet in df_tweets["text"].to_list(): - tweet = clean_tweet(s_tweet, symbol) - sentiments.append(analyzer.polarity_scores(tweet)["compound"]) - pos.append(analyzer.polarity_scores(tweet)["pos"]) - neg.append(analyzer.polarity_scores(tweet)["neg"]) - neu.append(analyzer.polarity_scores(tweet)["neu"]) - # Add sentiments to tweets dataframe - df_tweets["sentiment"] = sentiments - df_tweets["positive"] = pos - df_tweets["negative"] = neg - df_tweets["neutral"] = neu - - return df_tweets - - -@log_start_end(log=logger) -def get_sentiment( - symbol: str, - n_tweets: int = 15, - n_days_past: int = 2, -) -> pd.DataFrame: - """Get sentiments from symbol. - - Parameters - ---------- - symbol: str - Stock ticker symbol to get sentiment for - n_tweets: int - Number of tweets to get per hour - n_days_past: int - Number of days to extract tweets for - - Returns - ------- - df_sentiment: pd.DataFrame - Dataframe of sentiment - """ - # Date format string required by twitter - dt_format = "%Y-%m-%dT%H:%M:%SZ" - - # Algorithm to extract - dt_recent = datetime.utcnow() - timedelta(seconds=20) - dt_old = dt_recent - timedelta(days=n_days_past) - console.print( - f"From {dt_recent.date()} retrieving {n_tweets*24} tweets ({n_tweets} tweets/hour)" - ) - - df_tweets = pd.DataFrame( - columns=[ - "created_at", - "text", - "sentiment", - "positive", - "negative", - "neutral", - ] - ) - while True: - # Iterate until we haven't passed the old number of days - if dt_recent < dt_old: - break - # Update past datetime - dt_past = dt_recent - timedelta(minutes=60) - - temp = load_analyze_tweets( - symbol, - n_tweets, - start_date=dt_past.strftime(dt_format), - end_date=dt_recent.strftime(dt_format), - ) - - if (isinstance(temp, pd.DataFrame) and temp.empty) or ( - not isinstance(temp, pd.DataFrame) and not temp - ): - return pd.DataFrame() - - df_tweets = pd.concat([df_tweets, temp]) - - if dt_past.day < dt_recent.day: - console.print( - f"From {dt_past.date()} retrieving {n_tweets*24} tweets ({n_tweets} tweets/hour)" - ) - - # Update recent datetime - dt_recent = dt_past - - # Sort tweets per date - df_tweets.sort_index(ascending=False, inplace=True) - df_tweets["cumulative_compound"] = df_tweets["sentiment"].cumsum() - df_tweets["prob_sen"] = 1 - - # df_tweets.to_csv(r'notebooks/tweets.csv', index=False) - df_tweets.reset_index(inplace=True) - df_tweets["Month"] = pd.to_datetime(df_tweets["created_at"]).apply( - lambda x: x.month - ) - df_tweets["Day"] = pd.to_datetime(df_tweets["created_at"]).apply(lambda x: x.day) - df_tweets["date"] = pd.to_datetime(df_tweets["created_at"]) - df_tweets = df_tweets.sort_values(by="date") - df_tweets["cumulative_compound"] = df_tweets["sentiment"].cumsum() - - return df_tweets diff --git a/openbb_terminal/common/behavioural_analysis/twitter_view.py b/openbb_terminal/common/behavioural_analysis/twitter_view.py deleted file mode 100644 index fba727706288..000000000000 --- a/openbb_terminal/common/behavioural_analysis/twitter_view.py +++ /dev/null @@ -1,197 +0,0 @@ -"""Twitter view.""" -__docformat__ = "numpy" - -import logging -import os -from typing import Optional, Union - -import numpy as np -import pandas as pd -from dateutil import parser as dparse - -from openbb_terminal import OpenBBFigure, theme -from openbb_terminal.common.behavioural_analysis import twitter_model -from openbb_terminal.decorators import log_start_end -from openbb_terminal.helper_funcs import export_data, get_closing_price -from openbb_terminal.rich_config import console - -logger = logging.getLogger(__name__) - - -@log_start_end(log=logger) -def display_inference( - symbol: str, limit: int = 100, export: str = "", sheet_name: Optional[str] = None -): - """Prints Inference sentiment from past n tweets. - - Parameters - ---------- - symbol: str - Stock ticker symbol - limit: int - Number of tweets to analyze - sheet_name: str - Optionally specify the name of the sheet the data is exported to. - export: str - Format to export tweet dataframe - """ - df_tweets = twitter_model.load_analyze_tweets(symbol, limit) - - if (isinstance(df_tweets, pd.DataFrame) and df_tweets.empty) or ( - not isinstance(df_tweets, pd.DataFrame) and not df_tweets - ): - return - - # Parse tweets - dt_from = dparse.parse(df_tweets["created_at"].values[-1]) - dt_to = dparse.parse(df_tweets["created_at"].values[0]) - console.print(f"From: {dt_from.strftime('%Y-%m-%d %H:%M:%S')}") - console.print(f"To: {dt_to.strftime('%Y-%m-%d %H:%M:%S')}") - - console.print(f"{len(df_tweets)} tweets were analyzed.") - dt_delta = dt_to - dt_from - n_freq = dt_delta.total_seconds() / len(df_tweets) - console.print(f"Frequency of approx 1 tweet every {round(n_freq)} seconds.") - - pos = df_tweets["positive"] - neg = df_tweets["negative"] - - percent_pos = len(np.where(pos > neg)[0]) / len(df_tweets) - percent_neg = len(np.where(pos < neg)[0]) / len(df_tweets) - total_sent = np.round(np.sum(df_tweets["sentiment"]), 2) - mean_sent = np.round(np.mean(df_tweets["sentiment"]), 2) - console.print(f"The summed compound sentiment of {symbol} is: {total_sent}") - console.print(f"The average compound sentiment of {symbol} is: {mean_sent}") - console.print( - f"Of the last {len(df_tweets)} tweets, {100*percent_pos:.2f} % had a higher positive sentiment" - ) - console.print( - f"Of the last {len(df_tweets)} tweets, {100*percent_neg:.2f} % had a higher negative sentiment" - ) - - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "infer", - df_tweets, - sheet_name, - ) - - -@log_start_end(log=logger) -def display_sentiment( - symbol: str, - n_tweets: int = 15, - n_days_past: int = 2, - compare: bool = False, - export: str = "", - sheet_name: Optional[str] = None, - external_axes: bool = False, -) -> Union[OpenBBFigure, None]: - """Plots sentiments from symbol - - Parameters - ---------- - symbol: str - Stock ticker symbol to get sentiment for - n_tweets: int - Number of tweets to get per hour - n_days_past: int - Number of days to extract tweets for - compare: bool - Show corresponding change in stock price - sheet_name: str - Optionally specify the name of the sheet the data is exported to. - export: str - Format to export tweet dataframe - external_axes: bool, optional - Whether to return the figure object or not, by default False - """ - - df_tweets = twitter_model.get_sentiment(symbol, n_tweets, n_days_past) - - if df_tweets.empty: - return None - - if compare: - plots_kwargs = dict( - rows=3, - cols=1, - shared_xaxes=True, - vertical_spacing=0.05, - row_heights=[0.2, 0.6, 0.2], - ) - else: - plots_kwargs = dict( - rows=2, - cols=1, - shared_xaxes=True, - vertical_spacing=0.05, - row_heights=[0.6, 0.4], - ) - - fig = OpenBBFigure.create_subplots(**plots_kwargs) # type: ignore - - fig.add_scatter( - x=pd.to_datetime(df_tweets["created_at"]), - y=df_tweets["cumulative_compound"].values, - row=1, - col=1, - ) - - fig.set_yaxis_title("
Cumulative
VADER Sentiment", row=1, col=1) - - for _, day_df in df_tweets.groupby(by="Day"): - day_df["time"] = pd.to_datetime(day_df["created_at"]) - day_df = day_df.sort_values(by="time") - fig.add_scatter( - x=day_df["time"], - y=day_df["sentiment"].cumsum(), - row=1, - col=1, - ) - fig.add_bar( - x=df_tweets["date"], - y=df_tweets["positive"], - row=2, - col=1, - marker_color=theme.up_color, - ) - - fig.add_bar( - x=df_tweets["date"], - y=-1 * df_tweets["negative"], - row=2, - col=1, - marker_color=theme.down_color, - ) - fig.set_yaxis_title("VADER Polarity Scores", row=2, col=1) - - if compare: - # get stock end price for each corresponding day if compare == True - closing_price_df = get_closing_price(symbol, n_days_past) - fig.add_scatter( - x=closing_price_df["Date"], - y=closing_price_df["Close"], - name=pd.to_datetime(closing_price_df["Date"]).iloc[0].strftime("%Y-%m-%d"), - row=3, - col=1, - ) - fig.set_yaxis_title("Stock Price", row=3, col=1) - - fig.update_layout( - title=f"Twitter's {symbol} total compound sentiment over time is {round(np.sum(df_tweets['sentiment']), 2)}", - xaxis=dict(type="date"), - showlegend=False, - ) - - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "sentiment", - df_tweets, - sheet_name, - fig, - ) - - return fig.show(external=external_axes) diff --git a/openbb_terminal/stocks/behavioural_analysis/ba_controller.py b/openbb_terminal/stocks/behavioural_analysis/ba_controller.py index 00953436ee6c..547c5f23897c 100644 --- a/openbb_terminal/stocks/behavioural_analysis/ba_controller.py +++ b/openbb_terminal/stocks/behavioural_analysis/ba_controller.py @@ -13,7 +13,6 @@ google_view, reddit_view, stocktwits_view, - twitter_view, ) from openbb_terminal.core.session.current_user import get_current_user from openbb_terminal.custom_prompt_toolkit import NestedCompleter @@ -21,7 +20,6 @@ from openbb_terminal.helper_funcs import ( EXPORT_BOTH_RAW_DATA_AND_FIGURES, EXPORT_ONLY_RAW_DATA_ALLOWED, - check_int_range, check_non_negative, check_positive, valid_date, @@ -53,8 +51,6 @@ class BehaviouralAnalysisController(StockBaseController): "messages", "trending", "stalker", - "infer", - "sentiment", "mentions", "regions", "queries", @@ -102,8 +98,6 @@ def print_help(self): mt.add_cmd("stalker") mt.add_cmd("bullbear", self.ticker) mt.add_cmd("messages", self.ticker) - mt.add_cmd("infer", self.ticker) - mt.add_cmd("sentiment", self.ticker) mt.add_cmd("mentions", self.ticker) mt.add_cmd("regions", self.ticker) mt.add_cmd("interest", self.ticker) @@ -673,106 +667,6 @@ def call_rise(self, other_args: List[str]): else: console.print("No ticker loaded. Please load using 'load '\n") - @log_start_end(log=logger) - def call_infer(self, other_args: List[str]): - """Process infer command.""" - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="infer", - description=""" - Print quick sentiment inference from last tweets that contain the ticker. - This model splits the text into character-level tokens and uses vader sentiment analysis. - [Source: Twitter] - """, - ) - parser.add_argument( - "-l", - "--limit", - action="store", - dest="limit", - type=check_int_range(10, 100), - default=100, - help="limit of latest tweets to infer from.", - ) - 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, EXPORT_ONLY_RAW_DATA_ALLOWED - ) - if ns_parser: - if self.ticker: - twitter_view.display_inference( - symbol=self.ticker, - limit=ns_parser.limit, - export=ns_parser.export, - sheet_name=" ".join(ns_parser.sheet_name) - if ns_parser.sheet_name - else None, - ) - else: - console.print("No ticker loaded. Please load using 'load '\n") - - @log_start_end(log=logger) - def call_sentiment(self, other_args: List[str]): - """Process sentiment command.""" - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="sentiment", - description=""" - Plot in-depth sentiment predicted from tweets from last days - that contain pre-defined ticker. [Source: Twitter] - """, - ) - # in reality this argument could be 100, but after testing it takes too long - # to compute which may not be acceptable - # TODO: use https://github.com/twintproject/twint instead of twitter API - parser.add_argument( - "-l", - "--limit", - action="store", - dest="limit", - type=check_int_range(10, 62), - default=15, - help="limit of tweets to extract per hour.", - ) - parser.add_argument( - "-d", - "--days", - action="store", - dest="n_days_past", - type=check_int_range(1, 6), - default=6, - help="number of days in the past to extract tweets.", - ) - parser.add_argument( - "-c", - "--compare", - action="store_true", - dest="compare", - help="show corresponding change in stock price", - ) - 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, EXPORT_BOTH_RAW_DATA_AND_FIGURES - ) - if ns_parser: - if self.ticker: - twitter_view.display_sentiment( - symbol=self.ticker, - n_tweets=ns_parser.limit, - n_days_past=ns_parser.n_days_past, - compare=ns_parser.compare, - export=ns_parser.export, - sheet_name=" ".join(ns_parser.sheet_name) - if ns_parser.sheet_name - else None, - ) - else: - console.print("No ticker loaded. Please load using 'load '\n") - @log_start_end(log=logger) def call_headlines(self, other_args: List[str]): """Process finbrain command.""" diff --git a/tests/openbb_terminal/common/behavioural_analysis/test_twitter_model.py b/tests/openbb_terminal/common/behavioural_analysis/test_twitter_model.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/openbb_terminal/common/behavioural_analysis/test_twitter_view.py b/tests/openbb_terminal/common/behavioural_analysis/test_twitter_view.py deleted file mode 100644 index e69de29bb2d1..000000000000 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 888a0ac69367..c966d950db74 100644 --- a/tests/openbb_terminal/stocks/behavioural_analysis/test_ba_controller.py +++ b/tests/openbb_terminal/stocks/behavioural_analysis/test_ba_controller.py @@ -297,27 +297,6 @@ def test_call_func_expect_queue(expected_queue, queue, func): limit=5, ), ), - ( - "call_infer", - ["--limit=20", "--export=csv"], - "twitter_view.display_inference", - [], - dict(symbol="MOCK_TICKER", limit=20, export="csv", sheet_name=None), - ), - ( - "call_sentiment", - ["--limit=20", "--days=2", "--compare", "--export=csv"], - "twitter_view.display_sentiment", - [], - dict( - symbol="MOCK_TICKER", - n_tweets=20, - n_days_past=2, - compare=True, - export="csv", - sheet_name=None, - ), - ), ( "call_mentions", ["--start=2020-12-01", "--export=csv"], @@ -422,8 +401,6 @@ def test_call_func( "call_messages", "call_trending", "call_stalker", - "call_infer", - "call_sentiment", "call_mentions", "call_regions", "call_queries", @@ -456,8 +433,6 @@ def test_call_func_no_parser(func, mocker): "func", [ "call_headlines", - "call_sentiment", - "call_infer", "call_rise", "call_queries", "call_regions", 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 e2a9a232e0bc..e342867786e1 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 @@ -12,8 +12,6 @@ Ticker: TSLA stalker stalk stocktwits user's last messages [Stocktwits] bullbear estimate quick sentiment from last 30 messages on board [Stocktwits] messages output up to the 30 last messages on the board [Stocktwits] - infer infer about stock's sentiment from latest tweets [Twitter] - sentiment in-depth sentiment prediction from tweets over time [Twitter] mentions interest over time based on stock's mentions [Google] regions regions that show highest interest in stock [Google] interest interest over time of sentences versus stock price [Google] From 393db2f3dfd39e17d562d69d6f0bd1056aa206fb Mon Sep 17 00:00:00 2001 From: James Maslek Date: Fri, 11 Aug 2023 11:42:47 -0400 Subject: [PATCH 4/9] remove twitter functions and all references to it --- .../sdk/controllers/stocks_sdk_controller.py | 4 - .../core/sdk/models/keys_sdk_model.py | 2 - .../core/sdk/models/stocks_sdk_model.py | 8 -- openbb_terminal/core/sdk/sdk_init.py | 2 - openbb_terminal/core/sdk/trail_map.csv | 3 - openbb_terminal/keys_controller.py | 46 --------- openbb_terminal/keys_model.py | 94 ------------------- .../miscellaneous/models/all_api_keys.json | 18 ---- .../miscellaneous/models/hub_credentials.json | 3 - openbb_terminal/sdk.py | 1 - tests/openbb_terminal/test_keys_controller.py | 6 -- tests/openbb_terminal/test_keys_model.py | 28 ------ .../content/terminal/usage/guides/api-keys.md | 2 +- 13 files changed, 1 insertion(+), 216 deletions(-) diff --git a/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py b/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py index 676362d2e6e3..4ddbb03f5a66 100644 --- a/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py +++ b/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py @@ -42,8 +42,6 @@ def ba(self): `getdd`: Get due diligence posts from list of subreddits [Source: reddit].\n `headlines`: Gets Sentiment analysis provided by FinBrain's API [Source: finbrain].\n `headlines_chart`: Plots Sentiment analysis from FinBrain. Prints table if raw is True. [Source: FinBrain]\n - `infer`: Load tweets from twitter API and analyzes using VADER.\n - `infer_chart`: Prints Inference sentiment from past n tweets.\n `mentions`: Get interest over time from google api [Source: google].\n `mentions_chart`: Plots weekly bars of stock's interest over time. other users watchlist. [Source: Google].\n `messages`: Get last messages for a given ticker [Source: stocktwits].\n @@ -55,8 +53,6 @@ def ba(self): `regions`: Get interest by region from google api [Source: google].\n `regions_chart`: Plots bars of regions based on stock's interest. [Source: Google].\n `rise`: Get top rising related queries with this stock's query [Source: google].\n - `sentiment`: Get sentiments from symbol.\n - `sentiment_chart`: Plots sentiments from symbol\n `snews`: Get headlines sentiment using VADER model over time. [Source: Finnhub]\n `snews_chart`: Display stock price and headlines sentiment using VADER model over time. [Source: Finnhub]\n `stalker`: Gets messages from given user [Source: stocktwits].\n diff --git a/openbb_terminal/core/sdk/models/keys_sdk_model.py b/openbb_terminal/core/sdk/models/keys_sdk_model.py index 0572e6d3ded9..0ccee257bd40 100644 --- a/openbb_terminal/core/sdk/models/keys_sdk_model.py +++ b/openbb_terminal/core/sdk/models/keys_sdk_model.py @@ -42,7 +42,6 @@ class KeysRoot(Category): `stocksera`: Set Stocksera key.\n `tokenterminal`: Set Token Terminal key.\n `tradier`: Set Tradier key\n - `twitter`: Set Twitter key\n `ultima`: Set Ultima Insights key\n `walert`: Set Walert key\n """ @@ -84,6 +83,5 @@ def __init__(self): self.stocksera = lib.keys_model.set_stocksera_key self.tokenterminal = lib.keys_model.set_tokenterminal_key self.tradier = lib.keys_model.set_tradier_key - self.twitter = lib.keys_model.set_twitter_key self.ultima = lib.keys_model.set_ultima_key self.walert = lib.keys_model.set_walert_key diff --git a/openbb_terminal/core/sdk/models/stocks_sdk_model.py b/openbb_terminal/core/sdk/models/stocks_sdk_model.py index f0e4c74c4aca..193caf164e96 100644 --- a/openbb_terminal/core/sdk/models/stocks_sdk_model.py +++ b/openbb_terminal/core/sdk/models/stocks_sdk_model.py @@ -42,8 +42,6 @@ class StocksBehavioralAnalysis(Category): `getdd`: Get due diligence posts from list of subreddits [Source: reddit].\n `headlines`: Gets Sentiment analysis provided by FinBrain's API [Source: finbrain].\n `headlines_chart`: Plots Sentiment analysis from FinBrain. Prints table if raw is True. [Source: FinBrain]\n - `infer`: Load tweets from twitter API and analyzes using VADER.\n - `infer_chart`: Prints Inference sentiment from past n tweets.\n `mentions`: Get interest over time from google api [Source: google].\n `mentions_chart`: Plots weekly bars of stock's interest over time. other users watchlist. [Source: Google].\n `messages`: Get last messages for a given ticker [Source: stocktwits].\n @@ -55,8 +53,6 @@ class StocksBehavioralAnalysis(Category): `regions`: Get interest by region from google api [Source: google].\n `regions_chart`: Plots bars of regions based on stock's interest. [Source: Google].\n `rise`: Get top rising related queries with this stock's query [Source: google].\n - `sentiment`: Get sentiments from symbol.\n - `sentiment_chart`: Plots sentiments from symbol\n `snews`: Get headlines sentiment using VADER model over time. [Source: Finnhub]\n `snews_chart`: Display stock price and headlines sentiment using VADER model over time. [Source: Finnhub]\n `stalker`: Gets messages from given user [Source: stocktwits].\n @@ -74,8 +70,6 @@ def __init__(self): self.getdd = lib.stocks_ba_reddit_model.get_due_dilligence self.headlines = lib.stocks_ba_finbrain_model.get_sentiment self.headlines_chart = lib.stocks_ba_finbrain_view.display_sentiment_analysis - self.infer = lib.stocks_ba_twitter_model.load_analyze_tweets - self.infer_chart = lib.stocks_ba_twitter_view.display_inference self.mentions = lib.stocks_ba_google_model.get_mentions self.mentions_chart = lib.stocks_ba_google_view.display_mentions self.messages = lib.stocks_ba_stocktwits_model.get_messages @@ -87,8 +81,6 @@ def __init__(self): self.regions = lib.stocks_ba_google_model.get_regions self.regions_chart = lib.stocks_ba_google_view.display_regions self.rise = lib.stocks_ba_google_model.get_rise - self.sentiment = lib.stocks_ba_twitter_model.get_sentiment - self.sentiment_chart = lib.stocks_ba_twitter_view.display_sentiment self.snews = lib.stocks_ba_finnhub_model.get_headlines_sentiment self.snews_chart = ( lib.stocks_ba_finnhub_view.display_stock_price_headlines_sentiment diff --git a/openbb_terminal/core/sdk/sdk_init.py b/openbb_terminal/core/sdk/sdk_init.py index 571269da4159..0068ea5bd19b 100644 --- a/openbb_terminal/core/sdk/sdk_init.py +++ b/openbb_terminal/core/sdk/sdk_init.py @@ -121,8 +121,6 @@ reddit_view as stocks_ba_reddit_view, stocktwits_model as stocks_ba_stocktwits_model, stocktwits_view as stocks_ba_stocktwits_view, - twitter_model as stocks_ba_twitter_model, - twitter_view as stocks_ba_twitter_view, ) diff --git a/openbb_terminal/core/sdk/trail_map.csv b/openbb_terminal/core/sdk/trail_map.csv index a7e369182cd0..1581bb113e90 100644 --- a/openbb_terminal/core/sdk/trail_map.csv +++ b/openbb_terminal/core/sdk/trail_map.csv @@ -317,7 +317,6 @@ keys.smartstake,keys_model.set_smartstake_key, keys.stocksera,keys_model.set_stocksera_key, keys.tokenterminal,keys_model.set_tokenterminal_key, keys.tradier,keys_model.set_tradier_key, -keys.twitter,keys_model.set_twitter_key, keys.ultima,keys_model.set_ultima_key, keys.walert,keys_model.set_walert_key, login,sdk_session.login, @@ -389,7 +388,6 @@ stocks.ba.bullbear,stocks_ba_stocktwits_model.get_bullbear, stocks.ba.cnews,stocks_ba_finnhub_model.get_company_news, stocks.ba.getdd,stocks_ba_reddit_model.get_due_dilligence, stocks.ba.headlines,stocks_ba_finbrain_model.get_sentiment,stocks_ba_finbrain_view.display_sentiment_analysis -stocks.ba.infer,stocks_ba_twitter_model.load_analyze_tweets,stocks_ba_twitter_view.display_inference stocks.ba.mentions,stocks_ba_google_model.get_mentions,stocks_ba_google_view.display_mentions stocks.ba.messages,stocks_ba_stocktwits_model.get_messages, stocks.ba.ns,stocks_ba_news_sentiment_model.get_data,stocks_ba_news_sentiment_view.display_articles_data @@ -398,7 +396,6 @@ stocks.ba.queries,stocks_ba_google_model.get_queries, stocks.ba.redditsent,stocks_ba_reddit_model.get_posts_about, stocks.ba.regions,stocks_ba_google_model.get_regions,stocks_ba_google_view.display_regions stocks.ba.rise,stocks_ba_google_model.get_rise, -stocks.ba.sentiment,stocks_ba_twitter_model.get_sentiment,stocks_ba_twitter_view.display_sentiment stocks.ba.snews,stocks_ba_finnhub_model.get_headlines_sentiment,stocks_ba_finnhub_view.display_stock_price_headlines_sentiment stocks.ba.stalker,stocks_ba_stocktwits_model.get_stalker, stocks.ba.text_sent,stocks_ba_reddit_model.get_sentiment, diff --git a/openbb_terminal/keys_controller.py b/openbb_terminal/keys_controller.py index 69c94595a53d..976475b934a0 100644 --- a/openbb_terminal/keys_controller.py +++ b/openbb_terminal/keys_controller.py @@ -577,52 +577,6 @@ def call_reddit(self, other_args: List[str]): show_output=True, ) - @log_start_end(log=logger) - def call_twitter(self, other_args: List[str]): - """Process twitter command""" - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="twitter", - description="Set Twitter API key.", - ) - parser.add_argument( - "-k", - "--key", - type=str, - dest="key", - help="Key", - required="-h" not in other_args and "--help" not in other_args, - ) - parser.add_argument( - "-s", - "--secret", - type=str, - dest="secret", - help="Secret key", - required="-h" not in other_args and "--help" not in other_args, - ) - parser.add_argument( - "-t", - "--token", - type=str, - dest="token", - help="Bearer token", - required="-h" not in other_args and "--help" not in other_args, - ) - if not other_args: - console.print("For your API Key, visit: https://developer.twitter.com") - return - ns_parser = self.parse_simple_args(parser, other_args) - if ns_parser: - self.status_dict["twitter"] = keys_model.set_twitter_key( - key=ns_parser.key, - secret=ns_parser.secret, - access_token=ns_parser.token, - persist=True, - show_output=True, - ) - @log_start_end(log=logger) def call_rh(self, other_args: List[str]): """Process rh command""" diff --git a/openbb_terminal/keys_model.py b/openbb_terminal/keys_model.py index 12d6347f6048..ba8937714d24 100644 --- a/openbb_terminal/keys_model.py +++ b/openbb_terminal/keys_model.py @@ -1160,100 +1160,6 @@ def check_bitquery_key(show_output: bool = False) -> str: return str(status) -def set_twitter_key( - key: str, - secret: str, - access_token: str, - persist: bool = False, - show_output: bool = False, -) -> str: - """Set Twitter key - - Parameters - ---------- - key: str - API key - secret: str - API secret - access_token: str - API token - persist: bool, optional - If False, api key change will be contained to where it was changed. For example, a Jupyter notebook session. - If True, api key change will be global, i.e. it will affect terminal environment variables. - By default, False. - show_output: bool, optional - Display status string or not. By default, False. - - Returns - ------- - str - Status of key set - - Examples - -------- - >>> from openbb_terminal.sdk import openbb - >>> openbb.keys.twitter( - key="example_key", - secret="example_secret", - access_token="example_access_token" - ) - """ - handle_credential("API_TWITTER_KEY", key, persist) - handle_credential("API_TWITTER_SECRET_KEY", secret, persist) - handle_credential("API_TWITTER_BEARER_TOKEN", access_token, persist) - - return check_twitter_key(show_output) - - -def check_twitter_key(show_output: bool = False) -> str: - """Check Twitter key - - Parameters - ---------- - show_output: bool, optional - Display status string or not. By default, False. - - Returns - ------- - str - Status of key set - """ - - if show_output: - console.print("Checking status...") - - current_user = get_current_user() - if current_user.credentials.API_TWITTER_BEARER_TOKEN == "REPLACE_ME": - status = KeyStatus.NOT_DEFINED - else: - params = { - "query": "(\\$AAPL) (lang:en)", - "max_results": "10", - "tweet.fields": "created_at,lang", - } - r = request( - "https://api.twitter.com/2/tweets/search/recent", - params=params, # type: ignore - headers={ - "authorization": "Bearer " - + current_user.credentials.API_TWITTER_BEARER_TOKEN - }, - ) - if r.status_code == 200: - status = KeyStatus.DEFINED_TEST_PASSED - elif r.status_code in [401, 403]: - logger.warning("Twitter key defined, test failed") - status = KeyStatus.DEFINED_TEST_FAILED - else: - logger.warning("Twitter key defined, test failed") - status = KeyStatus.DEFINED_TEST_INCONCLUSIVE - - if show_output: - console.print(status.colorize()) - - return str(status) - - def set_rh_key( username: str, password: str, diff --git a/openbb_terminal/miscellaneous/models/all_api_keys.json b/openbb_terminal/miscellaneous/models/all_api_keys.json index d9abe8d6dc97..cac66c9c54ea 100644 --- a/openbb_terminal/miscellaneous/models/all_api_keys.json +++ b/openbb_terminal/miscellaneous/models/all_api_keys.json @@ -65,24 +65,6 @@ "link": "https://polygon.io", "markdown": "Go to: https://polygon.io\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207825623-fcd7f0a3-131a-4294-808c-754c13e38e2a.png)\n\nClick on, \"Get your Free API Key\".\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207825952-ca5540ec-6ed2-4cef-a0ed-bb50b813932c.png)\n\nAfter signing up, the API Key is found at the bottom of the account dashboard page.\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207826258-b1f318fa-fd9c-41d9-bf5c-fe16722e6601.png)" }, - { - "name": "API_TWITTER_KEY", - "source": "Twitter key", - "link": "https://developer.twitter.com", - "markdown": "![Twitter API](https://pbs.twimg.com/media/FooIJF3agAIU8SN?format=png&name=medium)" - }, - { - "name": "API_TWITTER_SECRET_KEY", - "source": "Twitter secret", - "link": "https://developer.twitter.com", - "markdown": "![Twitter API](https://pbs.twimg.com/media/FooIJF3agAIU8SN?format=png&name=medium)" - }, - { - "name": "API_TWITTER_BEARER_TOKEN", - "source": "Twitter token", - "link": "https://developer.twitter.com", - "markdown": "![Twitter API](https://pbs.twimg.com/media/FooIJF3agAIU8SN?format=png&name=medium)" - }, { "name": "API_FRED_KEY", "source": "FRED", diff --git a/openbb_terminal/miscellaneous/models/hub_credentials.json b/openbb_terminal/miscellaneous/models/hub_credentials.json index c0275c172bbb..2370ee7b71d3 100644 --- a/openbb_terminal/miscellaneous/models/hub_credentials.json +++ b/openbb_terminal/miscellaneous/models/hub_credentials.json @@ -32,8 +32,5 @@ "API_REDDIT_USERNAME": "", "API_REDDIT_USER_AGENT": "", "API_REDDIT_PASSWORD": "", - "API_TWITTER_KEY": "", - "API_TWITTER_SECRET_KEY": "", - "API_TWITTER_BEARER_TOKEN": "", "API_DAPPRADAR_KEY": "" } diff --git a/openbb_terminal/sdk.py b/openbb_terminal/sdk.py index 73165a284649..1990c434c1ef 100644 --- a/openbb_terminal/sdk.py +++ b/openbb_terminal/sdk.py @@ -438,7 +438,6 @@ def keys(self): `stocksera`: Set Stocksera key.\n `tokenterminal`: Set Token Terminal key.\n `tradier`: Set Tradier key\n - `twitter`: Set Twitter key\n `ultima`: Set Ultima Insights key\n `walert`: Set Walert key\n """ diff --git a/tests/openbb_terminal/test_keys_controller.py b/tests/openbb_terminal/test_keys_controller.py index 10c2de4d5cf4..8af59ae4f4dd 100644 --- a/tests/openbb_terminal/test_keys_controller.py +++ b/tests/openbb_terminal/test_keys_controller.py @@ -148,12 +148,6 @@ def test_call_reddit(other): controller.call_reddit(other) -@pytest.mark.vcr -@pytest.mark.parametrize("other", [[], ["-k", "1234", "-s", "4567", "-t", "890"]]) -def test_call_twitter(other): - controller.call_twitter(other) - - @pytest.mark.vcr @pytest.mark.parametrize("other", [[], ["-u", "1234", "-p", "4567"]]) def test_call_rh(other): diff --git a/tests/openbb_terminal/test_keys_model.py b/tests/openbb_terminal/test_keys_model.py index 7d230a13c200..f5b2883e3dd3 100644 --- a/tests/openbb_terminal/test_keys_model.py +++ b/tests/openbb_terminal/test_keys_model.py @@ -367,34 +367,6 @@ def test_set_bitquery_key(args: List[str], persist: bool, show_output: bool, moc mock_check.assert_called_once_with(show_output) -@pytest.mark.vcr -@pytest.mark.parametrize( - "args, persist, show_output", - [ - ( - ["test_key", "test_secret", "test_access_token"], - False, - True, - ), - ( - ["test_key", "test_secret", "test_access_token"], - False, - False, - ), - ], -) -def test_set_twitter_key(args: List[str], persist: bool, show_output: bool, mocker): - mock_check = mocker.patch("openbb_terminal.keys_model.check_twitter_key") - keys_model.set_twitter_key( - key=args[0], - secret=args[1], - access_token=args[2], - persist=persist, - show_output=show_output, - ) - mock_check.assert_called_once_with(show_output) - - @pytest.mark.vcr @pytest.mark.parametrize( "args, persist, show_output", diff --git a/website/content/terminal/usage/guides/api-keys.md b/website/content/terminal/usage/guides/api-keys.md index d15f8792fd51..30f712e3cb88 100644 --- a/website/content/terminal/usage/guides/api-keys.md +++ b/website/content/terminal/usage/guides/api-keys.md @@ -2,7 +2,7 @@ title: Setting API Keys sidebar_position: 1 description: API (Application Programming Interface) keys are access credentials for accessing data from a particular source. Learn how to set, manage, and access data APIs for the OpenBB Terminal. -keywords: [api, keys, api keys, openbb terminal, data provider, data, free, alpha vantage, fred, iex, twitter, degiro, binance, coinglass, polygon, intrinio, sdk, alphavantage, bitquery, coinbase, databento, finnhub, FRED, github, glassnode, iex cloud, news API, robinhood, santiment, shroomdk, token terminal, tradier, twitter, whale alert] +keywords: [api, keys, api keys, openbb terminal, data provider, data, free, alpha vantage, fred, iex, degiro, binance, coinglass, polygon, intrinio, sdk, alphavantage, bitquery, coinbase, databento, finnhub, FRED, github, glassnode, iex cloud, news API, robinhood, santiment, shroomdk, token terminal, tradier, whale alert] --- import HeadTitle from '@site/src/components/General/HeadTitle.tsx'; From 6ddb3b96dd6ca9d02f4a60dde9db25b25533a814 Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Mon, 21 Aug 2023 15:56:26 -0700 Subject: [PATCH 5/9] Fix URL in SDK Stock Screener Intro Fixes the URL pointing to the OpenBBUserData folder guide. --- website/content/sdk/usage/intros/stocks/stocks-screener.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/content/sdk/usage/intros/stocks/stocks-screener.md b/website/content/sdk/usage/intros/stocks/stocks-screener.md index 18888a688bc1..b3940d9ee684 100644 --- a/website/content/sdk/usage/intros/stocks/stocks-screener.md +++ b/website/content/sdk/usage/intros/stocks/stocks-screener.md @@ -147,7 +147,7 @@ Price/Free Cash Flow = Low (<15) Beta = Under 1 ``` -Copy the block above to a new text file in any editor, and save the file to the [OpenBBUserData](https://docs.openbb.co/sdk/usage/guides/data) folder, naming it something like, `sdk_guide_preset.ini`. **This preset has also been included with the installation**. Declaring the path to the preset file, when located in the OpenBBUserData folder, is not required. The kernel must be restarted when a file is renamed or created; however, changes to the preset itself will be reflected immediately and without restarting. +Copy the block above to a new text file in any editor, and save the file to the [OpenBBUserData](https://docs.openbb.co/terminal/usage/guides/data) folder, naming it something like, `sdk_guide_preset.ini`. **This preset has also been included with the installation**. Declaring the path to the preset file, when located in the OpenBBUserData folder, is not required. The kernel must be restarted when a file is renamed or created; however, changes to the preset itself will be reflected immediately and without restarting. It is a good idea to test choices made before making it too complicated. Start with a handful of filters and modify, or add, them one-at-a-time. Let's pass what we have so far through the screener with `performance` selected as the `data_type`. From 82e60bea3908e86a24b2a6abe3080238c253f2db Mon Sep 17 00:00:00 2001 From: James Maslek Date: Mon, 28 Aug 2023 13:51:15 -0400 Subject: [PATCH 6/9] ruff --- .../macOS_package_assets/OpenBB Terminal/OpenBB Terminal | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build/pyinstaller/macOS_package_assets/OpenBB Terminal/OpenBB Terminal b/build/pyinstaller/macOS_package_assets/OpenBB Terminal/OpenBB Terminal index 8975d7a86042..404d8fa83b8a 100755 --- a/build/pyinstaller/macOS_package_assets/OpenBB Terminal/OpenBB Terminal +++ b/build/pyinstaller/macOS_package_assets/OpenBB Terminal/OpenBB Terminal @@ -23,7 +23,14 @@ Get started in less than 3 minutes: https://www.youtube.com/watch?v=UFh_Ku0fdtY echo "$BOOTUP_MESSAGE" # Add some messages we can print out -messages=("" "" "" "" "Did you know that you can search for stocks from a given country by running stocks/search --exchangecountry COUNTRY") +messages=("" "" "" "" \ +"Did you know that you can search for stocks from a given country by running stocks/search --exchangecountry COUNTRY" \ +"" "" "" \ +"You can jump between menus by starting your command with a backslash. To go from funds to stocks/fa, you can run /stocks/fa" \ +"" "" "" \ +"Every command has a help flag. To access this use the -h flag after your command.") + + # Pick a random one index=$((RANDOM % ${#messages[@]})) echo ${messages[$index]} From e05d3eb4051d874cd482302a35b74f0d7666e7b5 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Mon, 28 Aug 2023 16:12:43 -0400 Subject: [PATCH 7/9] 3.2.1->3.2.2 --- build/docker/compose.env | 2 +- build/nsis/setup.nsi | 6 +++--- build/pyinstaller/version.rc | 8 ++++---- openbb_terminal/core/models/system_model.py | 2 +- .../core/sdk/controllers/crypto_sdk_controller.py | 11 ----------- openbb_terminal/core/sdk/models/crypto_sdk_model.py | 11 ----------- pyproject.toml | 2 +- 7 files changed, 10 insertions(+), 32 deletions(-) diff --git a/build/docker/compose.env b/build/docker/compose.env index 943d85414f3c..1b8319eddfa4 100644 --- a/build/docker/compose.env +++ b/build/docker/compose.env @@ -1,2 +1,2 @@ OPENBBTERMINAL_DOCKER_REGISTRY="ghcr.io" -OPENBBTERMINAL_DOCKER_RELEASE_VERSION="3.2.1" +OPENBBTERMINAL_DOCKER_RELEASE_VERSION="3.2.2" diff --git a/build/nsis/setup.nsi b/build/nsis/setup.nsi index 8bb8de9696f3..4093faad17ae 100644 --- a/build/nsis/setup.nsi +++ b/build/nsis/setup.nsi @@ -10,7 +10,7 @@ !define NAME "OpenBB Terminal" !define COMPANY "OpenBB" !define APPFILE "OpenBBTerminal.exe" - !define VERSION "3.2.1" + !define VERSION "3.2.2" !define SLUG "${NAME} v${VERSION}" ;-------------------------------- @@ -20,8 +20,8 @@ VIAddVersionKey Comments "An installer for OpenBB Terminal. For additional details, visit OpenBB.co" VIAddVersionKey CompanyName OpenBB.co VIAddVersionKey FileDescription "OpenBB Terminal Program" - VIAddVersionKey FileVersion 3.2.1.0 - VIAddVersionKey ProductVersion 3.2.1.0 + VIAddVersionKey FileVersion 3.2.2.0 + VIAddVersionKey ProductVersion 3.2.2.0 VIAddVersionKey InternalName "OpenBB Terminal" ;-------------------------------- diff --git a/build/pyinstaller/version.rc b/build/pyinstaller/version.rc index 76cb484c2c8d..d635001a7257 100644 --- a/build/pyinstaller/version.rc +++ b/build/pyinstaller/version.rc @@ -6,8 +6,8 @@ VSVersionInfo( ffi=FixedFileInfo( # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # Set not needed items to zero 0. - filevers=(3, 0, 0, 0), - prodvers=(3, 0, 0, 0), + filevers=(3, 2, 2, 0), + prodvers=(3, 2, 2, 0), # Contains a bitmask that specifies the valid bits 'flags'r mask=0x0, # Contains a bitmask that specifies the Boolean attributes of the file. @@ -32,10 +32,10 @@ VSVersionInfo( [StringStruct('Comments', 'The OpenBB Terminal. For additional details, visit OpenBB.co'), StringStruct('CompanyName', 'OpenBB'), StringStruct('FileDescription', 'OpenBB Terminal Program'), - StringStruct('FileVersion', '3.2.1.0'), + StringStruct('FileVersion', '3.2.2.0'), StringStruct('InternalName', 'OpenBB Terminal'), StringStruct('ProductName', 'OpenBB Terminal'), - StringStruct('ProductVersion', '3.2.1.0')]) + StringStruct('ProductVersion', '3.2.2.0')]) ]), VarFileInfo([VarStruct('Translation', [1033, 1200])]) ] diff --git a/openbb_terminal/core/models/system_model.py b/openbb_terminal/core/models/system_model.py index 7f478d304367..468ce6d2daf4 100644 --- a/openbb_terminal/core/models/system_model.py +++ b/openbb_terminal/core/models/system_model.py @@ -28,7 +28,7 @@ class SystemModel(BaseModel): PLATFORM: str = str(platform.platform()) # OpenBB section - VERSION: str = "3.2.1" + VERSION: str = "3.2.2" # Logging section LOGGING_APP_ID: str = "REPLACE_ME" diff --git a/openbb_terminal/core/sdk/controllers/crypto_sdk_controller.py b/openbb_terminal/core/sdk/controllers/crypto_sdk_controller.py index ac880083a5b7..f10ed8cd0d9f 100644 --- a/openbb_terminal/core/sdk/controllers/crypto_sdk_controller.py +++ b/openbb_terminal/core/sdk/controllers/crypto_sdk_controller.py @@ -135,24 +135,14 @@ def defi(self): `luna_supply_chart`: Plots and prints table showing Luna circulating supply stats\n `newsletters`: Scrape all substack newsletters from url list.\n `newsletters_chart`: Prints table showing DeFi related substack newsletters.\n - `pairs`: Get lastly added trade-able pairs on Uniswap with parameters like:\n - `pairs_chart`: Prints table showing Lastly added pairs on Uniswap DEX.\n - `pools`: Get uniswap pools by volume. [Source: https://thegraph.com/en/]\n - `pools_chart`: Prints table showing uniswap pools by volume.\n `sinfo`: Get staking info for provided terra account [Source: https://fcd.terra.dev/swagger]\n `sinfo_chart`: Prints table showing staking info for provided terra account address [Source: https://fcd.terra.dev/swagger]\n `sratio`: Get terra blockchain staking ratio history [Source: https://fcd.terra.dev/swagger]\n `sratio_chart`: Plots terra blockchain staking ratio history [Source: https://fcd.terra.dev/v1]\n `sreturn`: Get terra blockchain staking returns history [Source: https://fcd.terra.dev/v1]\n `sreturn_chart`: Plots terra blockchain staking returns history [Source: https://fcd.terra.dev/swagger]\n - `stats`: Get base statistics about Uniswap DEX. [Source: https://thegraph.com/en/]\n - `stats_chart`: Prints table showing base statistics about Uniswap DEX. [Source: https://thegraph.com/en/]\n `stvl`: Returns historical values of the total sum of TVLs from all listed protocols.\n `stvl_chart`: Plots historical values of the total sum of TVLs from all listed protocols.\n - `swaps`: Get the last 100 swaps done on Uniswap [Source: https://thegraph.com/en/]\n - `swaps_chart`: Prints table showing last swaps done on Uniswap\n - `tokens`: Get list of tokens trade-able on Uniswap DEX. [Source: https://thegraph.com/en/]\n - `tokens_chart`: Prints table showing tokens trade-able on Uniswap DEX.\n `validators`: Get information about terra validators [Source: https://fcd.terra.dev/swagger]\n `validators_chart`: Prints table showing information about terra validators [Source: https://fcd.terra.dev/swagger]\n `vaults`: Get DeFi Vaults Information. DeFi Vaults are pools of funds with an assigned strategy which main goal is to\n @@ -250,7 +240,6 @@ def onchain(self): `lt_chart`: Prints table showing Trades on Decentralized Exchanges aggregated by DEX or Month\n `prices`: Get token historical prices with volume and market cap, and average price. [Source: Ethplorer]\n `prices_chart`: Display token historical prices with volume and market cap, and average price.\n - `query`: Get query data\n `query_graph`: Helper methods for querying graphql api. [Source: https://bitquery.io/]\n `th`: Get info about token historical transactions. [Source: Ethplorer]\n `th_chart`: Display info about token history. [Source: Ethplorer]\n diff --git a/openbb_terminal/core/sdk/models/crypto_sdk_model.py b/openbb_terminal/core/sdk/models/crypto_sdk_model.py index e8f8e1c95e91..8315dba2116e 100644 --- a/openbb_terminal/core/sdk/models/crypto_sdk_model.py +++ b/openbb_terminal/core/sdk/models/crypto_sdk_model.py @@ -229,24 +229,14 @@ class CryptoDeFi(Category): `luna_supply_chart`: Plots and prints table showing Luna circulating supply stats\n `newsletters`: Scrape all substack newsletters from url list.\n `newsletters_chart`: Prints table showing DeFi related substack newsletters.\n - `pairs`: Get lastly added trade-able pairs on Uniswap with parameters like:\n - `pairs_chart`: Prints table showing Lastly added pairs on Uniswap DEX.\n - `pools`: Get uniswap pools by volume. [Source: https://thegraph.com/en/]\n - `pools_chart`: Prints table showing uniswap pools by volume.\n `sinfo`: Get staking info for provided terra account [Source: https://fcd.terra.dev/swagger]\n `sinfo_chart`: Prints table showing staking info for provided terra account address [Source: https://fcd.terra.dev/swagger]\n `sratio`: Get terra blockchain staking ratio history [Source: https://fcd.terra.dev/swagger]\n `sratio_chart`: Plots terra blockchain staking ratio history [Source: https://fcd.terra.dev/v1]\n `sreturn`: Get terra blockchain staking returns history [Source: https://fcd.terra.dev/v1]\n `sreturn_chart`: Plots terra blockchain staking returns history [Source: https://fcd.terra.dev/swagger]\n - `stats`: Get base statistics about Uniswap DEX. [Source: https://thegraph.com/en/]\n - `stats_chart`: Prints table showing base statistics about Uniswap DEX. [Source: https://thegraph.com/en/]\n `stvl`: Returns historical values of the total sum of TVLs from all listed protocols.\n `stvl_chart`: Plots historical values of the total sum of TVLs from all listed protocols.\n - `swaps`: Get the last 100 swaps done on Uniswap [Source: https://thegraph.com/en/]\n - `swaps_chart`: Prints table showing last swaps done on Uniswap\n - `tokens`: Get list of tokens trade-able on Uniswap DEX. [Source: https://thegraph.com/en/]\n - `tokens_chart`: Prints table showing tokens trade-able on Uniswap DEX.\n `validators`: Get information about terra validators [Source: https://fcd.terra.dev/swagger]\n `validators_chart`: Prints table showing information about terra validators [Source: https://fcd.terra.dev/swagger]\n `vaults`: Get DeFi Vaults Information. DeFi Vaults are pools of funds with an assigned strategy which main goal is to\n @@ -445,7 +435,6 @@ class CryptoOnChain(Category): `lt_chart`: Prints table showing Trades on Decentralized Exchanges aggregated by DEX or Month\n `prices`: Get token historical prices with volume and market cap, and average price. [Source: Ethplorer]\n `prices_chart`: Display token historical prices with volume and market cap, and average price.\n - `query`: Get query data\n `query_graph`: Helper methods for querying graphql api. [Source: https://bitquery.io/]\n `th`: Get info about token historical transactions. [Source: Ethplorer]\n `th_chart`: Display info about token history. [Source: Ethplorer]\n diff --git a/pyproject.toml b/pyproject.toml index 2a3bf4c979b9..fd992a6a0d9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "openbb" -version = "3.2.1" +version = "3.2.2" description = "Investment Research for Everyone, Anywhere." license = "MIT" authors = ["Didier Rodrigues Lopes"] From b031d7cff504751ec64d375ac27b0e1bcc019774 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Mon, 28 Aug 2023 16:21:37 -0400 Subject: [PATCH 8/9] update changelogs --- website/content/terminal/changelog/version2_0_0.mdx | 2 +- website/content/terminal/changelog/version2_1_0.mdx | 2 +- website/content/terminal/changelog/version2_2_0.mdx | 2 +- website/content/terminal/changelog/version2_3_0.mdx | 2 +- website/content/terminal/changelog/version2_3_1.mdx | 2 +- website/content/terminal/changelog/version2_4_0.mdx | 2 +- website/content/terminal/changelog/version2_4_1.mdx | 2 +- website/content/terminal/changelog/version2_5_0.mdx | 2 +- website/content/terminal/changelog/version2_5_1.mdx | 2 +- website/content/terminal/changelog/version3_0_0.mdx | 2 +- website/content/terminal/changelog/version3_0_1.mdx | 2 +- website/content/terminal/changelog/version3_1_0.mdx | 2 +- website/content/terminal/changelog/version3_2_0.mdx | 2 +- website/content/terminal/changelog/version3_2_1.mdx | 6 +++--- website/content/terminal/changelog/version_3_2_2.mdx | 7 +++++++ 15 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 website/content/terminal/changelog/version_3_2_2.mdx diff --git a/website/content/terminal/changelog/version2_0_0.mdx b/website/content/terminal/changelog/version2_0_0.mdx index 0841d51f3344..afc28ed37626 100644 --- a/website/content/terminal/changelog/version2_0_0.mdx +++ b/website/content/terminal/changelog/version2_0_0.mdx @@ -3,7 +3,7 @@ title: v2.0.0 version: "2.0.0" date: 2022-11-29 description: v2.0.0 -sidebar_position: 105 +sidebar_position: 106 --- ## Major Release Notes diff --git a/website/content/terminal/changelog/version2_1_0.mdx b/website/content/terminal/changelog/version2_1_0.mdx index 321425a6955d..4829d18abe56 100644 --- a/website/content/terminal/changelog/version2_1_0.mdx +++ b/website/content/terminal/changelog/version2_1_0.mdx @@ -3,7 +3,7 @@ title: v2.1.0 version: "2.1.0" date: 2022-12-21 description: v2.1.0 -sidebar_position: 104 +sidebar_position: 105 --- ## What's new diff --git a/website/content/terminal/changelog/version2_2_0.mdx b/website/content/terminal/changelog/version2_2_0.mdx index 51bc24934de4..808fc5b5c0a1 100644 --- a/website/content/terminal/changelog/version2_2_0.mdx +++ b/website/content/terminal/changelog/version2_2_0.mdx @@ -3,7 +3,7 @@ title: v2.2.0 version: "2.2.0" date: 2022-01-19 description: v2.2.0 -sidebar_position: 103 +sidebar_position: 104 --- ## What's new diff --git a/website/content/terminal/changelog/version2_3_0.mdx b/website/content/terminal/changelog/version2_3_0.mdx index c6b65de6aa3f..120e32ed8240 100644 --- a/website/content/terminal/changelog/version2_3_0.mdx +++ b/website/content/terminal/changelog/version2_3_0.mdx @@ -3,7 +3,7 @@ title: v2.3.0 version: "2.3.0" date: 2023-01-31 description: v2.3.0 -sidebar_position: 102 +sidebar_position: 103 --- diff --git a/website/content/terminal/changelog/version2_3_1.mdx b/website/content/terminal/changelog/version2_3_1.mdx index 7f811c4a3fc4..c6650fa74ed0 100644 --- a/website/content/terminal/changelog/version2_3_1.mdx +++ b/website/content/terminal/changelog/version2_3_1.mdx @@ -3,7 +3,7 @@ title: v2.3.1 version: "2.3.1" date: 2023-02-01 description: v2.3.1 -sidebar_position: 101 +sidebar_position: 102 --- ## Fixed diff --git a/website/content/terminal/changelog/version2_4_0.mdx b/website/content/terminal/changelog/version2_4_0.mdx index 2296a060a3b8..0bc498268b58 100644 --- a/website/content/terminal/changelog/version2_4_0.mdx +++ b/website/content/terminal/changelog/version2_4_0.mdx @@ -3,7 +3,7 @@ title: v2.4.0 version: "2.4.0" date: 2023-02-14 description: v2.4.0 -sidebar_position: 100 +sidebar_position: 101 --- ## What's new diff --git a/website/content/terminal/changelog/version2_4_1.mdx b/website/content/terminal/changelog/version2_4_1.mdx index dfa0696ac39a..96e14971c661 100644 --- a/website/content/terminal/changelog/version2_4_1.mdx +++ b/website/content/terminal/changelog/version2_4_1.mdx @@ -3,7 +3,7 @@ title: v2.4.1 version: "2.4.1" date: 2023-02-17 description: v2.4.1 -sidebar_position: 99 +sidebar_position: 100 --- ## What's new diff --git a/website/content/terminal/changelog/version2_5_0.mdx b/website/content/terminal/changelog/version2_5_0.mdx index adf11b02a15f..e3286039bdfc 100644 --- a/website/content/terminal/changelog/version2_5_0.mdx +++ b/website/content/terminal/changelog/version2_5_0.mdx @@ -3,7 +3,7 @@ title: v2.5.0 version: "2.5.0" date: 2023-03-01 description: v2.5.0 -sidebar_position: 98 +sidebar_position: 99 --- diff --git a/website/content/terminal/changelog/version2_5_1.mdx b/website/content/terminal/changelog/version2_5_1.mdx index 2a52912bda0e..a9432be7fcb5 100644 --- a/website/content/terminal/changelog/version2_5_1.mdx +++ b/website/content/terminal/changelog/version2_5_1.mdx @@ -3,7 +3,7 @@ title: 2.5.1 version: "2.5.1" date: 2023-03-01 description: Current - v2.5.1 -sidebar_position: 97 +sidebar_position: 98 --- ## Fixed diff --git a/website/content/terminal/changelog/version3_0_0.mdx b/website/content/terminal/changelog/version3_0_0.mdx index a9bdddeafaff..1e29bcf9a6dd 100644 --- a/website/content/terminal/changelog/version3_0_0.mdx +++ b/website/content/terminal/changelog/version3_0_0.mdx @@ -3,7 +3,7 @@ title: v3.0.0 version: "3.0.0" date: 2023-04-25 description: v3.0.0 -sidebar_position: 96 +sidebar_position: 97 --- ## What's new diff --git a/website/content/terminal/changelog/version3_0_1.mdx b/website/content/terminal/changelog/version3_0_1.mdx index c800ffe2d9fe..a73160064712 100644 --- a/website/content/terminal/changelog/version3_0_1.mdx +++ b/website/content/terminal/changelog/version3_0_1.mdx @@ -3,7 +3,7 @@ title: v3.0.1 version: "3.0.1" date: 2023-05-15 description: v3.0.1 -sidebar_position: 95 +sidebar_position: 96 --- ## Thank you and welcome to our new contributors 🔥 diff --git a/website/content/terminal/changelog/version3_1_0.mdx b/website/content/terminal/changelog/version3_1_0.mdx index 8c7583c94959..3a2dbf8462ec 100644 --- a/website/content/terminal/changelog/version3_1_0.mdx +++ b/website/content/terminal/changelog/version3_1_0.mdx @@ -3,7 +3,7 @@ title: v3.1.0 version: "3.1.0" date: 2023-06-21 description: v3.1.0 -sidebar_position: 94 +sidebar_position: 95 --- ## Thank you and welcome to our new contributors 🔥 diff --git a/website/content/terminal/changelog/version3_2_0.mdx b/website/content/terminal/changelog/version3_2_0.mdx index 17acdec80423..8764d03c5382 100644 --- a/website/content/terminal/changelog/version3_2_0.mdx +++ b/website/content/terminal/changelog/version3_2_0.mdx @@ -3,7 +3,7 @@ title: v3.2.0 version: "3.2.0" date: 2023-07-21 description: Current - v3.2.0 -sidebar_position: 93 +sidebar_position: 94 --- ## Thank you and welcome to our new contributors 🔥 diff --git a/website/content/terminal/changelog/version3_2_1.mdx b/website/content/terminal/changelog/version3_2_1.mdx index bb270b77b770..3a3dfdbb6842 100644 --- a/website/content/terminal/changelog/version3_2_1.mdx +++ b/website/content/terminal/changelog/version3_2_1.mdx @@ -1,9 +1,9 @@ --- -title: Current - v3.2.1 +title: v3.2.1 version: "3.2.1" date: 2023-08-16 -description: Current - v3.2.1 -sidebar_position: 92 +description: v3.2.1 +sidebar_position: 93 --- ## What's new 🎉 diff --git a/website/content/terminal/changelog/version_3_2_2.mdx b/website/content/terminal/changelog/version_3_2_2.mdx new file mode 100644 index 000000000000..065cebd18bc9 --- /dev/null +++ b/website/content/terminal/changelog/version_3_2_2.mdx @@ -0,0 +1,7 @@ +--- +title: Current - v3.2.2 +version: "3.2.2" +date: 2023-08-29 +description: Current - v3.2.2 +sidebar_position: 92 +--- From f7d2d4073b3055b770546fb86325564350005781 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Mon, 28 Aug 2023 17:05:26 -0400 Subject: [PATCH 9/9] changes --- .../terminal/changelog/version_3_2_2.mdx | 46 ++++++++++++++++--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/website/content/terminal/changelog/version_3_2_2.mdx b/website/content/terminal/changelog/version_3_2_2.mdx index 065cebd18bc9..36a2e2f02198 100644 --- a/website/content/terminal/changelog/version_3_2_2.mdx +++ b/website/content/terminal/changelog/version_3_2_2.mdx @@ -1,7 +1,39 @@ ---- -title: Current - v3.2.2 -version: "3.2.2" -date: 2023-08-29 -description: Current - v3.2.2 -sidebar_position: 92 ---- +## Thank you and welcome to our new contributors 🔥 +@Define101 and @kulbinderdio + +## What's new 🎉 + +We are excited to launch an implementation of TimeGPT from nixtla! + +As per usual, we are also including some general bug fixes, enhancements and documentations. We have also deprecated some crypto functions that have not been returning data from their API. + +## What's changed 🚀 +* update defillama_dapps json file (#5380) @Define101 +* Allow to execute reports url from reports menu (#5385) @DidierRLopes +* Feature/companies house (#4721) @kulbinderdio +* Hotfix - PyWry fix python 3.11 fail on boot, copy+paste on MacOS (#5384) @tehcoderer +* Change bootup message (#5378) @jmaslek +* Add example notebook for building volume-at-price chart. (#5370) @deeleeramone +* Fix foreach on routine where the inputs provided are not valid (#5373) @DidierRLopes +* 1st integration with TimeGPT-1 (Beta), from Nixtla (#5292) @DidierRLopes +* Removed prints (#5367) @colin99d +* Some error handling (#5357) @colin99d +* Improves the `settings/userdata` command, and upgrade ruff (#5359) @colin99d +* bye bye shroom (#5351) @colin99d +* hotfix / Allow routine args inside lists (#5353) @tehcoderer +* Fix the CPI CSV and remove twitter functionalities (#5350) @jmaslek +* Thegraph totally changed, I removed the endpoints (#5349) @colin99d +* Adds example notebook for installing in Google Colab (#5333) @deeleeramone +* Improve documentation (#5345) @colin99d +* Fixes #5332 (#5344) @colin99d +* hotfix/fix-stocks-search-sdk3: Fixes the stocks search so that it doesn't `print_rich_table()` for SDK. (#5329) @deeleeramone +* Fixed URL for uploading to the hub (#5340) @colin99d +* Fixed the request function (#5336) @colin99d +* Release/3.2.1 (#5335) @jmaslek + +We are proud of our community contributors and staunch supporters of open-source ecosystems. +Help us promote our community by tagging `@openbb_finance` on Twitter with a link to your pull request, +and join our Discord server to chat about your contribution! We want to hear about your experience! + +### Links 🦋 +[Website](https://openbb.co/), [Twitter](https://twitter.com/openbb_finance), [Linkedin](https://www.linkedin.com/company/openbb-finance), [Instagram](https://www.instagram.com/openbb.finance/), [Reddit](https://www.reddit.com/r/openbb/), [Discord](https://discord.com/invite/xPHTuHCmuV)