The error in float calculations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 48.7k
- Forks
- 7.7k
- PR merge metrics
- No merged PRs in 30d
Description
In Position.py, the function sell_stock() will check np.isclose(self.position[stock_id]["amount"], trade_amount), but I found a bug that this check is False, and self.position[stock_id]["amount"] < -1e-5 is True. The reason of this problem may be the error in float calculations.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Position.py at sell_stock() and inspect the np.isclose check alongside the reported self.position[stock_id]["amount"] < -1e-5 condition. Reproduce the float-calculation case and determine the expected handling for the remaining amount; done when the reported inconsistency is resolved and the behavior is covered by a regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- fintech-quant
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100