Some commodity prices are not updated by bean-price.

123 views
Skip to first unread message

timoth...@gmail.com

unread,
Oct 19, 2019, 4:09:56 AM10/19/19
to Beancount
Hi!

I am probably missing something obvious, but i am struggling with updating the price of some commodities.

The price update process with beancount goes well for mos of my commodities (i.e: my stocks)

But it does not work for the foreing currencies.

Here is a minimalistic exemple:

root@6c75893b5a4a:/myData# cat test.beancount
;; -*- mode: org; mode: beancount; coding: utf-8; fill-column: 400; -*-


* Initialization

** Options

option "title" "Test"
option "operating_currency" "EUR"
option "name_assets" "Actif"
option "name_liabilities" "Passif"
option "name_equity" "Equity"
option "name_income" "Revenus"
option "name_expenses" "Depenses"
1981-02-07 open Equity:Opening-Balances

* Commodities
1999-01-01 commodity EUR
asset-class: "cash"
price: "USD:yahoo/EURUSD=X"

1999-01-01 commodity CAD
name: "Canadian Dollar"
asset-class: "cash"
price: "EUR:yahoo/^EURCAD=X"

1999-01-01 commodity USD
name: "US Dollar"
asset-class: "cash"
price: "EUR:yahoo/^EURUSD=X"

1999-01-01 commodity GBX
name: "Pence Sterling"
asset-class: "cash"


* Cash Daybook
1981-07-02 open Actif:Cash
1981-07-03 pad Actif:Cash Equity:Opening-Balances
2019-08-23 balance Actif:Cash 7000 EUR
2019-08-23 balance Actif:Cash 1.00 USD
2019-08-23 balance Actif:Cash 1.00 CAD
2019-08-23 balance Actif:Cash 1.00 GBX


When i try to update the price, neither USD or CAD price gets updated:

root@6c75893b5a4a:/myData# /usr/local/bin/bean-price /myData/test.beancount -vv --no-cache
INFO : Processing at date: 2019-10-19
INFO : Loading "/myData/test.beancount"
DEBUG : Ignoring currency with no metadata: GBX
DEBUG : -------- Currencies in primary list:
DEBUG : CAD /EUR
DEBUG : EUR /USD
DEBUG : USD /EUR
DEBUG : -------- Currencies held in assets:
DEBUG : -------- Currencies to fetch:


Any idea why nothing happens ? I would expect bean-price to fetch the current quote for CAD/EUR and USD/EUR.


Side question:
GBX is the ticker for the british pound pence. Most british stocks have their prices in GBX. However, the forex datas are usually for GBP .
Is it possible to ask bean-price to compute GBX from GBP ? a statement like:

1999-01-01 commodity GBX
name: "Pence Sterling"
asset-class: "cash"
price: "EUR:yahoo/1/100*GBPEUR=X)

or should i write a custom price fetcher for that ?

Justus Pendleton

unread,
Oct 20, 2019, 7:45:44 AM10/20/19
to Beancount
On Saturday, October 19, 2019 at 3:09:56 PM UTC+7, timoth...@gmail.com wrote:
DEBUG   : Ignoring currency with no metadata: GBX

DEBUG   : -------- Currencies in primary list:
DEBUG   :                           CAD /EUR
DEBUG   :                           EUR /USD
DEBUG   :                           USD /EUR
DEBUG   : -------- Currencies held in assets:
DEBUG   : -------- Currencies to fetch:


Any idea why nothing happens ? I would expect bean-price to fetch the current quote for CAD/EUR and USD/EUR.


Notice how the "currencies held in assets" is blank? CAD & EUR are "inactive" in your file. You can fetch them by adding the --inactive flag to beancount. As for why they are inactive....

Beancount tries to figure out what currencies are "inactive"....and pad statements don't count, since they don't have a cost or a price. In general, I think it has been to something held at cost, like a stock share, for it to count as active.

timoth...@gmail.com

unread,
Oct 26, 2019, 3:34:11 AM10/26/19
to Beancount
Thanks for your help.

Using the --inactive flag is not an option for me. I have too many commodities that have been created, kept in my portfolio for a while, but are not used anymore.

I wonder why any commodity held currently in the portfolio (but the primary commodity of course) is not updated.
foreign currencies by essence are not held at cost. However, i would like their price to be updated.

Alen Šiljak

unread,
May 24, 2025, 6:14:47 PM5/24/25
to Beancount
I just hit this same issue and am wondering about the details of currencies / currency pairs being "active".

As a workaround, I added a couple of fake transactions
```
2025-05-23 * "FX"
Equity:Trading:Currency:USD 1 USD @ 1 EUR
Equity:Trading:Currency:EUR -1 EUR
```
so that the EUR/USD currency pair becomes active and the price download works.
I assume that I have similar real records for certain currency pairs at some point and that's why the download for those works, while for some it doesn't.

Alen Šiljak

unread,
May 24, 2025, 7:50:45 PM5/24/25
to Beancount
Reply all
Reply to author
Forward
0 new messages