On Sat, Apr 24, 2021 at 04:13:53PM +0000, James Cook wrote:
> On Fri, Apr 23, 2021 at 12:05:40AM +0000, James Cook wrote:
> ...
> > One issue I haven't yet thought about: I'll be entering all my costs in
> > USD, which will cause this plugin to compute average cost bases in USD.
> > But I need to report to Canada in CAD. This might be the kind of thing
> > where it's acceptible to just do some reasonable approximation. Or
> > maybe I'll update my code to use the price database to convert
> > everything to a target currency.
> 
> Update: I added currency conversion. The version at
> 
> https://hub.darcs.net/falsifian/misc-pub/browse/beancount_plugins/falsifian/parallel_average_cost.py
> 
> is updated including documentation.
> 
> It seems to be doing reasonable things with my Beancount ledger, but I
> haven't yet filled out my Canadian taxes, so still unconfirmed that
> this is actually helpful.
> 
> -- 
> James

Another update: I (almost) completely redesigned it, and it's actually
kind of usable now! I can use fava to show my balance over time under
*either* booking method, without editing my ledger.


Recap:

* I file taxes in both the US and Canada.

* I need to use different booking methods for each country. Canada
  needs average cost booking, but I can't just change my whole ledger
  to use that, since then I wouldn't have the right information for US
  taxes!

* With this plugin, I can do all my booking from the US point of view,
  and the plugin will augment it with a "parallel" ledger that does
  everything from an average booking point of view.


The latest version acheives this by adding new "parallel" postings in
"parallel" commodities mirroring the original ones. For example, if I
want to see my VOO balance over time from the average-cost point of
view using fava, all I need to do is go to:

  http://localhost:5000/beancount/account/Assets:Par:VOO/


My original VOO postings are unharmed, so I can always just go to

  http://localhost:5000/beancount/account/Assets:Vanguard:Brokerage:VOO/

if I want to see things from the US point of view (i.e. using whatever
booking method I used with plain Beancount).


The plugin works by turning this:

        2000-01-01 * "Buy"
          Assets:Chequing -100.00 USD
          Assets:Brokerage      5 ACME {20.00 USD}

        2000-02-01 * "Sell"
          Assets:Chequing        200.00 USD
          Assets:Brokerage           -5 ACME {20.00 USD} @ 40.00 USD
          Income:Capital-gains  -100.00 USD

into this:

        2000-01-01 * "Buy"
          Assets:Chequing -100.00 USD
          Assets:Brokerage      5 ACME {20.00 USD}
          Assets:Par:ACME  5 PAR.ACME {20.00 PAR.USD}
          Equity:Par           -100.00 PAR.USD

        2000-02-01 * "Sell"
          Assets:Chequing            200.00 USD
          Assets:Brokerage              -5 ACME {20.00 USD} @ 40.00 USD
          Income:Capital-gains       -100.00 USD
          Assets:Par:ACME      -5 PAR.ACME {20.00 PAR.USD} @ 40.00 PAR.USD
          Income:Par:Capital-gains  -100.00 PAR.USD
          Equity:Par                 200.00 PAR.USD

Code and documentation are at 
https://hub.darcs.net/falsifian/misc-pub/browse/beancount_plugins/falsifian/parallel_average_cost.py

-- 
James

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20210427160852.7zxjpwirvjcbplzc%40moth.falsifian.org.

Reply via email to