Re: Having Ledger calculate a commodity / exchange rates by telling it an entry balances

2012-03-15 Thread Martin Michlmayr
 As far as I can tell, this already does exactly what you want.  It
 does reveal a bug, though as a bogus price entry gets created:

 ~/src/ledger $ ./ledger -f /tmp/foo.dat pricedb
 P 2012/03/12 00:00:00 CAD CAD 1.00454320987654321

This is already reported:
http://bugs.ledger-cli.org/show_bug.cgi?id=680

-- 
Martin Michlmayr
http://www.cyrius.com/


Having Ledger calculate a commodity / exchange rates by telling it an entry balances

2012-03-14 Thread Kamal Marhubi
Hi,

Is it possible to tell Ledger an entry with transactions in two commodities / 
currencies balances, so that it can calculate the exchange rate?

Motivating situation: I am in the US, and I withdrew, say, USD 200.00 from my 
Canadian chequing account.  The ATM here charged me USD 2.50 as an additional 
fee.  The withdrawal shows up in my online banking as CAD 203.42 or something 
like that.  In addition to this, my bank in Canada charged me a CAD 2.00 fee.  
I would like to write something like the following:

2012-03-12 * Withdrawal
Assets:Cash   USD 200.00 
Expenses:Banking:Fees   USD 2.50
Assets:Chequing CAD -203.42
Expenses:Banking:Fees   CAD 2.00
Assets:ChqeuingCAD -2.00

and tell Ledger that this balances, so it can work out the rate.  I have used 
the @@ in the past, but that was on withdrawals in the UK where the ATMs do not 
charge fees.  Dealing with the CAD fee is simple, it's the USD fee here that is 
throwing things off; the only way I can see is to do a manual calculation of 
the portion that the USD 2.50 makes up of the CAD 203.42.  This seems wrong.  
Is there a way to get Ledger to do what I want?

Thanks,

-Kamal

Re: Having Ledger calculate a commodity / exchange rates by telling it an entry balances

2012-03-14 Thread John Wiegley
 Kamal Marhubi kamal-7mlawaoftq1bdgjk7y7...@public.gmane.org writes:

 Hi, Is it possible to tell Ledger an entry with transactions in two
 commodities / currencies balances, so that it can calculate the exchange
 rate?

 2012-03-12 * Withdrawal
 Assets:Cash   USD 200.00 
 Expenses:Banking:Fees   USD 2.50
 Assets:Chequing  CAD -203.42
 Epenses:Banking:FeesCAD 2.00
 Assets:ChqeuingCAD -2.00

As far as I can tell, this already does exactly what you want.  It does reveal
a bug, though as a bogus price entry gets created:

~/src/ledger $ ./ledger -f /tmp/foo.dat pricedb
P 2012/03/12 00:00:00 CAD CAD 1.00454320987654321
P 2012/03/12 00:00:00 USD CAD 1.00454320987654321

John