ALL PROJECTS/STOCK INSIGHTS APP

Overview

The app puts a fixed watchlist of thirty tickers behind a sign-in and gives each one the same treatment: pick a symbol and a date range, and up to seven analysis panels can be opened on demand over the same year of daily history.

Three of those panels are technical — Bollinger Bands, MACD and RSI — and the maths behind them is the project's own, computed over pandas rolling and exponentially-weighted windows rather than pulled from an indicator library. The rest cover trading volume, a seven-row fundamentals table, analyst ratings and the raw price history.

Around the analysis sits a small account surface: five forms covering sign-in, registration, password reset and user-ID recovery, plus a separate administrator tab whose single action is to review the registered accounts. Two roles, two different destinations — an administrator is routed to a different screen rather than a privileged version of the same one.

Problem

Following a handful of stocks means the numbers that matter are scattered. Price history lives in one place, the technical indicators in another, the fundamentals on a third page and the analyst view somewhere else again, and none of them agree on layout. The brief was to gather them onto one screen for a fixed watchlist, put a login in front so the tool was not simply open to the internet, and keep it light enough for one person to run without infrastructure behind it.

The interesting constraint was the framework itself. Streamlit re-executes the entire script from the top on every interaction — every button, every dropdown, every date change. There is no "leave that chart on screen": if the application does not deliberately remember that a panel was asked for, the next click erases it. Any interface with more than one optional view has to solve that before it can solve anything else.

System Design

How It Works

01/03
01

Opening a panel, and why it stays open

The single mechanism the whole interface rests on — Streamlit re-runs the entire script on every interaction, so what stays on screen is what the session remembers.

  1. 1The visitor picks a ticker from the watchlist and a date range in the sidebar
  2. 2Every interaction re-executes the script from the top; the session's flags are read before anything is drawn
  3. 3A year of daily history is fetched once for the current ticker and range, and shared by every panel that is open
  4. 4Pressing a panel button does not draw the chart — it sets that panel's flag and lets the script re-run
  5. 5On the next pass the flag is set, the indicator is computed over the already-fetched history, and the figure is rendered
  6. 6Because the flag persists, the panel is still there after the next click, and opening a second panel never closes the first
02

From ticker to indicator

What happens between choosing a symbol and seeing a line — the maths is the application's own, not a library call.

  1. 1The selected symbol is resolved and a year of daily rows is pulled from the market-data source
  2. 2Bollinger Bands take a 20-period rolling mean and standard deviation and place bands two deviations either side
  3. 3MACD subtracts a 26-period exponentially-weighted mean from a 12-period one, then takes a 9-period signal line and the histogram between them
  4. 4RSI separates gains from losses over 14 periods and converts their ratio into the 0–100 index, with the 70 and 30 lines drawn in
  5. 5Each panel builds its own figure from those series, so the charts stay independent and can be opened in any order
  6. 6The fundamentals table is assembled separately from the company profile, field by field, with a placeholder wherever the source has nothing
03

Getting an account, and getting back into one

Five forms and two roles, with the account store deliberately kept off the analysis path.

  1. 1A new visitor registers with an email, a date of birth, a chosen user ID and a password entered twice, and the two entries must match before anything is written
  2. 2The account row is committed first, and only then is a confirmation email attempted, so a mail problem costs the confirmation rather than the registration
  3. 3A returning visitor signs in and the session records the role it was granted
  4. 4A visitor who has lost a password resets it against details they already gave at registration; one who has lost a user ID can retrieve it the same way
  5. 5An administrator signs in through a separate tab and is routed to a different surface entirely rather than a privileged version of the same one
  6. 6That surface has exactly one action — list the registered accounts — because it was scoped to review rather than administration

Key Features

  • Seven analysis panels opened on demand — Bollinger Bands, MACD, RSI, trading volume, a fundamentals table, analyst ratings and the raw price history, each behind its own button and its own remembered flag
  • Three classic indicators implemented from scratch over pandas rolling and exponentially-weighted windows, with their parameters exposed as function defaults rather than buried in the chart code
  • A seven-row fundamentals table — previous close, 52-week high and low, price/earnings, beta, PEG and forward price/earnings — that asks for each field with a fallback, so a sparse ticker renders a partial table instead of failing
  • A thirty-ticker watchlist loaded from a plain text file into the picker, so the tradeable universe is configuration rather than code
  • A date range the visitor controls, defaulting to the trailing year, applied to every panel at once
  • Five account forms covering the whole lifecycle — sign in, register, reset a password, recover a user ID, and a separate administrator sign-in
  • Two roles with two different surfaces: a standard user reaches the analysis screen, an administrator reaches an account-review screen instead
  • Registration ordered so the account row is committed before the confirmation mail is attempted, and a mail failure is reported without unwinding the registration
  • Charts rendered with an interactive plotting library — hover, zoom and legend toggling come free on every panel rather than being static images

Outcomes

  • One screen replaced the tab-hopping: price history, three technical indicators, volume, fundamentals and analyst ratings for any of thirty tickers, all from a single selection
  • Opening a panel is cheap and closing the browser is the only way to lose one — seven remembered flags make the interface feel stateful on a framework that re-runs everything on every click
  • The indicator maths is the project's own work, which is what made the parameters adjustable at all rather than fixed by whatever a library chose
  • Configuration left the codebase entirely: the watchlist is a text file and every credential comes from the runtime's secrets store, so the repository carries neither
  • Delivered as a repository that runs with one command, with a development container pinned to Python 3.11 that installs the dependencies and starts the app for anyone picking it up cold

More work