Hi,
That looks very interesting. I'm doing something similar right now.
Two things that I found necessary/helpful:
* I have one interest account and I just tie it to the security by adding an empty posting.
e.g.
2015-01-22 * "Dividend"
Assets:Investment:CHCORP 0 CHCORP
Assets:Liquidity:CHF 20.00 CHF
Income:Patrick:Interest -20.00 CHF
That way I can tie all the flows together for CHCORP
* Another thing is to make sure to prevent transactions between different investments in the same transaction as this confuses my logic, so I'm preventing this by
import collections
from beancount.core import getters
from beancount.core import data
__plugins__ = ['check']
MixedInvestAssets = collections.namedtuple('MixedInvestAssets',
'source message entry')
def check(entries, options_map):
errors = []
commodity_map = getters.get_commodity_map(entries,
create_missing=True)
commodity_type_map = getters.get_values_meta(commodity_map,
'type')
for entry in data.filter_txns(entries):
ccys = set()
for posting in entry.postings:
ccy = posting.units.currency
if commodity_type_map[ccy] == 'invest':
ccys.add(ccy)
if len(ccys) > 1:
errors.append(MixedInvestAssets(
entry.meta,
"Transaction with two or more different investment
postings",
entry
))
return entries, errors
Regards,
Patrick
--
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 beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/bba922da-b960-480e-9e0c-9aececcf39b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Two things that I found necessary/helpful:
On Sunday, January 20, 2019 at 11:16:14 PM UTC+7, Patrick Ruckstuhl wrote:Two things that I found necessary/helpful:
Yeah, as I worked on this and thought about I realised it is pretty hard to make something that is totally universal because of issues like the ones you point out.
A posting can -- at least in theory, though in practice I think it is probably uncommon -- refer to multiple securities, which then makes attributing performance impossible without some way to disambiguate.
Similarly, income like interest/dividends isn't explicitly attributed to a security -- unless you go out of your way to make separate income accounts for each security, which feels a bit over-the-top. In my personal beancount files I set the payee to the name of the fund but you can't really rely on other people following that convention. I suppose you could use metadata.
--
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 beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/2c5f1350-4aee-491d-ae2b-148ed56ec368%40googlegroups.com.
Hi,
another way (that I'm doing) is to link the interest/dividens to the security by a 0 amount transaction on the security, that way I can easily query them.
e.g.
2014-07-15 * "Dividend"
Assets:Broker:FooStock 0 FooStock
Assets:Broker:Liquidity 100 CHF
Income:Interest -100 CHF
and then I can fetch out the interest for FooStock by a query like
Regards,
Patrick
--
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 beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/4feea5ba-a8db-4ed8-a926-2eecef8e3e7b%40googlegroups.com.
These are some of the things I'd love to see, and will start coding them up soon. Are you open to PRs?
- option to start/end at beginning and end month (as some institutions do)