I don't understand why you need to manually insert an opening balances
entry.
That's something the system should do for you.

The way I handle this in Beancount is that you have different "views" on
your transactions. A view is a subset of transactions. The most obvious one
is "by year", but there are many others (tagged entries, for instance). For
each of these views, there are opening balances report (beginning), balance
sheet (ending), income statement, and other reports.

The input file has all the transactions. You could split this between files
if necessary (concat the files before processing, or implement a trivial
include mechanism--I designed the syntax to be order-independent to ensure
this is easy). The process of creating the subset of transactions for a
year view involves replacing all the past transactions with these special
"opening balances" entries so that the reports only include that year's
transactions, but the generation of the opening balances transactions is an
automated process, not something you should have to do manually. You can
look at any period of time in the same way, e.g., 3 months in arbitrary
dates. Same process applies.





On Fri, Apr 18, 2014 at 7:35 PM, Martin Michlmayr <[email protected]> wrote:

> 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.
>

-- 

--- 
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