refactor pool view with status filter and improve factor clearing
This commit is contained in:
parent
5b2033f52b
commit
8876c0131d
@ -247,7 +247,9 @@ def render_factor_calculation() -> None:
|
|||||||
LOGGER.exception("清空因子表失败", extra={**LOG_EXTRA, "error": str(exc)})
|
LOGGER.exception("清空因子表失败", extra={**LOG_EXTRA, "error": str(exc)})
|
||||||
st.error(f"清空因子表失败:{exc}")
|
st.error(f"清空因子表失败:{exc}")
|
||||||
finally:
|
finally:
|
||||||
st.session_state['factor_clear_confirm'] = False
|
# 使用st.rerun()代替直接修改session_state
|
||||||
|
# 清空因子表后重置页面状态
|
||||||
|
st.rerun()
|
||||||
|
|
||||||
# 5. 开始计算按钮
|
# 5. 开始计算按钮
|
||||||
if st.button("开始计算因子", disabled=not selected_factors):
|
if st.button("开始计算因子", disabled=not selected_factors):
|
||||||
|
|||||||
@ -46,8 +46,17 @@ def render_pool_overview() -> None:
|
|||||||
else:
|
else:
|
||||||
st.info("暂无组合快照,请在执行回测或实盘同步后写入 portfolio_snapshots。")
|
st.info("暂无组合快照,请在执行回测或实盘同步后写入 portfolio_snapshots。")
|
||||||
|
|
||||||
|
st.write("候选投资池:")
|
||||||
try:
|
try:
|
||||||
latest_date = get_latest_trade_date()
|
latest_date = get_latest_trade_date()
|
||||||
|
|
||||||
|
# 添加状态过滤功能
|
||||||
|
status_options = ["全部", "watch", "candidate", "exit", "buy_s", "buy_m", "buy_l"]
|
||||||
|
status_filter = st.selectbox("选择状态", options=status_options, index=0)
|
||||||
|
|
||||||
|
if status_filter != "全部":
|
||||||
|
candidates = list_investment_pool(trade_date=latest_date, status=[status_filter])
|
||||||
|
else:
|
||||||
candidates = list_investment_pool(trade_date=latest_date)
|
candidates = list_investment_pool(trade_date=latest_date)
|
||||||
except Exception: # noqa: BLE001
|
except Exception: # noqa: BLE001
|
||||||
LOGGER.exception("加载候选池失败", extra=LOG_EXTRA)
|
LOGGER.exception("加载候选池失败", extra=LOG_EXTRA)
|
||||||
@ -67,7 +76,6 @@ def render_pool_overview() -> None:
|
|||||||
for item in candidates
|
for item in candidates
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
st.write("候选投资池:")
|
|
||||||
st.dataframe(candidate_df, width='stretch', hide_index=True)
|
st.dataframe(candidate_df, width='stretch', hide_index=True)
|
||||||
else:
|
else:
|
||||||
st.caption("候选投资池暂无数据。")
|
st.caption("候选投资池暂无数据。")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user