mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
remove twitter functions and all references to it
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
||||
3
openbb_terminal/core/sdk/trail_map.csv
vendored
3
openbb_terminal/core/sdk/trail_map.csv
vendored
@@ -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,
|
||||
|
||||
|
@@ -577,52 +577,6 @@ class KeysController(BaseController): # pylint: disable=too-many-public-methods
|
||||
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"""
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -65,24 +65,6 @@
|
||||
"link": "https://polygon.io",
|
||||
"markdown": "Go to: https://polygon.io\n\n\n\nClick on, \"Get your Free API Key\".\n\n\n\nAfter signing up, the API Key is found at the bottom of the account dashboard page.\n\n"
|
||||
},
|
||||
{
|
||||
"name": "API_TWITTER_KEY",
|
||||
"source": "Twitter key",
|
||||
"link": "https://developer.twitter.com",
|
||||
"markdown": ""
|
||||
},
|
||||
{
|
||||
"name": "API_TWITTER_SECRET_KEY",
|
||||
"source": "Twitter secret",
|
||||
"link": "https://developer.twitter.com",
|
||||
"markdown": ""
|
||||
},
|
||||
{
|
||||
"name": "API_TWITTER_BEARER_TOKEN",
|
||||
"source": "Twitter token",
|
||||
"link": "https://developer.twitter.com",
|
||||
"markdown": ""
|
||||
},
|
||||
{
|
||||
"name": "API_FRED_KEY",
|
||||
"source": "FRED",
|
||||
|
||||
@@ -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": ""
|
||||
}
|
||||
|
||||
@@ -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
|
||||
"""
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user