-
-
Notifications
You must be signed in to change notification settings - Fork 987
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
Broker Cash, Strange Metric #493
Comments
Can you rather show some code? Note, everything prefixed with an underscore is, as customary, private API with no explicit guarantees. |
Cash is only changed when the trade is closed. I understand the underscore variables are private -- however, I found this because I was interested in creating an enhancement to plot the available cash. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
The text was updated successfully, but these errors were encountered: