I separate my ledger files by year, so every year starts with a number
of opening balances.

So far, I've been using statements like these:

2014-01-01 * Opening balance
    ; :opening-balance:
    Assets:Current:Invest                          0.00 GBP
    Assets:Investments:Invest             2 AAA @ 20.00 GBP
    Assets:Investments:Invest             4 AAA @ 30.00 GBP
    Equity:Opening balance

However, I just realized that a downside of this approach is that the
original purchase date is lost.

So I've come up with this approach:

2014-01-01 * Opening balance
    ; :opening-balance:
    Assets:Current:Invest                          0.00 GBP
    Assets:Investments:Invest        2 AAA {20.00 GBP} [2012-02-11] @@  40.00 
GBP
    Assets:Investments:Invest        4 AAA {30.00 GBP} [2013-06-06] @@ 120.00 
GBP
    Equity:Opening balance

This shows the information I expect:

$ ledger bal --lots Assets:Investments:Invest
2 AAA {20.00 GBP} [2012/02/11]
4 AAA {30.00 GBP} [2013/06/06]  Assets:Investments:Invest

Is this the best way to model opening balances for shares or is there
a better way?

The example above looks pretty straight forward, but in reality, the
purchase price has a lot of digits, e.g.:
    Assets:Investments:xxx                  415.51 "GB0000468776" {4.4280282063 
GBP} [2013-01-04] @@ 1839.89 GBP

Oh, I guess I could use {{xx}}, as in:

2014-01-01 * Opening balance
    ; :opening-balance:
    Assets:Current:Invest                          0.00 GBP
    Assets:Investments:Invest        2 AAA {{40.00 GBP}} [2012-02-11] @@  40.00 
GBP
    Assets:Investments:Invest        4 AAA {{120.00 GBP}} [2013-06-06] @@ 
120.00 GBP
    Equity:Opening balance

That also gives the expected result.  This is the best solution I have
so far.  Is there anything better?

Note that I always have to specify the total amount with @@, otherwise -B 
doesn't work.

Example:

2014-01-01 * Opening balance
    ; :opening-balance:
    Assets:Current:Invest                          0.00 GBP
    Assets:Investments:Invest        2 AAA {{ 40.00 GBP}} [2012-02-11]
    Assets:Investments:Invest        4 AAA {{120.00 GBP}} [2013-06-06]
    Equity:Opening balance

$ ledger bal Assets:Investments  -B
               6 AAA  Assets:Investments:Invest

John, can you confirm that the approach I've taken is correct and that the @@
is always required?

If I say 2 AAA {{40.00 GBP}}, why cannot ledger figure out the @@ 40.00 GBP by
itself?

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

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to