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

feat: make accounts avaiable in ledger variable #31

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

fengkx
Copy link
Contributor

@fengkx fengkx commented Feb 25, 2024

It is useful to be able to access account meta.

For example in the asset classess, I have an account like this:

2023-02-06 open Assets:Funds CNY
    asset_class: "Funds"

2023-02-05 commodity CNY
    asset_class: "Cash"

It is OTC Funds pricing in CNY, though CNY commodity is Cash the Funds should not classify as Cash.

@andreasgerstmayr
Copy link
Owner

I'm not sure if I follow, shouldn't the fund be declared as a new commodity?

From the docs: https://beancount.github.io/docs/trading_with_beancount.html
The IBM stock is traded in USD, but it has its own commodity in beancount.

@fengkx
Copy link
Contributor Author

fengkx commented Feb 27, 2024

You are correct for stock trading. But for some cases I don't care about the price of a fund but only ammount.

For example: Suppose I invest $100 in a certain fund every week. I invest based on the amount, but I don't care about how many units I have obtained and the net value given after the market closes that day.

There are some funds called OTC(Over-the-counter ) funds, which generally trade through distribution agencies and direct sales platforms of fund companies instead of stock exchanges. Usually, it calculates the net asset value of the fund based on the closing price of each trading day. In China, daily and total profit and loss amounts are generally displayed on bank pages, with less attention paid to unit prices. And compared to on-exchange trading of ETF, it is more difficult for us to obtain prices through API(bean-price).

@andreasgerstmayr
Copy link
Owner

I think the same applies for ETFs/funds as well (new commodity per fund). I agree that the unit price is not really interesting in the case of e.g. an ETF, but imho it's required to accurately track the increase/decrease of the fund over time. I also had the case once that the fund price was not easy to obtain, so I ended up parsing the PDF of my bank 😬.

In any case, I'm not opposed to this change, so I'll merge it. Thanks!

@andreasgerstmayr andreasgerstmayr merged commit 0e1b66f into andreasgerstmayr:main Feb 28, 2024
1 check failed
@fengkx
Copy link
Contributor Author

fengkx commented Feb 29, 2024

Thanks, For now I just pad those accounts periodically. :) It is too difficult to calculate the units when I buying it. Not perfect but enough fo me.

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

Successfully merging this pull request may close these issues.

2 participants