@@ -88,7 +88,14 @@ def render_macro_performance(port_a, returns, market):
8888 if not bench_returns .eq (0 ).all ():
8989 fig1 .add_trace (go .Scatter (x = bench_cum .index , y = bench_cum .values , mode = 'lines' , name = f'Benchmark ({ market_col } )' , line = dict (color = 'orange' , width = 2 )))
9090
91- fig1 .update_layout (title = "Cumulative Returns on Log Scale" , yaxis_type = "log" , yaxis_title = "Cumulative Return (Log)" , xaxis_title = "Date" , template = "plotly_white" )
91+ fig1 .update_layout (
92+ title = "Cumulative Returns on Log Scale" ,
93+ yaxis_type = "log" ,
94+ yaxis_title = "Cumulative Return (Log)" ,
95+ xaxis_title = "Date" ,
96+ template = "plotly_white" ,
97+ legend_title_text = "Legend"
98+ )
9299 st .plotly_chart (fig1 , use_container_width = True )
93100
94101 # 2. Underwater Plot
@@ -140,6 +147,12 @@ def render_micro_execution(exec_a):
140147 x = 'MAE' ,
141148 y = 'MFE' ,
142149 color = 'Is_Profitable_Intraday' ,
150+ labels = {
151+ '证券代码' : 'Instrument' ,
152+ '成交日期' : 'Date' ,
153+ '成交价格' : 'Execution Price' ,
154+ 'Is_Profitable_Intraday' : 'Status'
155+ },
143156 hover_data = ['证券代码' , '成交日期' , '成交价格' , 'Trade_Type' ],
144157 title = "MFE vs. MAE Scatter (Intraday Path Dependency)" ,
145158 color_discrete_map = {'Profitable' : 'green' , 'Loss' : 'red' }
@@ -302,7 +315,11 @@ def top1_conc(g):
302315 fig1 .add_trace (go .Scatter (x = daily_count .index , y = daily_count .values , name = "Holdings Count" , mode = "lines" , line = dict (color = "blue" )), secondary_y = False )
303316 fig1 .add_trace (go .Scatter (x = concentration .index , y = concentration .values , name = "Top1 Concentration" , mode = "lines" , line = dict (color = "red" )), secondary_y = True )
304317
305- fig1 .update_layout (title = "Holdings Count & Concentration Over Time" , template = "plotly_white" )
318+ fig1 .update_layout (
319+ title = "Holdings Count & Concentration Over Time" ,
320+ template = "plotly_white" ,
321+ legend_title_text = "Metric"
322+ )
306323 fig1 .update_yaxes (title_text = "Count" , secondary_y = False )
307324 fig1 .update_yaxes (title_text = "Concentration" , tickformat = ".1%" , secondary_y = True )
308325 st .plotly_chart (fig1 , use_container_width = True )
0 commit comments