Fix: add _approx_equal_price_rounding to allow price in accepable range #571
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: add _approx_equal_price_rounding to allow price in accepable range
Amount difference can be caused by rounding errors in the unit price.
Schwab rounds down the price to 4 decimal places so that the error in amount can be more than $0.01.
Fox example:
500 shares of FOO sold at $100.00016 with $1.23 fees.
"01/01/2024,"Sell","FOO","FOO","500","$100.0001","$1.23","$49,998.85"
calculated_amount = 500 * 100.0001 - 1.23 = 49998.82
amount_on_record = 49998.85 vs calculated_amount = 49998.82
In this PR change, the acceptable range of unit price is within $0.0001 when compare price on record and from retro calculation.