Skip to content
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

Can't view "Asset Allocation Classes": I get the error "Message Corrupt" #56

Closed
JaneSmith opened this issue Feb 27, 2021 · 6 comments
Closed

Comments

@JaneSmith
Copy link

I'm trying to get Fava Investor working but am having some trouble.

I'll say first of all that it works fine if I open the included example file. However when I use my own ledger file, clicking "Asset Allocation Classes" gives me the following error message:

Loading http://127.0.0.1:35335/my-ledger/extension/Investor/?module=aa_class failed: Message Corrupt

I can view the "Asset Allocation Accounts", "Cash Drag" and "Tax Loss Harvestor" pages just fine. The problem only occurs on the "Asset Allocation Classes" page, which is the most important one to me and the entire reason why I wanted to use the extension.

Since it works with the example file, I'm not sure whether this is a bug in the extension or something I'm doing wrong with my ledger. Obviously I don't want to post my real ledger files for privacy reasons. As far as I can tell, I'm doing the same thing as in the example though.

I have this at the top of my file:

2000-01-01 custom "fava-extension" "fava_investor" "{
	'tlh' : {
		'account_field': 'account',
		'accounts_pattern': 'Assets:',
		'loss_threshold': 10,
		'wash_pattern': 'Assets:',
	},
	'asset_alloc_by_account': [{
		'title':            'Allocation by Account',
		'pattern_type':     'account_name',
		'pattern':          'Assets:.*',
	},
	{
		'title':            'Allocation by Taxability',
		'pattern_type':     'account_name',
		'pattern':          'Assets:[^:]*$',
		'include_children': True,
	}],
	'asset_alloc_by_class' : {
		'accounts_patterns': ['Assets:.*'],
	},
}"

And I also define all the commodities I'm using. Here are some examples:

2021-02-12 commodity GBP
	name: "Pound sterling"
	asset-class: "Cash"
	asset_allocation_Cash: 100

2021-02-12 commodity USD
	name: "US dollar"
	asset-class: "Cash"
	asset_allocation_Cash: 100

2021-02-16 commodity XAU
	name: "Gold (troy ounce)"
	asset-class: "Commodity"
	asset-subclass: "Gold"
	asset_allocation_PreciousMetals_Gold: 100

2021-02-16 commodity XAG
	name: "Silver (troy ounce)"
	asset-class: "Commodity"
	asset-subclass: "Silver"
	asset_allocation_PreciousMetals_Silver: 100

2021-02-16 commodity ETH
	name: "Ethereum"
	asset-class: "Cryptocurrency"
	asset_allocation_Cryptocurrencies_Ethereum: 100

2021-02-16 commodity AMD
	name: "Advanced Micro Devices, Inc."
	asset-class: "Stock"
	asset_allocation_Stocks_Tech: 100

Any idea why this isn't working or what I can do to troubleshoot it?

@JaneSmith
Copy link
Author

Okay, I realised I could run Fava via the terminal to check there for any error outputs. Perhaps Fava Investor could display the error message itself to make it easier to troubleshoot? "Message Corrupt" is very vague!

From the terminal, I could see clearly that it was complaining that it couldn't convert AMD to GBP and suggested that I was missing a price directive. After adding a price directive for AMD in GBP, it works.

However, I am still confused as to whether this is a bug or not. I already had a price directive for AMD in USD, a price directive for GBP in USD, and a price directive for USD in GBP. Surely from these, it should have been possible to work out AMD in GBP?

@redstreet
Copy link
Owner

Glad you found the problem. Perhaps the README should mention checking the console for errors.

Plugins unfortunately don't have much control over the error message to display. There may be a way, or upgrades to fava may be required, I haven't looked.

You're right, it's currently a limitation that currency conversion chains are not followed. One problem is, multiple chains can cause multiple valid but different answers. Another is determining the preferred currency automatically. More in #32. I'll get to it at some point, probably not soon. But PRs are most welcome.

Glad you found the AA useful!

@JaneSmith
Copy link
Author

Thanks a lot for clearing that up.

I'm a little bit confused as to why the extension doesn't support currency conversion chains. As far as I can tell, Fava itself does. As in this example, I've had price directives for AMD to USD and then for USD to GBP. If I look at my Balance Sheet in Fava, choose "Converted to GBP" and view my Assets, I can see that the AMD shares are correctly converted to GBP. Couldn't Fava Investor just handle it the same way as Fava, whatever that way is?

In any case, I'll follow the issue you linked. Should this one be closed?

@redstreet
Copy link
Owner

Mostly because I just haven't had the time as the sole contributor :). This is not completely trivial, but likely isn't difficult either, just requires, time, thought, and testing.

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?

@redstreet
Copy link
Owner

Yes please, let's continue the discussion in #32. I'll close this one, feel free to reopen or open a new issue as needed.

@redstreet
Copy link
Owner

README updated in fe16c06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants