JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

Backtrader - leverage.py error

发布时间 2023-08-30 10:25:30作者: chankuang

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。

 

    本栏目推荐文章
  • A connection was successfully established with the server but then an error
  • vscode错误:Unable to connect to VS Code server: Error in request.
  • 【解决方案】Error running,Command line is too long
  • fish和pacman:“error: Unable to read input file: 是一个目录”报错的处理
  • ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password'
  • mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; ERROR 1410 (42000): You are not allowed to create a user with GRANT
  • "nginx.conf" E514 : write error (file system full?)
  • redis报错MISCONF Errors writing to the AOF file: No space left on device,磁盘满无法写入数据报错
  • Flutter 项目运行到ios模拟器报错 : Error (Xcode): SDK does not contain 'libarclite'
  • c++编译OpenSceneGraph-3.4 出现 error: narrowing conversion of ‘-1’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们