Giter VIP home page Giter VIP logo

Comments (20)

redstreet avatar redstreet commented on September 11, 2024 2

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.

redstreet avatar redstreet commented on September 11, 2024 1

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.

redstreet avatar redstreet commented on September 11, 2024

@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.

redstreet avatar redstreet commented on September 11, 2024

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.

redstreet avatar redstreet commented on September 11, 2024

@scanta2 / @g40matt, minimal beancount sources to reproduce the issue would be helpful. Thanks!

from fava_investor.

tbm avatar tbm commented on September 11, 2024

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.

tbm avatar tbm commented on September 11, 2024

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.

redstreet avatar redstreet commented on September 11, 2024

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.

tbm avatar tbm commented on September 11, 2024

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.

redstreet avatar redstreet commented on September 11, 2024

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.

redstreet avatar redstreet commented on September 11, 2024

From #56:

I think there are two steps to supporting currency conversion chains:

  1. 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.

  2. 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.

redstreet avatar redstreet commented on September 11, 2024

Also see beancount/fava#1211 (comment)

from fava_investor.

patricklucas avatar patricklucas commented on September 11, 2024

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.

redstreet avatar redstreet commented on September 11, 2024

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.

redstreet avatar redstreet commented on September 11, 2024

If anyone could contribute a few test cases for multicurrency support, I'm happy to work on this.

from fava_investor.

redstreet avatar redstreet commented on September 11, 2024

Some questions for anyone interested in this feature:

  1. Do folks typically specify all their operating currencies as options, like so:
option "operating_currency" "USD"
option "operating_currency" "GBP"

etc.?

  1. How does Fava populate its "Convert to" dropdown list? Does it simply pick all 3-character commodities?

from fava_investor.

redstreet avatar redstreet commented on September 11, 2024

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.

cserb avatar cserb commented on September 11, 2024

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.

redstreet avatar redstreet commented on September 11, 2024

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.

cserb avatar cserb commented on September 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.