Backtrader broker gives me unlimited margin on shorts
lukeplausin last edited by
First I'd like to say great work on the project - it's years ahead of the other modules which I've tried using.
I've noticed that there is a problem with the broker code (or maybe the problem is just in the way that I am using it). I am experimenting with a strategy where I vary the size of a short position based on some factors - one of which is the amount of cash available.
When the short position is opened, the value of the position is added to the cash balance, and my strategy is allowed to continually increase the short position until the end of the test where the final balance is -1e20 USD.
When I open up a short position with my real broker my cash will decrease because I need post collateral - and I cannot open or increase a short position unless there is enough margin in my account.
Has this problem been observed before? I'm happy to contribute to the project if I can.
bthas two options to consider cash from short positions. Check out Blog - Shorting the cash