From dace604129418ff0ea8a91b6f16cd82b7c1c1450 Mon Sep 17 00:00:00 2001 From: Chris Berkhout Date: Mon, 4 Apr 2022 15:52:43 +0200 Subject: [PATCH] Note about fetching new prices only. --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 05f6492..ca74284 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,17 @@ P 2021/01/07 € $1.5836 P 2021/01/08 € $1.5758 ``` +### Fetch new prices only + +You can update an existing file without refetching the prices you already have. +First find the date of the last price, then fetch from there, drop the header +line if present and append the rest to the existing file. + +``` +last=$(tail -1 prices-eur-usd.csv | cut -d, -f1) +pricehist fetch ecb EUR/USD -sx $last -o csv | sed 1d >> prices-eur-usd.csv +``` + ### Load prices into GnuCash You can generate SQL for a GnuCash database and apply it immediately with one