I ran into this myself when I first tried using beangrow. Debugging into 
the code a bit, I believe the problem is that beangrow doesn't support 
investments with the "core" currency (i.e. USD). If you look at the example 
ledger file and config in the beangrow repo, you'll see that all of the 
configured investments are for a non-USD commodity.


On Wednesday, March 19, 2025 at 7:03:05 AM UTC-6 Chary Ev2geny wrote:

> Dear all,
>
> I struggling to run beangrow for the following configuration:
>
> Ledger
>
>
> 2019-12-31 open Assets:Cash
> 2019-12-31 open Equity:Initial-balance
> 2019-12-31 open Assets:Investments
> 2019-12-31 open Income:Investments-Gains
>
> 2019-12-31 commodity HOO
> 2019-12-31 commodity USD
>
>
> 2019-12-31 * "Initial balance"
>   Assets:Cash                  100 USD
>   Equity:Initial-balance      -100 USD
>
> 2020-01-01 price HOO 10 USD
>
> 2020-01-01 * "Investing"
>     Assets:Investments        100  USD
>     Assets:Cash              -100  USD
>
> 2020-12-31 * "Y2020 accumulated gains from investments"
>     Assets:Investments              100 USD
>     Income:Investments-Gains       -100 USD
>
>
> Configuration file
>
>
> investments {
>   investment {
>     currency: "USD"
>     asset_account: "Assets:Investments"
>     cash_accounts: "Assets:Cash"
>   }
> }
>
>
> groups {
>   group {
>     name: "MyInvest"
>     investment: "Assets:Investments"
>   }
>   
> }
> When I run beangrow, I get the following errors:
>
> C:\_code\py\beangrow>uv run beangrow-returns 
> C:\_code\pytest\beangrouw_exp\test.bean 
> C:\_code\pytest\beangrouw_exp\test.pbtxt 
> C:\_code\pytest\beangrouw_exp\reports
> Traceback (most recent call last):
>   File "<frozen runpy>", line 198, in _run_module_as_main
>   File "<frozen runpy>", line 88, in _run_code
>   File 
> "C:\_code\py\beangrow\.venv\Scripts\beangrow-returns.exe\__main__.py", line 
> 10, in <module>
>   File "C:\_code\py\beangrow\beangrow\compute_returns.py", line 94, in main
>     reports.generate_price_pages(account_data_map,
>   File "C:\_code\py\beangrow\beangrow\reports.py", line 685, in 
> generate_price_pages
>     all_prices = prices.get_all_prices(price_map, base_quote)
>                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File 
> "C:\_code\py\beangrow\.venv\Lib\site-packages\beancount\core\prices.py", 
> line 309, in get_all_prices
>     return _lookup_price_and_inverse(price_map, base_quote)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File 
> "C:\_code\py\beangrow\.venv\Lib\site-packages\beancount\core\prices.py", 
> line 284, in _lookup_price_and_inverse
>     return price_map[base_quote]
>            ~~~~~~~~~^^^^^^^^^^^^
> KeyError: ('USD', 'USD')
>
> Any suggestions how to fix?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/a0106515-f648-4efa-9c23-89e70802d19fn%40googlegroups.com.

Reply via email to