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
Modelling Shorts #9
Comments
Hi Martin, Still need to do some more testing on shorting, so not everything might work as I explain here. But the thoughts behind it: Equity = Cash + Total Positions (and so equity is stable and should only change if there are some new profits, not if you only buy or sell assets) As a consequence, if you short (just as you noticed) => Total Positions decreases, Cash increases and equity stays the same. However in the roboquant it is not the cash but the BuyingPower that decides if you can still buy more assets. So the idea is that BuyingPower decreases because of Margin requirements on the short position you acquired (just like real life). The default BuyingPowerModel used by the SimBroker is not good for shorting since its models a Cash account and not a Margin Account. So you can short as much as you like, since Cash will only increase. But you could use the MarginBuyingPower.
Still, this is not the best tested part (euphemism) , so there are still bugs in the BuyingPowerModel for margin accounts. If you have a good use case, happy to take a more detailed look into that to ensure the BuyPowerModel works as expected. regards, |
Hi Peter, |
Hi,
We've stumbled on a limitation that we haven't been able to circunvent while backtesting shorts. We are currently using BracketOrders for our trades, but the problem happens on every order type. When the sim broker updates the account and makes a withdraw, it actually increases the account's cash amount when we are shorting (which is consistent with the sell operation), but it is not something that happens in a real exchange. Do you have a suggestion regarding using short on the sim broker? Our current idea would be to create a new simbroker handling this. We could also try to support this on current simbroker.
Regards,
Martin
The text was updated successfully, but these errors were encountered: