Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why "Transfer" transaction has "amount" value? #4459

Open
pfalcon opened this issue Jan 5, 2025 · 6 comments
Open

Why "Transfer" transaction has "amount" value? #4459

pfalcon opened this issue Jan 5, 2025 · 6 comments
Labels

Comments

@pfalcon
Copy link
Contributor

pfalcon commented Jan 5, 2025

Intro: PP's trade matching code has a number of issues. I'd like to enumerate them in one ticket, but even approaching that, there're other issues "on the outskirts". Trying to collect them in one ticket would be problematic, so trying to submit them separately.

When entering "Transfer" transaction for a security holding, there's a dialog with field for number of shares, which is expected. But there's also field to enter per-share quote and/or total amount. What's the purpose of this amount?

To answer that questions properly, it first would make sense to answer questions of "what's the purpose of transfer transaction" and "what is mental model of it"? For example, my mental model was that it's equivalent to Delivery Outbound + Delivery Inbound combo (which are in turn equivalent of Sell/Buy). Then as DO/DI have "amount" values, then maybe it makes some sense to have it for Transfer too.

I was astonished to see that people have completely different expectations of Transfer conceptual model: #4446 . There, the expectation is that "Transfer" is kind of "symlink", which preserves attributes of the original transaction it "points" to, like date and amount. If purpose of "Transfer" is to preserve original amount / cost basis, then it clearly shouldn't have another amount associated with itself.

@pfalcon pfalcon added the bug label Jan 5, 2025
@pfalcon pfalcon changed the title Why "Transfer" transaction has "amount Why "Transfer" transaction has "amount" value? Jan 5, 2025
@pfalcon
Copy link
Contributor Author

pfalcon commented Jan 5, 2025

While the description tries to approach the question in top-down manner ("let's (re)think what's the purpose of Transfer transaction and its associated amount"), what caused submitting this ticket is actually bottom-up approach of reviewing how PP's code handle the TRANSFER_IN/TRANSFER_OUT transaction types:

CapitalGainsCalculation: Transfer's amount is clearly not used
CostCalculation: Transfer's amount is clearly not used
TradeCollector: This is the most correct trade matching implementation, so less trivial code to analyze than above 2, but seems that Transfer's amount is not used

SharesHeldCalculation, DeltaCalculation: Transfers are altogether ignored, as expected

IRRCalculation: Suddenly, Transfer's amount is used. But how? On TRANSFER_IN, the amount is added with negative sign to IRR calc array, then on TRANSFER_OUT, which happens on the same day, it's added with positive sign, which leads to arrays like:

[2024-01-01, 2024-07-01, 2024-07-01, 2024-12-31]
[-101.0, -500.0, 500.0, 200.0]

with those same-day negative/positive values expected to cancel each other, and indeed, they do.

And intuitively, IRR of a security can't depend on whether it was transferred around or not. So, IRRCalculation should handle transfers in the same way as e.g. DeltaCalculation, i.e. ignore it.


So based on this sampling of code related to performance calculation and trade matching, Transfer's amount isn't really used. So, maybe its presence for this transaction type is confusing and should be removed.

@Sn1kk3r5
Copy link
Contributor

Sn1kk3r5 commented Jan 7, 2025

What's the purpose of this amount?

The amount is used to track performance of the security account.

Indeed this is probably not the most intuitive way, but the only way to track performance on account level.

Couple months ago I tried to explain the behavior in easy words.

Post is in German:

https://forum.portfolio-performance.info/t/wie-depotubertrag-buchen/1677/101

@pfalcon
Copy link
Contributor Author

pfalcon commented Jan 8, 2025

The amount is used to track performance of the security account.

Right, poking around, I got that idea too.

Elaborating and making that explicit, PP tracks performance broken down by securities, but also by accounts. Ways to calculate these different types of performance are also different. For example, security transfers don't affect security's performance, but they clearly affect portfolio account performance. How to calculate the affect of transferred security on old/new account isn't immediately clearly either, and just having a price tag associated with a transfer seems like a smart heuristic to break that problem.

Bottom line: PP is very advanced, and thus complex application, and it's not obvious how its different parts work. There's clearly need for more "inline" help here and there (those "question mark" icons used in other apps). Then there's additional problem that PP is multilingual app, and noone can realistically add translations to all supported languages when just contributing an improvement.

@mierin12
Copy link
Contributor

mierin12 commented Jan 8, 2025

Bottom line: PP is very advanced, and thus complex application, and it's not obvious how its different parts work. There's clearly need for more "inline" help here and there (those "question mark" icons used in other apps). Then there's additional problem that PP is multilingual app, and noone can realistically add translations to all supported languages when just contributing an improvement.

The question mark icon is an great idea, and I believe could be implemented with relatively low effort for indeed a good knowledge gain. Instead of having the icon with a tooltip (issue: translation as you said + can your really explain a complex topic in a little tooltip ?), why not make the icon a link to the dedicated page of the manual ? The English manual is in a very good shape now.
Example : your question about amount in transfer. I think the answer is actually already in the manual : https://help.portfolio-performance.info/en/reference/transaction/transfer/#setting-the-quote-price

Why is a quote price required? What price should you enter: the purchase price, the historical price at the transfer date, zero? Why can't you just transfer the shares from one account to another? The short answer is performance tracking. [...]

So, here : a ? icon in the transfer dialog, linking to the page would be immediately efficient.

We can go on : the user is doing a stock split ? A link in the stock split dialog to the How-to stock split can be made.
A dividend operation ? A link to the How-to Handling choice dividends can be made.
etc.

And giving here and there links to the manual will

  • make its existence more noticeable
  • entice the user to browse it and discover more topics.

@Sn1kk3r5
Copy link
Contributor

Sn1kk3r5 commented Jan 8, 2025

As one of the authors of the manual.

I don't think links will work like this.
First of all. Links must be maintained and can get outdated.

Second where do we start and where do we end?

Last but not least the forum exists in order to help people making best use of PP.

But even there we can see, people are lazy. Even when links to the manual have been provided people are writing the next question instead of making of the manual.

@metal450
Copy link
Contributor

metal450 commented Jan 13, 2025

I was astonished to see that people have completely different expectations of Transfer conceptual model: #4446 . There, the expectation is that "Transfer" is kind of "symlink", which preserves attributes of the original transaction it "points" to, like date and amount.

In terms of tax accounting (at least in the US), this is how transfers are required to work. When you transfer a tax lot (shares of stock) from one custodian/brokerage to another, the holding period & original purchase price of the shares travel with it. It's definitely not equivalent to a buy/sell, as that would be a taxable event - a transfer is not a taxable event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants