ananthakumaran / paisa

Paisa – Personal Finance Manager. https://paisa.fyi demo: https://demo.paisa.fyi
https://paisa.fyi
GNU Affero General Public License v3.0
2.34k stars 117 forks source link

[Bug] Possibly incorrect Net Investment value on main page #77

Open sohamshanbhag opened 10 months ago

sohamshanbhag commented 10 months ago

Describe your Environment OS: Ubuntu Paisa Version: 0.5.4 App Variant: CLI

Describe the bug Net Investment value on main page seems to be incorrect

To Reproduce Steps to reproduce the behavior:

  1. Use ledger file in Journal
  2. Open paisa
  3. Check Net Investment value

Expected behavior Correct value

Screenshots

2023-10-09_04-20-01_screenshot

Journal

2023/10/01 Init
    Assets:Checking                 1000 INR
    Income:Salary:Acme

As can be seen from the journal file, the only transaction is to Assets:Checking, which is not to be considered an investment account. Then, the Net investment value on the opening page shows 1000, but should be 0.

ananthakumaran commented 10 months ago

I had a fix ready for this, but realized that would break the Asset > Networth page because the graph assumes Net Investment + Gain = Net Worth. I have to fix both places.

pashagolub commented 9 months ago

I have also incorrect investment values:

Net worth
116,502.59

Net Investment
125,363.08

Gain / Loss
-8,860.50

XIRR
-4.14

This is somehow connected to the multiple currencies I use. The gain/loss started to grow immediately after the first currency exchange transaction. And I'm still struggling to get the logic behind the numbers

ananthakumaran commented 9 months ago

@pashagolub could you share a minimal example? I know about the issue related to the checking account, but yours seems like a different case.

pashagolub commented 9 months ago

Sure, something like this shows the issue:

2022/01/29 Opening Balance
    Assets:Checking:AnotherBank:FirstUser             4,132.67 UAH
    Assets:Checking:AnotherBank:SecondUser               506.00 UAH
    Assets:Checking:UABank:FirstUser               4,263.01 UAH  
    Assets:Checking:Cash                     3,430.00 USD
    Equity:Opening Balances

P 2022/01/29 00:50:00 UAH 0.026 EUR
P 2022/01/29 00:50:00 USD 0.95 EUR

So it seems like it is price related issue. If there are no prices before the opening transaction, the sum of foreign currencies amounts is going under Loss.

Net worth
3,489.94

Net Investment
12,331.68

Gain / Loss
-8,841.74

XIRR
-51.10

My guess is before first price all currencies are equal, meaning 1 EUR = 1 UAH = 1 USD.

ananthakumaran commented 9 months ago

@pashagolub could you try to convert the 00:50:00 to 00:00:00. Paisa doesn't handle non-zero time correctly

Edit: looking into the issue a bit more, since you are specifying the time as 00:50, and the transaction is recorded at 00:00, ledger won't use it (the price is for a future date)