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

Need a way to remove an item from Holdings #63

Open
fenderwhite opened this issue Feb 4, 2025 · 4 comments
Open

Need a way to remove an item from Holdings #63

fenderwhite opened this issue Feb 4, 2025 · 4 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@fenderwhite
Copy link

fenderwhite commented Feb 4, 2025

I created a portfolio, then added a transaction(buy) for a test.

Then I removed the transaction(buy) by "delete transaction".

However, the item is still shown in the Holdings section, and I cannot remove it from the list(portfolio).

Attached is the screenshot, and the symbol "294400.KS" is the problem.

Image

@hackeresq hackeresq self-assigned this Feb 4, 2025
@hackeresq hackeresq added the enhancement New feature or request label Feb 4, 2025
@hackeresq
Copy link
Collaborator

This was kinda intentional on my part. I wanted to see what I used to own.

In your case since you were just testing I can see why you'd want to delete the holding.

This will require some logic to check for any other transactions when deleting. If no other transactions, delete the accompanying holding. Should be a quick add in deleting() event on the Transaction model.

Want to give it a shot?

@fenderwhite
Copy link
Author

Yeah, I want to give it a shot.

@fenderwhite
Copy link
Author

fenderwhite commented Feb 4, 2025

BTW, as you said, it is sometimes necessary to check what I used to own.
But for this purpose, those 0 stock items should stay in the list only when I bought a certain amount, and then I finally came to sell all of them. => Which means, there should be all BUY transactions and SELL transactions of the stock.
However, in my case, there were only BUY transactions (with no SELL transactions), and deletion of the transactions. => In this case, I think it is kinda more natural to just remove the stock name from the list of portfolio.
This just my idea. :)

@hackeresq
Copy link
Collaborator

Sounds right to me.

If there's no related transactions, the holding should be deleted.

That can probably be a check in the syncHoldings method on the Transactions model.

Let me know if you need more help to point you in the right direction!

@hackeresq hackeresq added the good first issue Good for newcomers label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants