Source code for tensortrade.feed.api.generic.warmup
"""warmup.py contains classes for warm up stream operations."""importnumpyasnpfromtensortrade.feed.core.baseimportStream,T
[docs]classWarmUp(Stream[T]):"""A stream operator for warming up a given stream. Parameters ---------- periods : int Number of periods to warm up. """def__init__(self,periods:int)->None:super().__init__()self.count=0self.periods=periods
@Stream.register_generic_method(["warmup"])defwarmup(s:"Stream[T]",periods:int)->"Stream[T]":"""Creates a warmup stream. Parameters ---------- s : `Stream[T]` A generic stream. periods : int Number of periods to warm up. Returns ------- `Stream[T]` The warmup stream of `s`. """returnWarmUp(periods=periods)(s)