* Fixes #3400

* #3996

* #3313

* #3140
This commit is contained in:
James Maslek
2022-11-15 04:48:33 -05:00
committed by GitHub
parent 64899696ea
commit e3cd8bdc0e
6 changed files with 17 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ __docformat__ = "numpy"
import logging
from ast import literal_eval
import webbrowser
from typing import List
import pandas as pd
import requests
@@ -57,7 +58,7 @@ def get_performance_map(period: str = "1d", map_filter: str = "sp500"):
@log_start_end(log=logger)
def get_groups() -> list:
def get_groups() -> List[str]:
"""Get group available"""
return list(GROUPS.keys())

View File

@@ -9,7 +9,6 @@ from PIL import Image
from openbb_terminal.decorators import log_start_end
from openbb_terminal.economy import finviz_model
from openbb_terminal.helper_funcs import export_data, print_rich_table
from openbb_terminal.rich_config import console
logger = logging.getLogger(__name__)
@@ -120,7 +119,6 @@ def display_spectrum(group: str = "sector", export: str = ""):
Format to export data
"""
finviz_model.get_spectrum_data(group)
console.print("")
group = finviz_model.GROUPS[group]
img = Image.open(group + ".jpg")

View File

@@ -26,19 +26,19 @@ def etf_movers(sort_type: str = "gainers", export: bool = False) -> pd.DataFrame
Datafame containing the name, price, change and the volume of the etf
"""
if sort_type == "gainers":
if sort_type.lower() == "gainers":
url = (
"https://www.wsj.com/market-data/mutualfunds-etfs/etfmovers?id=%7B%22application"
"%22%3A%22WSJ%22%2C%22etfMover%22%3A%22leaders%22%2C%22count%22%3A25%7D&type="
"mdc_etfmovers"
)
elif sort_type == "decliners":
elif sort_type.lower() == "decliners":
url = (
"https://www.wsj.com/market-data/mutualfunds-etfs/etfmovers?id=%7B%22application"
"%22%3A%22WSJ%22%2C%22etfMover%22%3A%22laggards%22%2C%22count%22%3A25%7D&type="
"mdc_etfmovers"
)
elif sort_type == "active":
elif sort_type.lower() == "active":
url = (
"https://www.wsj.com/market-data/mutualfunds-etfs/etfmovers?id=%7B%22application"
"%22%3A%22WSJ%22%2C%22etfMover%22%3A%22most_active%22%2C%22count%22%3A25%7D&type="

View File

@@ -151,21 +151,25 @@ def load(
if source == "AlphaVantage":
if "min" in interval:
resolution = "i"
return av_model.get_historical(
df = av_model.get_historical(
to_symbol=to_symbol,
from_symbol=from_symbol,
resolution=resolution,
interval=clean_interval,
start_date=start_date,
)
df.index.name = "date"
return df
if source == "YahooFinance":
return yf.download(
df = yf.download(
f"{from_symbol}{to_symbol}=X",
start=datetime.strptime(start_date, "%Y-%m-%d"),
interval=clean_interval,
progress=verbose,
)
df.index.name = "date"
return df
if source == "Polygon":
# Interval for polygon gets broken into multiplier and timeframe
@@ -174,12 +178,14 @@ def load(
timeframe = temp[2]
if timeframe == "min":
timeframe = "minute"
return polygon_model.get_historical(
df = polygon_model.get_historical(
f"{from_symbol}{to_symbol}",
multiplier=multiplier,
timespan=timeframe,
from_date=start_date,
)
df.index.name = "date"
return df
console.print(f"Source {source} not supported")
return pd.DataFrame()

View File

@@ -567,3 +567,4 @@ keys.shroom,openbb_terminal.keys_model.set_shroom_key,
futures.search,openbb_terminal.futures.yfinance_model.get_search_futures,openbb_terminal.futures.yfinance_view.display_search
futures.historical,openbb_terminal.futures.yfinance_model.get_historical_futures,openbb_terminal.futures.yfinance_view.display_historical
futures.curve,openbb_terminal.futures.yfinance_model.get_curve_futures,openbb_terminal.futures.yfinance_view.display_curve
economy.get_groups,openbb_terminal.economy.finviz_model.get_groups
Can't render this file because it has a wrong number of fields in line 570.

View File

@@ -85,12 +85,8 @@ def price_target_from_analysts(
if start_date:
df_analyst_data = df_analyst_data[start_date:] # type: ignore
if "Adj Close" in data:
plot_column = "Adj Close"
legend_price_label = "Adjust Close"
else:
plot_column = "Close"
legend_price_label = "Close"
plot_column = "Close"
legend_price_label = "Close"
ax.plot(data.index, data[plot_column].values)
@@ -118,8 +114,6 @@ def price_target_from_analysts(
if not external_axes:
theme.visualize_output()
console.print("")
export_data(
export,
os.path.dirname(os.path.abspath(__file__)),