Closed saleehk closed 9 months ago
Paisa doesn't handle 2 level indirection well. Since the USD to INR price is not mentioned anywhere, it will not know how to handle it. The price fetched from yahoo will be stored as ABNB -> INR. You can fix the problem in 2 ways
Add USD to INR conversion price
P 2023/07/07 00:00:00 USD 80.442048 INR
Remove the USD and specify the price in INR
2023/07/07 Buy 0.76179738 Shares of ABNB
Assets:Equity:Vested:NYSE:ABNB 0.76 ABNB @ 10559.6277 INR
Assets:Broker:Vested
I personally use the second method, but both might approach might work
Thanks @ananthakumaran
This helps. Is there any plan in future to handle this?
What is your expectation? The way I see it, it already works, you just have to specify how commodities are connected.
Currently, I'm using your first solution. I have to add the USD to INR price manually. I was wondering if there is a way this can be added automatically, similar to how you are pulling stock and mutual fund prices
Hey, if you are still looking for this, add the following to fetch USD to INR price automatically to your commodities in paisa.yaml:
- name: USD
type: stock
price:
provider: com-yahoo
code: INR=X
harvest: 0
tax_category: unlisted_equity
Or add USD as a stock with price fetch from yahoo with ticker INR=X similar to how you added ABNB in the UI. Though I'm not sure if this will correctly solve this issue, this is a valid way to fetch the exchange rate. @ananthakumaran I can create a PR adding this to the docs for fetching currency prices if you like.
I doubt this will help with the OP issue, the amount is converted to default currency when the ledger file is parsed, and during that time prices from external systems are not referred to, only the prices specified in the ledger file are used.
Ah, I see. It seems that the code for conversion of the prices to $default_currency exists already somewhere in the code, since the market value is calculated correctly with the example ledger entry. You need to use the same code when calculating investment amount too for correct gain calculations.
Problem:
When the default currency is set to INR and I make transactions for stocks in USD, the market value calculation appears to be significantly off.
Example ledger entry:
The stock is purchased in USD and in assets report the Absolute return is incorrect.
For example As of Today 4th Oct 2023 the market value of ABNB is 127.73 USD. In absolute return it shows 12,673.00% change. Actual change is less than 20%.
Is this expected behavior or am I doing something wrong?