mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-12-01 13:44:16 +00:00
Fix black
This commit is contained in:
@@ -74,7 +74,7 @@ class ComparisonAnalysisController:
|
||||
|
||||
if self.similar:
|
||||
print(f"[{self.user}] Similar Companies: {', '.join(self.similar)}")
|
||||
#else:
|
||||
# else:
|
||||
# print(f"No similar companies [{self.user}]")
|
||||
|
||||
print("\nComparison Analysis Mode:")
|
||||
@@ -117,7 +117,7 @@ class ComparisonAnalysisController:
|
||||
# If polygon source not selected, the user may want to get
|
||||
# similar companies based on Industry and Sector only, and not
|
||||
# on the fact that they are based on the same country
|
||||
if '-p' not in other_args and '--polygon' not in other_args:
|
||||
if "-p" not in other_args and "--polygon" not in other_args:
|
||||
parser.add_argument(
|
||||
"--nocountry",
|
||||
action="store_true",
|
||||
@@ -144,20 +144,26 @@ class ComparisonAnalysisController:
|
||||
|
||||
else:
|
||||
if ns_parser.b_no_country:
|
||||
compare_list = ['Sector', 'Industry']
|
||||
compare_list = ["Sector", "Industry"]
|
||||
else:
|
||||
compare_list = ['Sector', 'Industry', 'Country']
|
||||
compare_list = ["Sector", "Industry", "Country"]
|
||||
|
||||
self.similar = Overview().compare(self.ticker, compare_list, verbose=0)['Ticker'].to_list()
|
||||
self.similar = (
|
||||
Overview()
|
||||
.compare(self.ticker, compare_list, verbose=0)["Ticker"]
|
||||
.to_list()
|
||||
)
|
||||
self.user = "Finviz"
|
||||
|
||||
if self.similar:
|
||||
print(f"\n[{self.user}] Similar Companies: {', '.join(self.similar)}")
|
||||
|
||||
if len(self.similar) > 10:
|
||||
print("\nThe limit of stocks to compare with are 10. Hence, the similar stocks list will be:")
|
||||
print(
|
||||
"\nThe limit of stocks to compare with are 10. Hence, the similar stocks list will be:"
|
||||
)
|
||||
self.similar = self.similar[:10]
|
||||
print(', '.join(self.similar))
|
||||
print(", ".join(self.similar))
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
@@ -81,7 +81,9 @@ def historical(l_args, df_stock, s_ticker, s_start, s_interval, similar):
|
||||
|
||||
plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
plt.title(f"Similar companies to {s_ticker}")
|
||||
df_stock = yf.download(s_ticker, start=s_start, progress=False, threads=False)
|
||||
df_stock = yf.download(
|
||||
s_ticker, start=s_start, progress=False, threads=False
|
||||
)
|
||||
plt.plot(
|
||||
df_stock.index, df_stock[d_candle_types[ns_parser.type_candle]].values
|
||||
)
|
||||
@@ -95,11 +97,15 @@ def historical(l_args, df_stock, s_ticker, s_start, s_interval, similar):
|
||||
l_parsed_stocks = list()
|
||||
for symbol in l_stocks:
|
||||
try:
|
||||
df_similar_stock = yf.download(symbol, start=s_start, progress=False, threads=False)
|
||||
df_similar_stock = yf.download(
|
||||
symbol, start=s_start, progress=False, threads=False
|
||||
)
|
||||
if not df_similar_stock.empty:
|
||||
plt.plot(
|
||||
df_similar_stock.index,
|
||||
df_similar_stock[d_candle_types[ns_parser.type_candle]].values,
|
||||
df_similar_stock[
|
||||
d_candle_types[ns_parser.type_candle]
|
||||
].values,
|
||||
)
|
||||
l_min.append(df_similar_stock.index[0])
|
||||
l_leg.append(symbol)
|
||||
|
||||
Reference in New Issue
Block a user