1.0 leverage.py error
如果成交後,本金不變,會触發0/self._value error。
2.0 debug
def next(self): # Updates the leverage for "dtkey" (see base class) for each cycle # 0.0 if 100% in cash, 1.0 if no short selling and fully invested try: lev = (self._value - self._cash) / self._value except: lev = 0 self.rets[self.data0.datetime.datetime()] = lev
leverage.py,line 61~74。