- Jan 6, 2026
- 5 min read
A Stock Dashboard From Free Data, Shipped as a Container
Built in 2022, revisited now: what I made, and what I’d do differently today.
In 2022 I wanted one place to look at a handful of stocks: price history, dividends, how they compared with an index, and what inflation did to all of it. The paid tools that did this cost around €40 a month or a year each. The free data was all there, spread across a few R packages. Nobody had put them in one open-source dashboard, so I did.
That became R Stocks: an R Shiny app, GPL-3.0, on GitHub, with a container image anyone can run.
Four free data sources, one app
| Package | What it gives you | Used for |
|---|---|---|
| yfR | Yahoo Finance price history for tickers and indexes | price trends, S&P 500 / Dow / Nikkei, index vs commodity |
| quantmod | historical dividends and stock splits | dividend history, dividend growth, yield over time |
| priceR | exchange rates and country inflation series | currency and inflation tabs |
| Quandl | company fundamentals (needs an API key) | gross margin, debt/assets, EV/EBITDA, payout ratio |
On top of those, Shiny for the app and Plotly for interactive charts.
The app ended up with six tabs: selected stocks, dividends, global indexes, commodities against an index, currencies, and inflation. The dividend tab, for example, shows dividend per share over the years, the distribution of yearly dividend growth, and historical yield.
It was built with a friend. We kept a plain roadmap table with owners and dates: yield on cost, current yield, index against gold (done); portfolio value as a stacked area, dollar-cost averaging, classifying S&P 500 companies by how many years they’ve raised dividends (not done). A shared table with names and dates was enough project management for two people on weekends.
The hard part was the container
Writing the app was the easy part. Getting it into one Docker setup that worked on both a normal x86 machine and a Raspberry Pi took far longer.
On x86 there were three reasonable starting points:
| Base image | Notes |
|---|---|
rocker/shiny | Shiny Server included; serves on port 3838 |
rocker/tidyverse | tidyverse preinstalled; run the app with shiny::runApp, no Shiny Server |
r-base | bare R; you install every system library yourself |
The rocker images were the comfortable choice. At the time, none of them had an
ARM build, and the Pi is where I wanted to host it. So the ARM path started
from r-base and installed everything by hand:
FROM r-base:latest
RUN apt-get update && apt-get install -y --no-install-recommends \
libcurl4-gnutls-dev libcairo2-dev libxt-dev libssl-dev libssh2-1-dev libxml2-dev \
&& rm -rf /var/lib/apt/lists/*
RUN R -e 'install.packages(c("shiny","plotly","dplyr","tidyr","lubridate","DT","bslib","priceR","quantmod"))'
RUN R -e 'install.packages("yfR", dependencies = TRUE)'
COPY app.R /srv/shiny-server/app.R
EXPOSE 3838
CMD ["R", "-e", "shiny::runApp('/srv/shiny-server/app.R', host='0.0.0.0', port=3838)"]
Things that cost me time:
- Compiled R packages need system libraries. An R package that installs
fine on a desktop with years of accumulated
-devpackages fails in a clean image.libxml2-devwas the one that only showed up on ARM. - Install
yfRwith its dependencies, separately, or it fails late in the build. - Builds are slow. Compiling R packages from source made one image build
take around eight minutes.
--no-cache --progress=plainwas the only way to see where it was failing. - I couldn’t see what was wrong on the Pi. Running a desktop-in-a-container (a “webtop”) on it let me test the image interactively instead of guessing.
The result: images on Docker Hub and GHCR, a small compose file, and the app running on the Pi behind a Cloudflare tunnel.
services:
r_stocks:
image: fossengineer/r_stocks
ports: ["3838:3838"]
restart: unless-stopped
A static side project too
Not everything needs a server. For one analysis, classifying S&P 500 history into “boom” and “burst” periods by consecutive declines, I used an R Markdown flexdashboard instead. It knits to one HTML file with interactive charts, which GitHub Pages hosts for free. For read-only analysis, that’s often the better choice than a running app.
What I’d change today
- Quandl is now Nasdaq Data Link. The fundamentals tab needs updating, and free fundamentals are harder to come by than prices and dividends.
- Pin package versions.
install.packages()at build time means two builds a month apart can differ. - Build multi-arch images with
docker buildxfrom one Dockerfile, instead of separate x86 and ARM builds. - Cache the data. Every page load hit the data sources. A daily fetch into a local file (or DuckDB) would make it faster and kinder to free APIs.
Not financial advice: the app shows freely available data. It doesn’t recommend anything.
Takeaways
- Free data plus a few packages can replace a paid tool for personal use.
- The app is the easy part. Packaging it for the hardware you’ll run it on is the real work.
- Check your base image supports your CPU before you design around it.
- Use a static dashboard when nobody needs to change the inputs.