Skip to main content
scripts/demo_live.sh · chapter The dashboard and publishing, file 7 · 71 lines · open in the repository

What it does

The live demo in one command (decisions 0013 and 0015): replay the stored data from a start date and stream it through the Spark job, one micro-batch (5 trading days) every 5 seconds, publishing each one to the hosted dashboard (https://calendar-effects.streamlit.app). scripts/demo_live.sh from 2023-06-01 to the end of the data (December 2025): each stock’s 120-day baseline is built by January 2024, so the model’s test years (2024-2025) are fully scored scripts/demo_live.sh 2016-01-04 from another date (2016-01-04 is the whole study period) scripts/demo_live.sh —resume carry on the last run from where it was stopped scripts/demo_live.sh —every=10 seconds between micro-batches (default 5) scripts/demo_live.sh —private without publishing (only this computer’s dashboard shows it) Stop with Ctrl-C: the run ends cleanly and the hosted dashboard marks it stopped (—resume carries it on). When the replay runs out, the job stops by itself and the dashboard marks the run complete. The cloud streamer (the “Live stream” workflow on github.com, decision 0015) runs this same script. It writes to data/demo/ (and checkpoints/demo), so the full run in data/stream/, which the recording and the results come from, is never touched. To watch it on this computer’s dashboard: streamlit run src/dashboard/app.py; its Live stream view picks “A job on this computer” while this runs. It finds Java 17 or 21 by itself (Spark 4 does not start on newer Java, such as 26). Needs: .venv (./run_everything.sh makes it), a trained model in data/models/ (src/ml/train.py, or hf download calendar-effects/big-move-model —local-dir data/models), and, to publish, a Hugging Face login with write access to the calendar-effects organisation (hf auth login, or $HF_TOKEN).

Source

scripts/demo_live.sh