Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 2024-03-13 - [Initial]

## 2024-03-13 - [Tooltip UX for Statistical Inputs]
**Learning:** Statistical inputs (like quantiles, bps, adv) without concrete examples cause confusion.
**Action:** Use native Streamlit `help` parameter to provide contextual examples (e.g. 10 bps = 0.10%) for all financial widgets.
65 changes: 54 additions & 11 deletions src/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def get_cache_key(*args) -> str:
portfolio_value = st.number_input(
"Portfolio Value (USD)",
value=float(DEFAULT_PORTFOLIO_VALUE),
step=100000.0
step=100000.0,
help="Total capital allocated to the portfolio (e.g., 1,000,000 USD).",
)
benchmark_ticker = st.text_input("Benchmark Ticker", value=DEFAULT_BENCHMARK).upper()

Expand All @@ -160,37 +161,79 @@ def get_cache_key(*args) -> str:
st.subheader("3. Signal Parameters")
if mode == "Single-Asset":
sma_window = st.slider(
"Trend SMA Window", 10, 200, DEFAULT_SMA_WINDOW, 10,
help="Lookback days for Simple Moving Average trend signal."
"Trend SMA Window",
10,
200,
DEFAULT_SMA_WINDOW,
10,
help="Lookback days for Simple Moving Average trend signal.",
)
mom_window = st.slider(
"Momentum Lookback (Months)", 1, 24, DEFAULT_MOMENTUM_WINDOW, 1,
help="Lookback months for Momentum signal."
"Momentum Lookback (Months)",
1,
24,
DEFAULT_MOMENTUM_WINDOW,
1,
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="Rolling window for calculating factor betas (e.g., 63 days ≈ 3 months).",
)
vol_window = st.slider(
"Regime Vol Window (days)",
10,
60,
21,
5,
help="Rolling window for calculating annualized volatility (e.g., 21 days ≈ 1 month).",
)
adv_pct = st.slider(
"ADV Participation %",
0.01,
0.30,
float(DEFAULT_ADV_PCT),
0.01,
help="Maximum percentage of Average Daily Volume to trade (e.g., 0.10 = 10% of ADV).",
)

st.markdown("---")
st.subheader("4. Research Rigor")
use_oos = st.toggle(
"Out-of-Sample Mode",
value=False,
help="Uses expanding-window quantiles for regime classification to avoid look-ahead bias. Enable for rigorous backtesting."
help="Uses expanding-window quantiles for regime classification to avoid look-ahead bias. Enable for rigorous backtesting.",
)
if use_oos:
st.success("✓ Look-ahead bias removed")
else:
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 means top 25% of historically most volatile days).",
)

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="Transaction friction per trade (e.g., 10 bps = 0.10%).",
)
/ 10000
)
allow_short = st.checkbox("Allow Short Selling?", value=False)
else:
st.subheader("5. Alert Thresholds")
Expand Down
Loading