feat(report): 全标的排名表新增进场日期列
在状态和持有天数之间插入进场日期列,显示持仓标的的连续持仓起始日期(YYYY-MM-DD格式),调出/未入选标的显示—
This commit is contained in:
@@ -1327,7 +1327,7 @@ class SimpleRotationStrategy:
|
||||
rank_map = {c: i + 1 for i, c in enumerate(ranked_all)}
|
||||
|
||||
col_labels = ["排名", "标的名称", "市场", "指数代码", "ETF代码", "仓位", "得分",
|
||||
"指数最新价", "ETF收盘价", "溢价率", "状态", "持有天数", "盈亏"]
|
||||
"指数最新价", "ETF收盘价", "溢价率", "状态", "进场日期", "持有天数", "盈亏"]
|
||||
table_data = []
|
||||
row_actions = [] # track action for coloring
|
||||
|
||||
@@ -1339,13 +1339,14 @@ class SimpleRotationStrategy:
|
||||
idx_s = f"{p['idx_close']:.2f}" if p['idx_close'] is not None else "—"
|
||||
etf_s = f"{p['etf_close']:.3f}" if p['etf_close'] is not None else "—"
|
||||
prem_s = f"{p['premium']:+.2%}" if p['premium'] is not None else "—"
|
||||
entry_date_s = p['entry_date'].strftime('%Y-%m-%d') if p['entry_date'] else "—"
|
||||
days_s = str(p['holding_days']) if p['holding_days'] > 0 else "—"
|
||||
pnl_s = f"{p['pnl']:+.2%}" if p['pnl'] is not None else "—"
|
||||
weight_s = f"{p['weight']:.0%}" if p['weight'] > 0 else "—"
|
||||
market = code_config.get(p['code'], {}).get('market', '—')
|
||||
table_data.append([
|
||||
rank, p['name'], market, p['code'], p['etf'], weight_s,
|
||||
score_s, idx_s, etf_s, prem_s, p['action'], days_s, pnl_s
|
||||
score_s, idx_s, etf_s, prem_s, p['action'], entry_date_s, days_s, pnl_s
|
||||
])
|
||||
row_actions.append(p['action'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user