tensortrade.feed.api.generic.reduce module¶
reduce.py contains functions and classes for reducing multiple streams into a single stream.
-
class
tensortrade.feed.api.generic.reduce.
Aggregate
(func: Callable[[List[T]], T])[source]¶ Bases:
tensortrade.feed.core.base.Stream
A multi-stream operator for aggregating multiple streams into a single stream.
Parameters: func (Callable[[List[Stream]], T]) – A function for aggregating the value of multiple streams. -
forward
() → T[source]¶ Generates the next value from the underlying data streams.
Returns: T – The next value in the stream.
-
generic_name
= 'reduce'¶
-
-
class
tensortrade.feed.api.generic.reduce.
Reduce
(dtype: str = None)[source]¶ Bases:
tensortrade.feed.core.base.Stream
A stream for reducing multiple streams of the same type.
Parameters: dtype (str, optional) – The data type of the aggregated stream. -
agg
(func: Callable[[List[T]], T]) → tensortrade.feed.core.base.Stream[~T][T][source]¶ Computes the aggregation of the input streams.
Returns: Stream[T] – An aggregated stream of the input streams.
-
forward
() → List[T][source]¶ Generates the next value from the underlying data streams.
Returns: T – The next value in the stream.
-
has_next
() → bool[source]¶ Checks if there is another value.
Returns: bool – If there is another value or not.
-
max
() → tensortrade.feed.core.base.Stream[~T][T][source]¶ Computes the reduced maximum of the input streams.
Returns: Stream[T] – A reduced maximum stream.
-
min
() → tensortrade.feed.core.base.Stream[~T][T][source]¶ Computes the reduced minimum of the input streams.
Returns: Stream[T] – A reduced minimum stream.
-