Comments (20)
Okay, added multicurrency support. Interested users: please let me know if this works for you.
You will have to list all currencies you use as operating currencies in your beancount file like so:
option "operating_currency" "USD"
option "operating_currency" "GBP"
plugin "beancount.plugins.implicit_prices" ; Or, include price directives
from fava_investor.
Ah, looks like I didn't mention that price directives are required. This line will fix your example:
plugin "beancount.plugins.implicit_prices"
from fava_investor.
@scanta2 says:
My ledger file defines two operating currencies, USD and EUR.
Here's the message thrown by fava-investor when using the asset allocation
code.
Error: unable to convert 55.072250 AGGLOBBND to base currency USD (Missing
price directive?)
Error: unable to convert 55.072250 AGGLOBBND to base currency USD (Missing
price directive?)
SystemExit raised: shutting down
from fava_investor.
The only way AA can assign percentages is to view your entire balance inventory in a single currency, so it can make comparisons. In this case, is the solution to first convert commodities to EUR, then do a second step conversion from EUR to USD? This would depend on being able to convert between the two currencies on or close to the date AA is requested. Let me know.
Also, curious: does beancount/fava support more than two currencies? Is 3+ currencies a common use case?
from fava_investor.
@scanta2 / @g40matt, minimal beancount sources to reproduce the issue would be helpful. Thanks!
from fava_investor.
Also, curious: does beancount/fava support more than two currencies? Is 3+ currencies a common use case?
Unfortunately I have 3 operating currencies (my life is complicated). Fava handles this just fine.
from fava_investor.
Fava has a dropdown menu which lists all your operating currencies. I think that makes sense for fava-investor as well: show my asset allocation for all my EUR investments, for my GBP investmentes, etc.
Fava also has another box "At cost", "Converted to EUR", etc. I think that would also make sense: I could choose "Converted to EUR" to see all my asset allocation in one currency.
from fava_investor.
Sure, I'm not worried about the UI. Asset allocation requires conversion to a single currency. Which currency and how the conversion is done will affect the results. That needs to be sorted out.
from fava_investor.
Right, but I thought I explained how I would handle it.
People can choose between their operating currency in one box and the conversion in another. If I choose EUR and "at Cost", do asset allocation for all EUR. if I choose USD and "at Cost", do it for USD. If I choose EUR and "Convert to EUR", I will see the asset allocation of ALL assets converted to EUR (at least those that have a conversion route via pricedb)
from fava_investor.
I think I see what you're saying now. Your suggestion is to use the UI to address how to do this. I think that could work. But that means he UI aspects need to be ironed out. "At cost" is almost definitely not what the user wants here, and should error out when picked. As should units.
from fava_investor.
From #56:
I think there are two steps to supporting currency conversion chains:
-
Look for how Fava converts all to one currency, and hook up the code to use the same thing, including using the UI elements. Note that this has to also work for the library/command line version of the asset allocator, meaning some parameterization is required at least. If there is fava specific code to do the conversion, that can't be used and has to be rewritten. Break up the UI elements so "At Cost" is not an option. Might require changes to fava.
-
Understand what currency conversion chains mean for asset allocation. Allocations for the same portfolio may vary when using different chains. First, is this truly a problem in practice, or is the variance so small that this is not worth worrying about? If deeper examination is needed, what does this mean for the user?
from fava_investor.
Also see beancount/fava#1211 (comment)
from fava_investor.
I don't 100% understand this issue, but I do have the same problem mentioned in the second comment above:
Attaching to ledgers_fava_1
fava_1 | Error: unable to convert 74 XYZ to base currency USD (Missing price directive?)
fava_1 | Error: unable to convert 74 XYZ to base currency USD (Missing price directive?)
fava_1 | SystemExit raised: shutting down
fava_1 | Running Fava on http://0.0.0.0:5000
ledgers_fava_1 exited with code 1
In my case, most of my holdings are in USD, but XYZ is a UK stock, so I have a GBP price directive for it.
So far I've used beancount/fava just fine with separate currency handling (actually three, USD/GBP/EUR, since I'm from the US but live in Europe), so I'm not necessarily expecting a "total overview" that does automagical currency conversion.
Right now, it seems my options to try out fava_investor without it crashing are to remove my XYZ holdings or add a price directive for XYZ/USD, is that accurate? Would a possible (temporary?) solution be to allow setting the currency for fava_investor to be concerned with and ignore commodities in other currencies?
from fava_investor.
A temporary solution might be to exclude your account with XYZ using the config:
'asset_alloc_by_class' : {'accounts_patterns': ['Assets:(Investments|Banks)']},
Of course, this would affect your allocation numbers.
from fava_investor.
If anyone could contribute a few test cases for multicurrency support, I'm happy to work on this.
from fava_investor.
Some questions for anyone interested in this feature:
- Do folks typically specify all their operating currencies as options, like so:
option "operating_currency" "USD"
option "operating_currency" "GBP"
etc.?
- How does Fava populate its "Convert to" dropdown list? Does it simply pick all 3-character commodities?
from fava_investor.
Note to myself: Ideally, we would automatically figure out the currency to hop via, based on the cost currency of the position. However, currently, cost currency info is not available as a part of the balance tree in libassetalloc.py
. Hence, we hop via any available operating currency specified by the user.
from fava_investor.
Okay, added multicurrency support. Interested users: please let me know if this works for you.
You will have to list all currencies you use as operating currencies in your beancount file like so:
option "operating_currency" "USD" option "operating_currency" "GBP"
Still having the same issue as mentioned above
❯ investor assetalloc-class ledger.beancount
Error: unable to convert 100 USD to base currency EUR (Missing price directive?)
even though I specified all operating currencies.
Here is how I track the trade:
2022-05-10 * "Convert" #BUY
Assets:Exchanges:USD 100 USD {0.95 EUR}
Assets:Exchanges:EUR -105,2631578947 EUR
from fava_investor.
Still having the same issue as mentioned above
❯ investor assetalloc-class ledger.beancount Error: unable to convert 100 USD to base currency EUR (Missing price directive?)
Could you please post a complete, minimal example?
from fava_investor.
sure:
option "operating_currency" "EUR"
option "operating_currency" "USD"
2000-01-01 custom "fava-extension" "fava_investor" "{}"
2012-04-01 open Assets:Exchanges:X:EUR EUR
2012-04-01 open Assets:Exchanges:X:USD USD
2014-01-01 open Income:EUR EUR
2022-04-13 * "Deposit"
Income:EUR -1000 EUR
Assets:Exchanges:X:EUR 1000 EUR
2022-05-10 * "Convert" #BUY
Assets:Exchanges:X:EUR -1502.6321 EUR @@ 1572.1453 USD
Assets:Exchanges:X:USD
results in:
❯ investor assetalloc-class test.beancount
Error: unable to convert 1572.145300000000000000000000 USD to base currency EUR (Missing price directive?)
from fava_investor.
Related Issues (20)
- Postive amounts of non-monetary commodities crash aa_class HOT 5
- Incorrect proceeds because sale price not used HOT 3
- Fava Investor won't load HOT 3
- Function get_account_open in favainvestorapi.py returns an empty list HOT 3
- Incorrect allocation percentage computation in "Asset Allocation Accounts" HOT 4
- Fava QueryShell Change HOT 5
- Need a good example.beancount that demonstrates all modules
- [Feature] Write errors to GUI callout instead of exiting HOT 3
- [Feature] Sum up allocation sub classes HOT 3
- [Feature] Allow filtering for accounts HOT 1
- [Feature] Use implicit prices HOT 2
- [Feature] Asset allocation tools
- Fava investor tab fails to load HOT 8
- Asset Allocation Classes-- TypeError: unsupported operand type(s) for /: 'str' and 'int' HOT 3
- Asset Allocation by Class does not convert prices transitively HOT 3
- New fava version breaks fava-investor HOT 3
- Fava 1.26.2 breaks fava _investor HOT 3
- Asset allocation display is broken in Fava 1.25 onwards
- cannot import name 'cost_or_value' from 'fava.template_filters' HOT 3
- Multicurrency Asset Allocation in Fava HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fava_investor.