portfolio with multiple currencies
Ekkehard Goerlach
e.goerlach@computer.org
05 Jan 2003 13:21:17 +0100
Hello,
in my gnucash I have investments in three currencies (USD, CHF and EUR)
and keep them under the tree of the respective currency. In this way,
however I cannot have a Portfolio report on all of them as there is
currently no currency conversion build in as in the case, e.g., for
expenses. If I do such a report only those commodities are included
which have the same currency as the report.
My question: would it be possible to check (I take the portfolio.scm as
example) whether report and commodity currencies are the same and - if
not - perform a conversion after we have the price from the pricedb.=20
In protfolio.scm for a price source "Nearest in time"
instead of
('pricedb-latest=20
(lambda (foreign domestic date)=20
(let ((price
(gnc:pricedb-lookup-latest
pricedb foreign domestic)))
(if price
(let ((v (gnc:price-get-value price)))
(gnc:price-unref price)
v)
(gnc:numeric-zero)))))
have something like=20
('pricedb-latest=20
(lambda (foreign domestic date)=20
(let ((price
(if (gnc:commodity-equiv? foreign domestic)
(gnc:pricedb-lookup-latest pricedb foreign domestic)
(gnc:exchange-by-pricedb-latest=20
(gnc:pricedb-lookup-latest pricedb foreign foreign) domestic)=
)))
(if price
(let ((v (gnc:price-get-value price)))
(gnc:price-unref price)
v)
(gnc:numeric-zero)))))
Please excuse me if that is utterly wrong. I am not familiar with the
gnucash types and not at all a schemer in the first place.
Interesting enough a conversion is done for the case "Weighted
average" as the price source.
Ekkehard
--=20
Ekkehard G=F6rlach Tumringerstrasse 287
e.goerlach@computer.org D-79539 L=F6rrach