Robert Castagna commited on
Commit
d37ba5b
·
1 Parent(s): 6f3b36e

added more data checks for fundamentals

Browse files
Files changed (1) hide show
  1. pages/1_Fundamentals.py +6 -6
pages/1_Fundamentals.py CHANGED
@@ -124,12 +124,12 @@ with st.form(key="selecting columns"):
124
  metric_data, annual_series_data, quarterly_series_data = get_company_metrics(ticker)
125
 
126
  # reformat all JSON returns to be flattened dictionaries
127
- roe_dict = {'roe': annual_series_data['roe'][0]['v'] if 'roe' in annual_series_data else 0}
128
- eps_dict = {'eps' :annual_series_data['eps'][0]['v'] if 'eps' in annual_series_data else 0}
129
- pe_dict = {'pe': annual_series_data['pe'][0]['v'] if 'pe' in annual_series_data else 0}
130
- ps_dict = {'ps': annual_series_data['ps'][0]['v'] if 0 in annual_series_data['ps'] else 0}
131
- pb_dict = {'pb': annual_series_data['pb'][0]['v'] if 'pb' in annual_series_data else 0}
132
- pfcf_dict = {'pfcf': annual_series_data['pfcf'][0]['v'] if 'pfcf' in annual_series_data else 0}
133
 
134
  # merge all dictionary keys per ticker
135
  combined_info = basic_info.copy() # Make a copy of the basic info
 
124
  metric_data, annual_series_data, quarterly_series_data = get_company_metrics(ticker)
125
 
126
  # reformat all JSON returns to be flattened dictionaries
127
+ roe_dict = {'roe': annual_series_data['roe'][0]['v']*100 if ('roe' in annual_series_data) and (len(annual_series_data['roe'])>1) and ('v' in annual_series_data['roe'][0]) else 0}
128
+ eps_dict = {'eps' :annual_series_data['eps'][0]['v'] if ('eps' in annual_series_data) and (len(annual_series_data['eps'])>1) and ('v' in annual_series_data['eps'][0]) else 0}
129
+ pe_dict = {'pe': annual_series_data['pe'][0]['v'] if ('pe' in annual_series_data) and (len(annual_series_data['pe'])>1) and ('v' in annual_series_data['pe'][0]) else 0}
130
+ ps_dict = {'ps': annual_series_data['ps'][0]['v'] if ('ps' in annual_series_data) and (len(annual_series_data['ps'])>1) and ('v' in annual_series_data['ps'][0]) else 0}
131
+ pb_dict = {'pb': annual_series_data['pb'][0]['v'] if ('pb' in annual_series_data) and (len(annual_series_data['pb'])>1) and ('v' in annual_series_data['pb'][0]) else 0}
132
+ pfcf_dict = {'pfcf': annual_series_data['pfcf'][0]['v'] if ('pfcf' in annual_series_data) and (len(annual_series_data['pfcf'])>1) and ('v' in annual_series_data['pfcf'][0]) else 0}
133
 
134
  # merge all dictionary keys per ticker
135
  combined_info = basic_info.copy() # Make a copy of the basic info