backtrader.errors module¶
Exception Classes Module - Custom exceptions for backtrader.
This module defines the exception hierarchy used throughout the backtrader framework.
- Classes:
BacktraderError: Base exception for all backtrader exceptions. StrategySkipError: Raised to skip a strategy during optimization. ModuleImportError: Raised when a required module cannot be imported. FromModuleImportError: Raised when a from-style import fails.
示例
Raising StrategySkipError during optimization: >>> class MyStrategy(bt.Strategy): ... params = (('period', 20),) ... ... def __init__(self): ... if self.p.period < 5: ... raise bt.errors.StrategySkipError()
- exception backtrader.errors.BacktraderError[源代码]¶
基类:
ExceptionBase exception for all backtrader exceptions.