andreasgerstmayr / fava-portfolio-returns

fava-portfolio-returns shows portfolio returns in Fava
GNU General Public License v2.0
38 stars 2 forks source link

compute_portfolio_returns error #2

Closed michaelMinar closed 1 year ago

michaelMinar commented 1 year ago

Hi, I'm super excited to see this plugin come to life. It's been a missing piece in my analysis for a little while now. I tried pip installing your package and configuring the plugin in my personal ledger - as well as setting up a config.pbtxt to construct portfolios.

Fava starts fine and I can even click the Portfolio Returns section and see a lifetime performance table of my various strategies. However, when I click on one of the strategies to see the graph of cash flows and performance, I get an error - saying the server "Encountered an internal error". When i look at the logs coming from the terminal I see the following message

File "/Users/mminar/.pyenv/versions/3.9.9/envs/bean/lib/python3.9/site-packages/fava_portfolio_returns/__init__.py", line 201, in create_plots
    value_dates, value_values = returnslib.compute_portfolio_values(
TypeError: compute_portfolio_values() takes 2 positional arguments but 3 were given

Do you have any guidance on how to resolve this? Many thanks in advance.

andreasgerstmayr commented 1 year ago

Hi @michaelMinar

I had to fork beangrow and add the third parameter to compute_portfolio_values, otherwise it renders the portfolio value chart always in USD instead of the actual cost currency: https://github.com/beancount/beangrow/pull/21

I specified the fork and exact commit in setup.cfg: https://github.com/andreasgerstmayr/fava-portfolio-returns/blob/9d2e13092318595b266df9ece608366ca7dcbc3b/setup.cfg#L18 So I'd try to remove the virtualenv and re-install the dependencies again. Or manually install my fork of beangrow (https://github.com/andreasgerstmayr/beangrow) until the MR is merged in the upstream beangrow repository.

michaelMinar commented 1 year ago

That worked great, thank you! I cleared out the old virtualenv and a fresh install of fava and your package worked!

There is sometimes a bit of a delay in loading the fava top level view on start-up. Is that possibly due to the compute_returns function taking a while to work through my ledger's history? There's nothing in the logs when this delay happens, but if I disable your plugin the top level page loads right away on start-up.

andreasgerstmayr commented 1 year ago

I've moved the perf issues to #4, as the original issue is resolved.