mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
fix Finviz screener Perf 1Y returning as 1970-01-01
This commit is contained in:
@@ -79,6 +79,7 @@ def get_comparison_data(similar: List[str], data_type: str = "overview"):
|
||||
screen = ownership.Ownership()
|
||||
elif data_type == "performance":
|
||||
screen = performance.Performance()
|
||||
|
||||
elif data_type == "technical":
|
||||
screen = technical.Technical()
|
||||
else:
|
||||
@@ -87,7 +88,21 @@ def get_comparison_data(similar: List[str], data_type: str = "overview"):
|
||||
|
||||
screen.set_filter(ticker=",".join(similar))
|
||||
try:
|
||||
return screen.screener_view(verbose=0)
|
||||
screen_df = screen.screener_view(verbose=0)
|
||||
screen_df.columns = screen_df.columns.str.strip()
|
||||
screen_df = screen_df.rename(
|
||||
columns={
|
||||
"Perf Week": "1W",
|
||||
"Perf Month": "1M",
|
||||
"Perf Quart": "3M",
|
||||
"Perf Half": "6M",
|
||||
"Perf Year": "1Y",
|
||||
"Perf YTD": "YTD",
|
||||
"Volatility W": "1W Volatility",
|
||||
"Volatility M": "1M Volatility",
|
||||
}
|
||||
)
|
||||
return screen_df
|
||||
except IndexError:
|
||||
console.print("[red]Invalid data from website[red]\n")
|
||||
return pd.DataFrame()
|
||||
|
||||
@@ -191,6 +191,20 @@ def get_screener_data(
|
||||
df_screen.columns = [val.strip("\n") for val in df_screen.columns]
|
||||
if "Company" in df_screen.columns:
|
||||
df_screen["Company"] = df_screen["Company"].str.replace(",", "")
|
||||
df_screen.columns = df_screen.columns.str.strip()
|
||||
if data_type == "performance":
|
||||
df_screen = df_screen.rename(
|
||||
columns={
|
||||
"Perf Week": "1W",
|
||||
"Perf Month": "1M",
|
||||
"Perf Quart": "3M",
|
||||
"Perf Half": "6M",
|
||||
"Perf Year": "1Y",
|
||||
"Perf YTD": "YTD",
|
||||
"Volatility W": "1W Volatility",
|
||||
"Volatility M": "1M Volatility",
|
||||
}
|
||||
)
|
||||
|
||||
return df_screen
|
||||
|
||||
|
||||
@@ -90,14 +90,14 @@ d_cols_to_sort = {
|
||||
],
|
||||
"performance": [
|
||||
"Ticker",
|
||||
"Perf Week",
|
||||
"Perf Month",
|
||||
"Perf Quart",
|
||||
"Perf Half",
|
||||
"Perf Year",
|
||||
"Perf YTD",
|
||||
"Volatility W",
|
||||
"Volatility M",
|
||||
"1W",
|
||||
"1M",
|
||||
"3M",
|
||||
"6M",
|
||||
"1Y",
|
||||
"YTD",
|
||||
"1W Volatility",
|
||||
"1M Volatility",
|
||||
"Recom",
|
||||
"Avg Volume",
|
||||
"Rel Volume",
|
||||
|
||||
@@ -540,7 +540,7 @@ class ScreenerController(BaseController):
|
||||
choices=screener_helper.finviz_choices("performance"),
|
||||
type=str.lower,
|
||||
dest="sort",
|
||||
default="perfytd",
|
||||
default="ytd",
|
||||
metavar="SORTBY",
|
||||
help="Sort elements of the table.",
|
||||
)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
,Ticker,Perf Week,Perf Month,Perf Quart,Perf Half,Perf Year,Perf YTD,Volatility W,Volatility M,Recom,Avg Volume,Rel Volume,Price,Change,Volume
|
||||
,Ticker,1W,1M,3M,6M,1Y,YTD,1W Volatility,1M Volatility,Recom,Avg Volume,Rel Volume,Price,Change,Volume
|
||||
0,GM,-0.07769999999999999,-0.002,0.051100000000000007,0.0063,-0.3714,0.0508,0.0255,0.0277,2.2,13360000.0,0.0,35.35,0.0,0.0
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
,Ticker,Perf Week,Perf Month,Perf Quart,Perf Half,Perf Year,Perf YTD,Volatility W,Volatility M,Recom,Avg Volume,Rel Volume,Price,Change,Volume
|
||||
,Ticker,1W,1M,3M,6M,1Y,YTD,1W Volatility,1M Volatility,Recom,Avg Volume,Rel Volume,Price,Change,Volume
|
||||
0,CDIO,2.1081,2.3173,0.725,-0.6526000000000001,,2.2547,0.1937,0.2682,2.0,2130000.0,194.21,3.45,1.5847,100099160.0
|
||||
1,LION,1.2992,0.4106,0.44549999999999995,0.46880000000000005,,0.4328,0.6442,0.2623,,65860.0,13.79,14.6,1.0563,739802.0
|
||||
2,CHS,0.1783,0.1079,-0.0496,-0.0987,0.1711,0.16870000000000002,0.0602,0.0466,3.0,2420000.0,2.87,5.75,0.1616,6759202.0
|
||||
|
||||
|
Reference in New Issue
Block a user