summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Maslek <jmaslek11@gmail.com>2023-08-11 11:42:47 -0400
committerJames Maslek <jmaslek11@gmail.com>2023-08-18 12:45:09 -0400
commit393db2f3dfd39e17d562d69d6f0bd1056aa206fb (patch)
tree021ad7be229afae00001d60d4967263e21e7354b
parent6502a358dbb29f66bb6ec5a26d87085674da0101 (diff)
remove twitter functions and all references to it
-rw-r--r--openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py4
-rw-r--r--openbb_terminal/core/sdk/models/keys_sdk_model.py2
-rw-r--r--openbb_terminal/core/sdk/models/stocks_sdk_model.py8
-rw-r--r--openbb_terminal/core/sdk/sdk_init.py2
-rw-r--r--openbb_terminal/core/sdk/trail_map.csv3
-rw-r--r--openbb_terminal/keys_controller.py46
-rw-r--r--openbb_terminal/keys_model.py94
-rw-r--r--openbb_terminal/miscellaneous/models/all_api_keys.json18
-rw-r--r--openbb_terminal/miscellaneous/models/hub_credentials.json3
-rw-r--r--openbb_terminal/sdk.py1
-rw-r--r--tests/openbb_terminal/test_keys_controller.py6
-rw-r--r--tests/openbb_terminal/test_keys_model.py28
-rw-r--r--website/content/terminal/usage/guides/api-keys.md2
13 files changed, 1 insertions, 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 676362d2e6e..4ddbb03f5a6 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 @@ class StocksController(model.StocksRoot):
`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 StocksController(model.StocksRoot):
`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 0572e6d3ded..0ccee257bd4 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 @@ class KeysRoot(Category):
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 f0e4c74c4ac..193caf164e9 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 @@ class StocksBehavioralAnalysis(Category):
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 @@ class StocksBehavioralAnalysis(Category):
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 571269da415..0068ea5bd19 100644
--- a/openbb_terminal/core/sdk/sdk_init.py
+++ b/openbb_terminal/core/sdk/sdk_init.py
@@ -121,8 +121,6 @@ from openbb_terminal.common.behavioural_analysis import (
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 a7e369182cd..1581bb113e9 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 69c94595a53..976475b934a 100644
--- a/openbb_terminal/keys_controller.py
+++ b/openbb_terminal/keys_controller.py
@@ -578,52 +578,6 @@ class KeysController(BaseController): # pylint: disable=too-many-public-methods
)
@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"""
parser = argparse.ArgumentParser(
diff --git a/openbb_terminal/keys_model.py b/openbb_terminal/keys_model.py
index 12d6347f604..ba8937714d2 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 d9abe8d6dc9..cac66c9c54e 100644
--- a/openbb_terminal/miscellaneous/models/all_api_keys.json
+++ b/openbb_terminal/miscellaneous/models/all_api_keys.json
@@ -66,24 +66,6 @@
"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",
"link": "https://fred.stlouisfed.org/docs/api/api_key.html",
diff --git a/openbb_terminal/miscellaneous/models/hub_credentials.json b/openbb_terminal/miscellaneous/models/hub_credentials.json
index c0275c172bb..2370ee7b71d 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 73165a28464..1990c434c1e 100644
--- a/openbb_terminal/sdk.py
+++ b/openbb_terminal/sdk.py
@@ -438,7 +438,6 @@ class OpenBBSDK:
`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 10c2de4d5cf..8af59ae4f4d 100644
--- a/tests/openbb_terminal/test_keys_controller.py
+++ b/tests/openbb_terminal/test_keys_controller.py
@@ -149,12 +149,6 @@ def test_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):
controller.call_rh(other)
diff --git a/tests/openbb_terminal/test_keys_model.py b/tests/openbb_terminal/test_keys_model.py
index 7d230a13c20..f5b2883e3dd 100644
--- a/tests/openbb_terminal/test_keys_model.py
+++ b/tests/openbb_terminal/test_keys_model.py
@@ -372,34 +372,6 @@ def test_set_bitquery_key(args: List[str], persist: bool, show_output: bool, moc
"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",
- [
- (
["test_username", "test_password"],
False,
True,
diff --git a/website/content/terminal/usage/guides/api-keys.md b/website/content/terminal/usage/guides/api-keys.md
index d15f8792fd5..30f712e3cb8 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';