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

Improve UX of ROI command #1267

Closed
pandabrun opened this issue Jun 23, 2020 · 2 comments · Fixed by #1483
Closed

Improve UX of ROI command #1267

pandabrun opened this issue Jun 23, 2020 · 2 comments · Fixed by #1483
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. investing Related to investments, lots, capital gains, etc. roi

Comments

@pandabrun
Copy link

Hello all,

First things first, thank you all for this very nice software ! 👍

Few days ago, I suggested via IRC (ping @adept) that the ROI command could be a little bit more ux-friendly by removing the need of the --pnl flag.

Here's an example of how I understand the ROI commands works now

  1. Buy assets and record offset of pnl gain/loss
2019-06-20 Gettin' Rich
  Assets:cash   - $300
  Investment:APPL

2020-06-23 pnl valuation
  investment:APPL   = $25
  Unrealized:APPL
  1. Enjoy roi
➜ hledger roi --investment='Investment:APPL' --pnl='Unrealized:APPL'
+---++------------+------------++---------------+----------+-------------+-----++-------+-------+
|   ||      Begin |        End || Value (begin) | Cashflow | Value (end) | PnL ||   IRR |   TWR |
+===++============+============++===============+==========+=============+=====++=======+=======+
| 1 || 2019-06-20 | 2020-06-23 ||             0 |      300 |         325 |  25 || 8.22% | 8.21% |
+---++------------+------------++---------------+----------+-------------+-----++-------+-------+

This approach requires to offset pnl of each investments into a dedicated account (eg. Unrealized:APPL in this case), which I found somehow not very practical since it spams my journal by 'not real' transaction.

Moreover, I guess this needs of offseting latest pnl is redundant with the P directive (cf. https://hledger.org/journal.html#declaring-market-prices) since the pnl is only a subtraction of the latest price minus the buying price and then could be easily calculated by the command.

In my opinion, the ROI commands should work this way:

  1. Buy assets and record new price with the P directive
2019-06-20 Gettin' Rich ; buy some APPL
  Assets:cash   - $300
  Investment:APPL

P 2020-06-15 APPL  $ 280.80 ; record new price
P 2020-06-15 APPL  $ 290.43 ; same

And then the ROI command should be able to calculate the latest pnl for the selected commodity, maybe with a new flag like that for example

➜ hledger roi --investment='Investment:APPL' --commodity='AAPL'
+---++------------+------------++---------------+----------+-------------+-----++-------+-------+
|   ||      Begin |        End || Value (begin) | Cashflow | Value (end) | PnL ||   IRR |   TWR |
+===++============+============++===============+==========+=============+=====++=======+=======+
| 1 || 2019-06-20 | 2020-06-23 ||             0 |      300 |         325 |  25 || 8.22% | 8.21% |
+---++------------+------------++---------------+----------+-------------+-----++-------+-------+

Curious to have opinon around this wish, let me know if it seems relevant 😳

@pandabrun pandabrun added the A-WISH Some kind of improvement request, hare-brained proposal, or plea. label Jun 23, 2020
@simonmichael
Copy link
Owner

Thanks for the suggestion @pandabrun. Sounds good to me at least. Possibly requires progress on #1029 first ?

@simonmichael simonmichael added the investing Related to investments, lots, capital gains, etc. label Jun 23, 2020
@adept
Copy link
Collaborator

adept commented Feb 9, 2021

This approach requires to offset pnl of each investments into a dedicated account (eg. Unrealized:APPL in this case), which I found somehow not very practical since it spams my journal by 'not real' transaction.

I am slightly late to the party with this comment, but I just want to note that there is no need to have a separate pnl account per investment - you use a single one for all of them.

Also, with #1483 roi should that P directives into account automatically, hopefully removing the need for manual valuation transactions (in your use-case, at least)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. investing Related to investments, lots, capital gains, etc. roi
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants