@@ -104,55 +104,59 @@ def render_overview(financial_data):
104
104
105
105
with ratios_summary :
106
106
st .markdown ("#### Price and Market Data" )
107
+ properties_text = [
108
+ "Previous Close" ,
109
+ "Open" ,
110
+ "Day High" ,
111
+ "Day Low" ,
112
+ "Volume" ,
113
+ "Market Cap" ,
114
+ "Beta" ,
115
+ "PE Ratio" ,
116
+ "EPS" ,
117
+ "Forward Dividend & Yield" ,
118
+ ]
119
+ values_text = [
120
+ f"**{ quotes ['previousClose' ]:,} **" ,
121
+ f"**{ quotes ['open' ]:,} **" ,
122
+ f"**{ quotes ['dayHigh' ]:,} **" ,
123
+ f"**{ quotes ['dayLow' ]:,} **" ,
124
+ f"**{ quotes ['volume' ]:,} **" ,
125
+ f"**{ quotes ['marketCap' ]:,} **" ,
126
+ f"**{ quotes ['beta' ]:.3} **" ,
127
+ f"**{ quotes ['trailingPE' ]:.4} **" ,
128
+ f"**{ quotes ['trailingEps' ]:.3} **" ,
129
+ (
130
+ f"**{ quotes ['dividendRate' ]:.2} ({ quotes ['dividendYield' ] * 100 :.2} %)**"
131
+ if "dividendRate" in quotes
132
+ else "0"
133
+ ),
134
+ ]
107
135
properties , values = st .columns (2 )
108
136
with properties :
109
- st .write ("Previous Close" )
110
- st .write ("Open" )
111
- st .write ("Day High" )
112
- st .write ("Day Low" )
113
- st .write ("Volume" )
114
- st .write ("Market Cap" )
115
- st .write ("Beta" )
116
- st .write ("PE Ratio" )
117
- st .write ("EPS" )
118
- st .write ("Forward Dividend & Yield" )
137
+ for content in properties_text :
138
+ st .write (content )
119
139
120
140
with values :
121
- st .write (f" **{ quotes ['previousClose' ]:,} **" )
122
- st .write (f" **{ quotes ['open' ]:,} **" )
123
- st .write (f" **{ quotes ['dayHigh' ]:,} **" )
124
- st .write (f" **{ quotes ['dayLow' ]:,} **" )
125
- st .write (f" **{ quotes ['volume' ]:,} **" )
126
- st .write (f" **{ quotes ['marketCap' ]:,} **" )
127
- st .write (f" **{ quotes ['beta' ]:.3} **" )
128
- st .write (f" **{ quotes ['trailingPE' ]:.4} **" )
129
- st .write (f" **{ quotes ['trailingEps' ]:.3} **" )
130
- dividend_rate = (
131
- quotes ["dividendRate" ] if "dividendRate" in quotes .keys () else "0"
132
- )
133
- dividend_yield = (
134
- quotes ["dividendYield" ] * 100
135
- if "dividendRate" in quotes .keys ()
136
- else "0"
137
- )
138
- st .write (f" **{ dividend_rate :.2} ({ dividend_yield :.2} %)**" )
141
+ for content in values_text :
142
+ st .write (content )
139
143
140
144
with st .container ():
141
145
st .markdown ("#### Company Profile" )
142
146
st .write (quotes ["longBusinessSummary" ])
143
147
144
- sector_name = quotes ["sector" ]
145
148
sector_key = quotes ["sectorKey" ].lower ()
146
- sector_url = f"https://finance.yahoo.com/sectors/{ sector_key } "
147
- sector_content = apply_tag_style (sector_url , sector_name )
149
+ sector_content = apply_tag_style (
150
+ f"https://finance.yahoo.com/sectors/{ sector_key } " , quotes ["sector" ]
151
+ )
148
152
149
- industry_name = quotes ["industry" ]
150
153
industry_key = quotes ["industryKey" ].lower ()
151
- industry_url = f"https://finance.yahoo.com/sectors/{ sector_key } /{ industry_key } "
152
- industry_content = apply_tag_style (industry_url , industry_name )
154
+ industry_content = apply_tag_style (
155
+ f"https://finance.yahoo.com/sectors/{ sector_key } /{ industry_key } " ,
156
+ quotes ["industry" ],
157
+ )
153
158
154
- company_website = quotes ["website" ]
155
- website_content = apply_tag_style (company_website , "Website" )
159
+ website_content = apply_tag_style (quotes ["website" ], "Website" )
156
160
157
161
st .markdown (
158
162
f"""
0 commit comments