petertulip86 commited on
Commit
a9d35b2
·
verified ·
1 Parent(s): d88771d

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +21 -0
src/streamlit_app.py CHANGED
@@ -1224,6 +1224,27 @@ if analyze_button or st.session_state.get('has_analyzed', False):
1224
  """, unsafe_allow_html=True)
1225
 
1226
  with metrics_cols[3]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1227
  def plot_radar_comparison(stock_data):
1228
  """繪製雷達圖比較股票表現"""
1229
  if not stock_data or len(stock_data) < 2:
 
1224
  """, unsafe_allow_html=True)
1225
 
1226
  with metrics_cols[3]:
1227
+ st.markdown(f"""
1228
+ <div class="metric-card">
1229
+ <div class="subtitle">夏普比率</div>
1230
+ <div class="metric-value">{metrics['sharpe_ratio']:.2f}</div>
1231
+ </div>
1232
+ """, unsafe_allow_html=True)
1233
+
1234
+ with metrics_cols[4]:
1235
+ st.markdown(f"""
1236
+ <div class="metric-card">
1237
+ <div class="subtitle">最大回撤</div>
1238
+ <div class="metric-value">{metrics['max_drawdown']:.2f}%</div>
1239
+ </div>
1240
+ """, unsafe_allow_html=True)
1241
+
1242
+ # 顯示雷達圖
1243
+ st.markdown("### 雷達圖")
1244
+ plot_radar_comparison({stock_id: {'history': hist}})
1245
+
1246
+ # 顯示股價走勢圖
1247
+ st.markdown("### 股價走勢圖")
1248
  def plot_radar_comparison(stock_data):
1249
  """繪製雷達圖比較股票表現"""
1250
  if not stock_data or len(stock_data) < 2: