Merge pull request #4332 from OpenBB-finance/hotfix/issue4212

Remove yfinance from news
This commit is contained in:
montezdesousa
2023-02-27 18:07:44 +00:00
committed by GitHub
2 changed files with 2 additions and 19 deletions

View File

@@ -8,7 +8,6 @@ from datetime import datetime, timedelta
from typing import List, Optional
import financedatabase as fd
import yfinance as yf
from openbb_terminal import feature_flags as obbff
from openbb_terminal.common import feedparser_view, newsapi_view
@@ -550,15 +549,9 @@ class StocksController(StockBaseController):
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if self.ticker:
try:
d_stock = yf.Ticker(self.ticker).info
except TypeError:
d_stock = dict()
if ns_parser.source == "NewsApi":
newsapi_view.display_news(
query=d_stock["shortName"].replace(" ", "+")
if "shortName" in d_stock
else self.ticker,
query=self.ticker,
limit=ns_parser.limit,
start_date=ns_parser.n_start_date.strftime("%Y-%m-%d"),
show_newest=ns_parser.n_oldest,
@@ -566,9 +559,7 @@ class StocksController(StockBaseController):
)
elif ns_parser.source == "Feedparser":
feedparser_view.display_news(
term=d_stock["shortName"].replace(" ", "+")
if "shortName" in d_stock
else self.ticker,
term=self.ticker,
sources=ns_parser.sources,
limit=ns_parser.limit,
export=ns_parser.export,

View File

@@ -436,14 +436,6 @@ def test_call_func(
)
# MOCK TICKER + INFO
mocker.patch(
target=f"{path_controller}.yf.Ticker",
)
mocker.patch(
target=f"{path_controller}.yf.Ticker.info",
return_value={"shortName": "MOCK_SHORT_NAME"},
)
if mocked_func:
mock = mocker.Mock()
mocker.patch(