You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
can buyback size is calculated as above, however the margin_available is calculated as :
margin_used = sum(trade.value / self._leverage for trade in self.trades)
return self.equity - margin_used
in my case , initial captical 10000, shorted -193 CSCO @46$ , new price is 48$ then equity is 10000+380 profit =10380, this is correct. But the margin_used is 193*46 ~9000, the calculation results in margin available = equity(10380)-margin_used(~9000) =~1300$, then the buyback can only execute 26shares
Steps to Reproduce
Additional info
Branch Order
Backtesting version:
The text was updated successfully, but these errors were encountered:
absolute size of buy/sell seems being correct. It was the defasult percentage (0.95) has the issue.Will try furthur.
Absoulte size is no problem 'cause it's set size , not caculated by margin.
when there is a stock short position, the "cash" should be net equity +"frozen" short position value, thus you can always close short position as long as net equity is positive.
Anyway, absolute size can work~
Expected Behavior
whenI short a stock and hold the negative position, my margin_available should be able to buy_back all the short position.
Actual Behavior
in process_order, and prviously all shorted stock, strategy instructs buyback:
can buyback size is calculated as above, however the margin_available is calculated as :
in my case , initial captical 10000, shorted -193 CSCO @46$ , new price is 48$ then equity is 10000+380 profit =10380, this is correct. But the margin_used is 193*46 ~9000, the calculation results in margin available = equity(10380)-margin_used(~9000) =~1300$, then the buyback can only execute 26shares
Steps to Reproduce
Additional info
Branch Order
The text was updated successfully, but these errors were encountered: