From 8f04ac230d8cf36b9f8e2d4d9a67a70595702f50 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 03:12:51 +0000 Subject: [PATCH 1/4] feat: add helpful tooltips to financial parameters in UI Added `help` parameter to multiple `st.slider` and `st.number_input` widgets in the Streamlit sidebar (e.g., `factor_window`, `adv_pct`, `bt_cost`). This provides users with concrete examples and clarifications for complex statistical thresholds (like basis points or percentiles) on hover, significantly improving the intuitiveness and accessibility of the interface. Also documented this reusable UX pattern in `.Jules/palette.md`. Co-authored-by: aarjava <218419324+aarjava@users.noreply.github.com> --- .Jules/palette.md | 4 +++ src/dashboard.py | 80 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 .Jules/palette.md diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..f21aaad --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,4 @@ + +## 2026-03-19 - Streamlit Native Tooltips Ensure Readability +**Learning:** Using the native `help` parameter in Streamlit widgets (like `st.slider`, `st.number_input`) automatically integrates accessible `stTooltipIcon` tooltips cleanly next to the labels. This avoids cluttering the UI with extra markdown/caption text while ensuring critical definitions (like "63 days ≈ 3 months") are available on demand. +**Action:** Always prefer the `help` parameter for input widgets involving statistical thresholds or specialized financial metrics, providing concrete examples (e.g., "10 bps = 0.10%"). diff --git a/src/dashboard.py b/src/dashboard.py index 4156c1d..cef585b 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -168,9 +168,30 @@ def get_cache_key(*args) -> str: help="Lookback months for Momentum signal." ) else: - factor_window = st.slider("Factor Beta Window (days)", 20, 252, 63, 7) - vol_window = st.slider("Regime Vol Window (days)", 10, 60, 21, 5) - adv_pct = st.slider("ADV Participation %", 0.01, 0.30, float(DEFAULT_ADV_PCT), 0.01) + factor_window = st.slider( + "Factor Beta Window (days)", + 20, + 252, + 63, + 7, + help="Lookback window for calculating factor betas (e.g., 63 days ≈ 3 months).", + ) + vol_window = st.slider( + "Regime Vol Window (days)", + 10, + 60, + 21, + 5, + help="Lookback window for calculating rolling volatility (e.g., 21 days ≈ 1 month).", + ) + adv_pct = st.slider( + "ADV Participation %", + 0.01, + 0.30, + float(DEFAULT_ADV_PCT), + 0.01, + help="Target percentage of Average Daily Volume for trade execution (e.g., 0.10 = 10%).", + ) st.markdown("---") st.subheader("4. Research Rigor") @@ -185,19 +206,60 @@ def get_cache_key(*args) -> str: st.info("Using full-sample quantiles (exploratory mode)") vol_q_high = st.slider( - "High Volatility Quantile", 0.5, 0.95, DEFAULT_VOL_QUANTILE_HIGH, 0.05 + "High Volatility Quantile", + 0.5, + 0.95, + DEFAULT_VOL_QUANTILE_HIGH, + 0.05, + help="Threshold for high volatility regime (e.g., 0.75 = 75th percentile).", ) if mode == "Single-Asset": st.subheader("5. Backtest Settings") - bt_cost = st.number_input("Transaction Cost (bps)", value=DEFAULT_COST_BPS, step=1) / 10000 + bt_cost = ( + st.number_input( + "Transaction Cost (bps)", + value=DEFAULT_COST_BPS, + step=1, + help="Estimated transaction cost in basis points (e.g., 10 bps = 0.10%).", + ) + / 10000 + ) allow_short = st.checkbox("Allow Short Selling?", value=False) else: st.subheader("5. Alert Thresholds") - dd_alert = st.slider("Max Drawdown Alert", -0.6, -0.05, -0.2, 0.05) - vol_alert = st.slider("Volatility Alert (ann.)", 0.1, 1.0, 0.35, 0.05) - beta_alert = st.slider("Beta Alert", 0.5, 2.0, 1.3, 0.1) - dttl_alert = st.slider("Days-to-Liquidate Alert", 1.0, 20.0, 5.0, 1.0) + dd_alert = st.slider( + "Max Drawdown Alert", + -0.6, + -0.05, + -0.2, + 0.05, + help="Alert when portfolio drawdown exceeds this percentage (e.g., -0.20 = -20%).", + ) + vol_alert = st.slider( + "Volatility Alert (ann.)", + 0.1, + 1.0, + 0.35, + 0.05, + help="Alert when annualized volatility exceeds this level (e.g., 0.35 = 35%).", + ) + beta_alert = st.slider( + "Beta Alert", + 0.5, + 2.0, + 1.3, + 0.1, + help="Alert when portfolio beta to the benchmark exceeds this level.", + ) + dttl_alert = st.slider( + "Days-to-Liquidate Alert", + 1.0, + 20.0, + 5.0, + 1.0, + help="Alert when estimated days to liquidate the portfolio exceeds this value.", + ) # --- Portfolio Mode --- From b0a47841cf83bee05233dc2d71d02b464983cf6f Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 03:18:12 +0000 Subject: [PATCH 2/4] feat: add helpful tooltips to financial parameters in UI Added `help` parameter to multiple `st.slider` and `st.number_input` widgets in the Streamlit sidebar (e.g., `factor_window`, `adv_pct`, `bt_cost`). This provides users with concrete examples and clarifications for complex statistical thresholds (like basis points or percentiles) on hover, significantly improving the intuitiveness and accessibility of the interface. Also documented this reusable UX pattern in `.Jules/palette.md`. Co-authored-by: aarjava <218419324+aarjava@users.noreply.github.com> From ae4349ca67b04bdfab66d7d978b7ab952d2a148c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 03:31:58 +0000 Subject: [PATCH 3/4] feat: add helpful tooltips to financial parameters in UI Added `help` parameter to multiple `st.slider` and `st.number_input` widgets in the Streamlit sidebar (e.g., `factor_window`, `adv_pct`, `bt_cost`). This provides users with concrete examples and clarifications for complex statistical thresholds (like basis points or percentiles) on hover, significantly improving the intuitiveness and accessibility of the interface. Also documented this reusable UX pattern in `.Jules/palette.md`. Co-authored-by: aarjava <218419324+aarjava@users.noreply.github.com> From e4965d691b28ecdc4714986ddc3bf927fa758ca8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 03:37:58 +0000 Subject: [PATCH 4/4] feat: add helpful tooltips to financial parameters in UI Added `help` parameter to multiple `st.slider` and `st.number_input` widgets in the Streamlit sidebar (e.g., `factor_window`, `adv_pct`, `bt_cost`). This provides users with concrete examples and clarifications for complex statistical thresholds (like basis points or percentiles) on hover, significantly improving the intuitiveness and accessibility of the interface. Also documented this reusable UX pattern in `.Jules/palette.md`. Co-authored-by: aarjava <218419324+aarjava@users.noreply.github.com>