I would like to calculate the current ratio of those holdings securites so that I will rebalance if the ratio is not what I want.

Attached backtest:

  1. I use self.SetHoldings() to hold SPY with 50% of my account equity.
  2. I will calculate the value of my holdings monthly
  3. I will rebalance it and always balance to 50%
I would like to ask if the way I used to calculate the security ratio is correct or not, for example, is the TotalCloseProfit() included the fee. Those calculation is around line 27-28.Thank you very much.

Author