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

schwab_equity_award_json parser can introduce rounding errors in share quantity #574

Closed
m01 opened this issue Dec 6, 2024 · 0 comments · Fixed by #575
Closed

schwab_equity_award_json parser can introduce rounding errors in share quantity #574

m01 opened this issue Dec 6, 2024 · 0 comments · Fixed by #575

Comments

@m01
Copy link
Contributor

m01 commented Dec 6, 2024

The schwab_equity_award_json parser can introduce rounding errors when selling an integer number of shares, which can trigger asserts later.

The workaround in https://github.com/KapJI/capital-gains-calculator/blob/main/cgt_calc/parsers/schwab_equity_award_json.py#L232-L282 for dealing with missing decimal numbers after the decimal point in some early Schwab exports can introduce rounding errors in the quantity of shares being sold, which can later trigger asserts (e.g. the one that checks if you're selling more shares than you have).

The problematic line is https://github.com/KapJI/capital-gains-calculator/blob/main/cgt_calc/parsers/schwab_equity_award_json.py#L282.

I'll try to come up with a repro and will update this bug accordingly. (EDIT: done, see #575)

I think a simple fix is to check if you can reproduce the sale total $ number from the transaction using the per share price, quantity, fees and rounding.

m01 added a commit to m01/capital-gains-calculator that referenced this issue Dec 14, 2024
…ulation.

This can introduce rounding errors.

This fixes KapJI#574.

This contribution has been developed in my spare time.
m01 added a commit to m01/capital-gains-calculator that referenced this issue Dec 14, 2024
…ulation.

This can introduce rounding errors.

This fixes KapJI#574.

This contribution has been developed in my spare time.
m01 added a commit to m01/capital-gains-calculator that referenced this issue Dec 14, 2024
…ulation.

This can introduce rounding errors.

This fixes KapJI#574.

This contribution has been developed in my spare time.
@KapJI KapJI closed this as completed in 5ad2d52 Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant