beancount / fava

Fava - web interface for Beancount
https://beancount.github.io/fava/
MIT License
1.93k stars 284 forks source link

Question: how to use it for crypto? #610

Closed vonpupp closed 6 years ago

vonpupp commented 6 years ago

Hi,

I am new to fava and beancount. Let's assume that I can fetch the market value of any coin in python. I would like to use fava as a portfolio manager for cryptocurrencies, something similar to cointrackr to know the current value of the coins I guess this is not possible out of the box. The combination of commodities and holdings menu seems to be the closest thing.

My questions are based on the example.beancount file

Objective 1: Since manually adding the prices to the beancount file is cumbersome, how would you recommend for dynamically querying the prices via API?

Could you please point me into the right direction to achieve this?

Objective 2: If we go one step further, something like this public portfolio example on cryptocompare to know how the portfolio performed over time, I believe I would need to store the prices within the beancount file. Is there a way to see the portfolio performance over time on a graph similar to the commodities price chart? (if possible, if not current valuation of the portfolio should be enough)

Thank you very much.

yagebu commented 6 years ago

Beancount has some tools to automatically fetch prices from online sources, as described in the Price in Beancount documentation. So you could write a Beancount price source that fetches Bitcoin prices from somewhere (or try one of the available ones to see if they have prices for cryptocurrencies). I have to admit I don't use these tools myself, as some of my commodities are not tracked by the available price sources and it seemed easier to download a prices CSV for the last two years or so and convert that with some Python script to Beancount price directives.

Regarding your objective 2, if you have price directives, the Holdings page in Fava gives you (among other things) the current valuation of your portfolio. If you filter for only the corresponding entries, the net worth chart will give you the value of your portfolio over time (so basically the same as the first chart shown on the cryptocompare page you linked). I guess adding some good charts to the Holdings page would also be a sensible enhancement

vonpupp commented 6 years ago

Thank you @yagebu. I need to create a sample beancount file and give this a trial.

I used ledger in the past but in a very simple way. I need to figure out how to properly use beancount first.

I think I am going for option 2 and keeping myself the prices up to date. I hope this does not bloat up the file. Ideally I would like to have a separated prices file, so I can update it automatically on a weekly basis. Do you know if this is possible?

Thanks again! Regards.

alexjj commented 6 years ago

To include separate files use include /path/to/file

Ref.

vonpupp commented 6 years ago

Awesome, thanks @alexjj!

I will be closing the issue. Thanks again to both.