-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Bug: Transaction in BRL but Market Price is in USD #1564
Comments
@vinhadelli can you share more details about how you imported this trade? Was it through a CSV import? Or was it through the add trade modal? The ticker |
Hello @zachgoll. I imported using a CSV that I generated from my usual investment website and customized to fit the format that Maybe expected. HTMX11 is listed under the Bovespa Stocks, from Brazil. Here is a example from the CSV (From left to right: Date, Ticker, Quantity, Value, Currency and Account) |
Hello @zachgoll, facing same problem when added a share from NSE india, Instead of INR of the share price it is taking USD and calculations are getting wrong based on it. The current value need to be ₹ 1357.05 instead it is taking as $ and all the calculations are getting deviated because of it |
This happened because you imported data by CSV and the currency by default goes USD in the Database. @cybervirtu . I did this, this this , and this as a hack in my fork. |
@nikhilbadyal is correct here. If you do not explicitly set the currency for your imported CSV, it will try to apply several defaults:
Currently, the currency dropdown is disabled for trades, but now that we support multi-currency investments, I think we could probably enable this: |
@zachgoll, to provide further data. In my install I did have the "currency" column in my CSV. And my default currency in Maybe was already set as Brazilian Real (BRL) |
Hi @nikhilbadyal @zachgoll i hadn't imported any CSV i updated this manually and this happened for a manual entry |
@zachgoll to clarify more. The currency from CSV is not used at all, and this happens irrespective of the how data was added.(In fact with CSV import there is much more mess than manual entry). Because the stock data is populated(in security_prices and securities table) when it's fetched from synth and the final currency is decided by synth response only. maybe/app/models/provider/synth.rb Line 62 in 5d1a293
And since synth doesn't provides. It fall back to USD and default currency. I had this hack to extract correct currency.
For CSV import more code is need to take exchange code as input to properly calculate the currency. |
@nikhilbadyal @vinhadelli @cybervirtu thanks for the details on this, very helpful. This is a tricky one—the code that @nikhilbadyal provided is not going to work in all cases, because Synth should be returning the currency that the price is quoted in. We need to treat that as our source of truth and then use If you create the following trade:
And Synth returns:
The trade should still be stated in BRL at a price of 100, but the holdings (and the trade drawer details view) should be converting the Synth USD value -> BRL using exchange rates. In other words, we shouldn't be altering the Synth code, but rather, I think the solution needs to be implemented where we're syncing the holdings for the account, and in the drawer: maybe/app/models/account/holding_calculator.rb Lines 51 to 55 in 307a368
|
Describe the bug
The purchase is in BRL, but the market price is in USD. In the screenshot bellow, I have 4 shares of HTMX11, with a total value of 631.16 BRL, but since the market price is in USD, it is converting the value to 3258.24 BRL.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expected the market price to conform with the currency used to make the transaction
What version of Maybe are you using?
Self-hosted v0.2.0
What operating system and browser are you using?
Opera GX
Screenshots / Recordings
The text was updated successfully, but these errors were encountered: