Broker Cash, Strange Metric
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
### Expected Behavior
Start with $1000
Buy $100 of stock
self._broker._cash should be $900.
Sell $150 of stock
self._broker._cash should be $1050
### Actual Behavior
Start with $1000
Buy $100 of stock
self._broker._cash doesn't change
Sell $150 of stock
self._broker._cash is now $1050 (cash += closed_trade.pl)
I don't understand this behavior. The variable is named cash, but it's not really the current cash value.
If you want to make trades based on your actual available cash, self._broker.margin_available seems to be what you want... but that seems strange.
Am I missing something here?
Contributor guide
Research direction
Start by tracing the broker's _cash and margin_available values through the buy and sell examples in the issue. Determine whether the observed behavior is intentional or a defect, then define the expected cash semantics and verify the behavior with focused trading scenarios. The issue does not name a source file or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- fintech-quant
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100