On Wed, Feb 6, 2019 at 9:47 AM Justus Pendleton <justu...@gmail.com> wrote:

> On Wednesday, February 6, 2019 at 10:38:05 AM UTC+7, igor.s...@gmail.com
> wrote:
>>
>> The reason I'm working on these queries is I'd like to compute time
>> valued rate of returns (example spreadsheet if someone's interested
>> https://www.bogleheads.org/wiki/Calculating_personal_returns).  If
>> anyone has suggestions on different workflow with beancount, please let me
>> know.
>>
>
> FWIW, I posted a money-weighted returns calculator a few weeks ago.
>
> https://groups.google.com/forum/#!topic/beancount/7GbNHLiN0mg
>
> At the time, I was planning on also adding time-weighted returns but after
> thinking about it for a while, decided that it was somewhere between
> impossible & a fool's errand in beancount.
>

:-)
It's pretty gnarly indeed.
I gave it a shot here:
https://bitbucket.org/blais/beancount/src/tip/experiments/returns/returns.py
I backed out once I started debugging this. I made it too complicated.
But I think the categorization at the top - and it took me a while to come
up with it - is sound.
The plan is to revisit one day (before retirement, damnit) and to rewrite
simpler and more easily debuggable.



> The thing with time-weighted returns is you have to have equal-length
> periods of time.
>

Not really. You just need to multiply the returns of each period
("geometric linkage").
Basically, whenever there is a cash inflow/outflow, you need the total
value before and after.
Periods of return have the value at the beginning (after the flow) and at
the end (before the next flow).
You compute the return over each period, multiply them together, then
annualize.



> With beancount, that means you rely on the user to update the price
> database on exact dates. Every 30 days (not every month!). Every day. Or
> whatever. I don't do that and I'd be surprised if many people are actually
> that rigorous about it, especially with historical data that they imported
> into beancount.
>

You could write a script that automatically computes the list of active
assets and fetches the historical prices.
I once started hacking something like this, here:
https://bitbucket.org/blais/beancount/src/tip/experiments/prices/fetch-lifetime-prices.py



>
> Of course, you could just go for "good enough" and not care that the price
> database isn't fine grained enough to give you equal-length periods of
> time. I guess you could argue that it is "close enough" (but how far off is
> it? how do you know?)...but when combined with my general feeling that
> time-weighted returns are mostly meaningless for individual investors
> anyway....I ended up not implementing it.
>

You know something that still continues to amaze me, is that no broker ever
reports anything close to either of those.
You can get your initial / final value per period, but that doesn't take
into account cash flows (investments), so it's useless.
You can also get the value of a set of fixed positions over periods, but
that doesn't reflect your changing allocation over time.
You can get IRR, which is better, but same thing, doesn't show your true
return against the market.
Basically, noone has a f' clue what their returns are... This blows my mind.
Totally worth solving properly.





> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/5081843f-dced-4df2-8c3f-24dc330fbe2b%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/5081843f-dced-4df2-8c3f-24dc330fbe2b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMhf%3D9bcjc_YF4y5%2B0rvxFuspfj5Vo-CYYDGWGD8yKLhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to