Skip to content

Commit 3b657cc

Browse files
committed
DOC: Hide lib.TrailingStrategy __init__ signature in API docs
1 parent a149f2c commit 3b657cc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

backtesting/lib.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,6 @@ def init(self):
356356
__entry_signal = (0,)
357357
__exit_signal = (False,)
358358

359-
__pdoc__['SignalStrategy.__init__'] = False
360-
361359
def set_signal(self, entry_size: Sequence[float],
362360
exit_portion: Sequence[float] = None,
363361
*,
@@ -420,8 +418,6 @@ class TrailingStrategy(Strategy):
420418
__n_atr = 6.
421419
__atr = None
422420

423-
__pdoc__['SignalStrategy.__init__'] = False
424-
425421
def init(self):
426422
super().init()
427423
self.set_atr_periods()
@@ -454,6 +450,12 @@ def next(self):
454450
self.data.Close[-1] + self.__atr[-1] * self.__n_atr)
455451

456452

453+
# Prevent pdoc3 documenting __init__ signature of Strategy subclasses
454+
for cls in list(globals().values()):
455+
if isinstance(cls, type) and issubclass(cls, Strategy):
456+
__pdoc__[f'{cls.__name__}.__init__'] = False
457+
458+
457459
# NOTE: Don't put anything below this __all__ list
458460

459461
__all__ = [getattr(v, '__name__', k)

0 commit comments

Comments
 (0)