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(*args, **kwargs)[source]¶
Bases:
Stream
[T
]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.
- class tensortrade.feed.api.generic.reduce.Reduce(*args, **kwargs)[source]¶
-
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]) Stream[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() Stream[T] [source]¶
Computes the reduced maximum of the input streams.
- Returns:
Stream[T] – A reduced maximum stream.
- min() Stream[T] [source]¶
Computes the reduced minimum of the input streams.
- Returns:
Stream[T] – A reduced minimum stream.