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. 

In protfolio.scm for a price source "Nearest in time"

instead of

('pricedb-latest 
 (lambda (foreign domestic date) 
   (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 


('pricedb-latest 
(lambda (foreign domestic date) 
  (let ((price
         (if (gnc:commodity-equiv? foreign domestic)
            (gnc:pricedb-lookup-latest pricedb foreign domestic)
            (gnc:exchange-by-pricedb-latest 
              (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

-- 
Ekkehard G�rlach                    Tumringerstrasse 287
[EMAIL PROTECTED]             D-79539 L�rrach
_______________________________________________
gnucash-devel mailing list
[EMAIL PROTECTED]
http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel

Reply via email to