Skip to content

Commodity Definition for base currency confuses compute_returns.py #10

Open
@cerebore

Description

In my beancount file I have this;

1999-12-31 commodity USD
  export: "CASH"
  name: "United States Dollar"

It causes configure.py to produce

  investment {
    currency: "USD"
    asset_account: "Assets:Coinbase:USD"
    cash_accounts: "Assets::Checking"
  }

This in turn confuses compute returns.py during generate_price_pages because it causes a CurrencyPair to exist ('USD', 'USD'):

$ beangrow/beangrow/compute_returns.py xxxxx.beancount config beangrow_output

Traceback (most recent call last):
  File "beangrow/beangrow/compute_returns.py", line 105, in <module>
    main()
  File "beangrow/beangrow/compute_returns.py", line 94, in main
    reports.generate_price_pages(account_data_map,
  File "xxxxx/beangrow/beangrow/reports.py", line 529, in generate_price_pages
    all_prices = prices.get_all_prices(price_map, base_quote)
  File "/usr/local/lib/python3.8/dist-packages/beancount/core/prices.py", line 197, in get_all_prices
    return _lookup_price_and_inverse(price_map, base_quote)
  File "/usr/local/lib/python3.8/dist-packages/beancount/core/prices.py", line 172, in _lookup_price_and_inverse
    return price_map[base_quote]
KeyError: ('USD', 'USD')

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions