Ok, thanks, let me try
On Monday, April 28, 2025 at 4:10:44 PM UTC+2 Julien Stern wrote:
> Maybe this will cause more problems than it solves (I am very unfamiliar
> with the beangrow code), but I ran into this problem myself and added the
> following 2 lines to beangrow to make it work.
> Hope this helps.
>
> try:
> return price_map[base_quote]
> except KeyError as exc:
> base, quote = base_quote
>
>
>
> * # Add this if base == quote: return
> [("1970-01-01", 1)]; # End*
> prices = price_map.get((quote, base), None)
> if prices:
> return prices
> else:
> raise
>
>
> Le dimanche 30 mars 2025 à 20:52:52 UTC+2, Chary Ev2geny a écrit :
>
>> Ok,
>>
>> thanks for clarification
>>
>> On Saturday, March 29, 2025 at 11:49:06 PM UTC+1 [email protected] wrote:
>>
>>>
>>> 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/0a907dd0-c8d3-476f-8bcd-3c6ef5417c6cn%40googlegroups.com.