portfolio-performance / portfolio

Track and evaluate the performance of your investment portfolio across stocks, cryptocurrencies, and other assets.
http://www.portfolio-performance.info
Eclipse Public License 1.0
2.77k stars 580 forks source link

TTWROR metric of securities changes when an inflow amount changes but it shouldnt #3779

Open TBdt38 opened 5 months ago

TBdt38 commented 5 months ago

Describe the bug By testing performances evolutions after inflow for a security (stocks), i noticed that TTWROR of the security is changing whereas by definition, this metric is made to eliminate the distorting effects of inflows/outflows, in contrary of the IRR. Is it a bug or is that an expected behavior implemented by PP to be not like that? why, if it is the case?

To Reproduce Steps to reproduce the behavior:

  1. Add security purchase like 10 LVMH stock for instance the 01/01/2023.
  2. Add a second purchase in the middle of the year, with 1 new LVMH stock. It produces a TTWROR.
  3. For this second purchase, changes the number of stocks purchased to 2 instead. The TTWROR has changed, whereas this metric should not be impacted as it capture performance of the security, without inflows/outflows impact.

Expected behavior We should get same TTWROR value whatever number of stocks are bought during the second purchase for the security. Because its internal performance is not impacted by our purchasing.

Desktop (please complete the following information):

Morpheus1w3 commented 5 months ago

@TBdt38 Tough, it's seems to be that you've not understood this metric. Any inflow/outflow values has an impact to this value.

https://en.wikipedia.org/wiki/Time-weighted_return

TBdt38 commented 5 months ago

From the wikipedia page: The time-weighted return of a particular security, from initial purchase to eventual final sale, is the same, regardless of the presence or absence of interim purchases and sales, their timing, size and the prevailing market conditions. It always matches the share price performance (including dividends, etc.).

From Investopedia page: The TWR measure is often used to compare the returns of investment managers because it eliminates the distorting effects on growth rates created by inflows and outflows of money. The time-weighted return breaks up the return on an investment portfolio into separate intervals based on whether money was added or withdrawn from the fund.

I just would like to understand the idea with PP implementation, as it doesnt seems consistent with definitions above. Thanks.

TBdt38 commented 5 months ago

I come back to see if i could get an input about that topic of TWR behavior. It would be nice to understand PP implementation. As shared above with some official definitions, for single securities (im not talking about the global portfolio TWR here), the TWRs should not fluctuate with an inflow modification (e.g buying one or two new shares). So i wonder, if PP does some adjustements compared to official calculations. Thanks.