wichtounet / budgetwarrior

Personal finance manager, command-line interface, in C++
MIT License
112 stars 16 forks source link

Support for fractional shares #29

Open nicdumz opened 1 year ago

nicdumz commented 1 year ago

I see that asset_share.shares is an int64. While this generally makes sense intuitively, this means that it becomes hard to use budgetwarrior for share vesting schemes.

In my case, my employer awards me for instance 20 shares of restricted stock, but after withholding taxes, my broker credits me 18.84 shares. So technically if I wanted to automatically track share awards, I would want to to log the acquisition of 18.84 shares, heh.

(And 40 becomes.... 37.681 ? for fascinating rounding reasons I suppose)

For curiosity, I wondered if there's an industry standard on what makes sense, but alas I'm not sure there is anything out there. Fascinating :-)

wichtounet commented 1 year ago

Indeed, I have never traded in fractional shares myself, so never saw the need for it on the tracker. But that's a very fair point.

It should be fairly straightforward to implement with two decimal places since I already have code for that, but looking at your link and your example, I think we will need more decimal places.

Once I finish the current refactorings I have started, I will try to add this support 👍