Collect connection prices (fahrpreise) of the Deutsche Bahn every couple hours, to see how connection prices change over time. Includes a tool for plotting them as well!
It is a tool you can run to gather every vew hours prices for a connection you specified. Those prices can then be plotted to see how connection prices change over time.
These are the prices I collected for a connection I was interested in.
- X-axis is the price until departure
- Y-axis the date until departure.
- the vetical line at ~4 weeks before departure shows a discontinuity
- some connections (especially weekends/holidays) are always expensive
How to run
I run the service on a raspberry and do the plots from my laptop. I mount the datafolder of the raspberry
to my laptop with
mkdir /tmp/fahrpreise && sshfs raspberry:/var/fahrpreise /tmp/fahrpreise.
- build this tool with
npm run prodbuild
- create a user fahrpreise
- install the files from service to
/etc/systemd/system/and modify them as needed (replace the entries prefixed with
- create /var/fahrpreise and grant access to the fahrpreise user
sudo systemctl daemon-reload && sudo systemctl enable --now fahrpreiseto enable the service
- This collects now every few hours (see timer definition file) the connection prices
- In /var/fahrpreise are for each capture run the files with date of capture and stations compressed with brotli for minimal filesize
- mount the datafoler (see above)
plotter/main.py(install dependencies before?)
- for development of the plotter you can set the accufile parameter so you dont need to accumulate data for every testrun
For questions/issues use the issue tracker. Feel free to create pull requests with your modifications.
If you created interesting results with this tool and published them, let me know, I’ll add you to the readme page.
This is based on db-prices-cli and by Jannis R. Thanks go to him for the great base.
See the license file for further information.