mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
fix empty financials from marketwatch
This commit is contained in:
@@ -73,6 +73,10 @@ def prepare_df_financials(
|
||||
a_financials_header.append(financials_header.text.strip("\n").split("\n")[0])
|
||||
|
||||
s_header_end_trend = ("5-year trend", "5- qtr trend")[quarter]
|
||||
|
||||
if s_header_end_trend not in a_financials_header:
|
||||
return pd.DataFrame()
|
||||
|
||||
df_financials = pd.DataFrame(
|
||||
columns=a_financials_header[0 : a_financials_header.index(s_header_end_trend)]
|
||||
)
|
||||
|
||||
@@ -73,7 +73,10 @@ def income(other_args: List[str], ticker: str):
|
||||
pd.set_option("display.max_colwidth", None)
|
||||
pd.set_option("display.max_rows", None)
|
||||
|
||||
print(df_financials.to_string(index=False))
|
||||
if df_financials.empty:
|
||||
print("Marketwatch does not yet provide financials for this ticker")
|
||||
else:
|
||||
print(df_financials.to_string(index=False))
|
||||
print("")
|
||||
|
||||
except Exception as e:
|
||||
@@ -155,7 +158,10 @@ def balance(other_args: List[str], ticker: str):
|
||||
pd.set_option("display.max_colwidth", None)
|
||||
pd.set_option("display.max_rows", None)
|
||||
|
||||
print(df_financials.to_string(index=False))
|
||||
if df_financials.empty:
|
||||
print("Marketwatch does not yet provide financials for this ticker")
|
||||
else:
|
||||
print(df_financials.to_string(index=False))
|
||||
print("")
|
||||
|
||||
except Exception as e:
|
||||
@@ -233,7 +239,10 @@ def cash(other_args: List[str], ticker: str):
|
||||
pd.set_option("display.max_colwidth", None)
|
||||
pd.set_option("display.max_rows", None)
|
||||
|
||||
print(df_financials.to_string(index=False))
|
||||
if df_financials.empty:
|
||||
print("Marketwatch does not yet provide financials for this ticker")
|
||||
else:
|
||||
print(df_financials.to_string(index=False))
|
||||
print("")
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user