Thank you, script was useful to me. It was painfully slow to import 2 years of prices (partially due to inefficient price source implementation), but from now on I should run this more frequently so it should be fine.

On 20/01/2020 03:46, Justus Pendleton wrote:
On Monday, January 20, 2020 at 5:14:13 AM UTC+7, Andrzej wrote:

    Alternatively, does anyone know if there a tool that does
    something similar but is outside of beancount main repository?
    (I'm not a fan of maintaining my own fork of beancount for this patch)


Vivek mentioned in his original post that people wrote their own scripts, so you could just do that. Depending on what you want, it isn't especially complicated. Here's one I had for when I wanted to populate the price map with historical data.

If uses gdate because I usually run it on a mac. If you wanted to update prices weekly instead of daily, just change the "+ 1 day" to something else.

#!/bin/bash -e

DATE=gdate

if [ -z $1 ]; then
  echo "Must supply start date, e.g. 1983-05-22"
  exit 1
else
  from=$1
fi

if [ -z $2 ]; then
  to=$(${DATE} -I)
else
  to=$2
fi

d=$from
while [ "$d" != "$to" ]; do
  echo Fetching prices on $d...
  bean-price --date $d my.beancount >> prices.beancount
  d=$(${DATE} -I -d "$d + 1 day")
done

--
You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/28d0651b-d5ad-4a5d-9944-7944cf1ed217%40googlegroups.com <https://groups.google.com/d/msgid/beancount/28d0651b-d5ad-4a5d-9944-7944cf1ed217%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/c3b36d52-59b8-5441-58cd-3a244b3e342b%40gmail.com.

Reply via email to