Nifty 50 Day-of-Week and Monthly Seasonality Dashboard
nifty-seasonality-study
A two-layer Streamlit seasonality study of the Nifty 50 index. Layer 1 covers day-of-week effects — average return, win rate, return distribution, and a year-by-year heatmap. Layer 2 covers calendar month, turn-of-month and week-in-month effects, and the ISO week-of-year effect.
Split out of the old monorepo, where it lived as nifty_dow_analysis/.
Verified correct
Win-rate's zero-return edge case, ISO-week handling (not the deprecated legacy .dt.week), the NaN-vs-zero distinction in the year/weekday heatmap, and the month and week bucket boundary math were all checked and confirmed already correct — verified with a synthetic known-pattern test (a series with returns fixed at exactly +1% every Monday and 0% otherwise, correctly recovered) plus a live run across 2,875 real trading days from 2015-01-05 to 2026-09-08.
Fixed in review
- A hardcoded future end date that would have silently frozen the data fetch once it passed, replaced with a dynamically computed "today".
- Fixing that surfaced a subtler bug: yfinance returns an in-progress trading session's Close as NaN, which was propagating through a shift(1) to silently corrupt the following day's return calculation too. Confirmed live — 2,878 raw rows with one bad row became 2,877 clean rows after the fix.
- Two weekday bar charts relied on implicit DataFrame row order instead of an explicit category order. It happened to be correct by coincidence, but was one incidental reorder away from Plotly's alphabetical fallback putting Friday before Monday. Fixed with explicit ordering.
- A stale hardcoded date left in the UI text.