Hey, just trying to figure out the timing for my rebalancing code.  I think its a simple problem.  I'm in pacific time so I tried to time out the rebalance on the time stamps on the log reports which is 7 hours ahead of my current time and also on Eastern time, 3 hours ahead, and my current time (PST).  It will rebalance fine on back testing but not on live.  The following schedule should rebalance on the 15th of the month at 1:30pm EST correct (10:30am PST)?

On initialize:

  1. self.Schedule.On(self.DateRules.MonthStart(14),self.TimeRules.At(13, 30), self.RebalancingCode)
  1. def RebalancingCode(self):
  2. btccoins = self.Portfolio.CashBook["BTC"].Amount
  3. ethcoins = self.Portfolio.CashBook["ETH"].Amount
  4. if btccoins > 0.00001:
  5. self.SetHoldings("BTCUSD", 0.3)
  6. if ethcoins > 0.00001:
  7. self.SetHoldings("ETHUSD", 0.335)

 

Author

David E

June 2021