Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure.py ignores closed accounts #12

Open
gety9 opened this issue Sep 14, 2021 · 1 comment
Open

Configure.py ignores closed accounts #12

gety9 opened this issue Sep 14, 2021 · 1 comment

Comments

@gety9
Copy link

gety9 commented Sep 14, 2021

simple.beancount

option "operating_currency" "USD"
plugin "beancount.plugins.check_commodity"
plugin "beancount.plugins.implicit_prices"

2005-01-01 commodity USD
2005-01-01 commodity AAA
2005-01-01 commodity BBB

2019-01-01 open Assets:Investments:Cash     USD
2019-01-01 open Income:Investments:Gains    USD
2019-01-01 open Assets:Investments:AAA      AAA
2019-01-01 open Assets:Investments:BBB      BBB

2019-01-01 * "Buy AAA"
  Assets:Investments:AAA                    100 AAA {100 USD}
  Assets:Investments:Cash                -10000 USD

2019-01-01 * "Buy BBB"
  Assets:Investments:BBB                    100 BBB {200 USD}
  Assets:Investments:Cash                -20000 USD

2020-01-01 * "Sell AAA"
  Assets:Investments:AAA                   -100 AAA {100 USD} @200
  Income:Investments:Gains               -10000 USD
  Assets:Investments:Cash                 20000 USD

2020-01-01 * "Sell BBB"
  Assets:Investments:BBB                   -100 BBB {200 USD} @400
  Income:Investments:Gains               -20000 USD
  Assets:Investments:Cash                 40000 USD

2019-07-01 price AAA                        150 USD
2019-07-01 price BBB                        300 USD

After running python beangrow/configure.py -v simple.beancount > conf-simple we get following conf-simple (everything is as expected)

investments {
  investment {
    currency: "AAA"
    asset_account: "Assets:Investments:AAA"
    cash_accounts: "Assets:Investments:Cash"
  }
  investment {
    currency: "BBB"
    asset_account: "Assets:Investments:BBB"
    cash_accounts: "Assets:Investments:Cash"
  }
}
groups {
  group {
    name: "currency.AAA"
    investment: "Assets:Investments:AAA"
  }
  group {
    name: "currency.BBB"
    investment: "Assets:Investments:BBB"
  }
}

But if we close account AAA (after we sold investment)

option "operating_currency" "USD"
plugin "beancount.plugins.check_commodity"
plugin "beancount.plugins.implicit_prices"

2005-01-01 commodity USD
2005-01-01 commodity AAA
2005-01-01 commodity BBB

2019-01-01 open Assets:Investments:Cash     USD
2019-01-01 open Income:Investments:Gains    USD
2019-01-01 open Assets:Investments:AAA      AAA
2020-01-01 close Assets:Investments:AAA
2019-01-01 open Assets:Investments:BBB      BBB

2019-01-01 * "Buy AAA"
  Assets:Investments:AAA                    100 AAA {100 USD}
  Assets:Investments:Cash                -10000 USD

2019-01-01 * "Buy BBB"
  Assets:Investments:BBB                    100 BBB {200 USD}
  Assets:Investments:Cash                -20000 USD

2020-01-01 * "Sell AAA"
  Assets:Investments:AAA                   -100 AAA {100 USD} @200
  Income:Investments:Gains               -10000 USD
  Assets:Investments:Cash                 20000 USD

2020-01-01 * "Sell BBB"
  Assets:Investments:BBB                   -100 BBB {200 USD} @400
  Income:Investments:Gains               -20000 USD
  Assets:Investments:Cash                 40000 USD

2019-07-01 price AAA                        150 USD
2019-07-01 price BBB                        300 USD

after running python beangrow/configure.py -v simple.beancount > conf-simple we get following conf-simple (account AAA is ignored)

investments {
  investment {
    currency: "BBB"
    asset_account: "Assets:Investments:BBB"
    cash_accounts: "Assets:Investments:Cash"
  }
}
groups {
  group {
    name: "currency.BBB"
    investment: "Assets:Investments:BBB"
  }
}
@redstreet
Copy link

Using the --start-date option to configure.py works correctly. However, the default behavior, when that option is not used is unintuitive IMHO. Possible solutions:

  • use an arbitrary default of say, 15 years for the start date (still trips up users)
  • Assume start date is the beginning of time, unless otherwise configured

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants