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:
tensortrade.feed.core.base.StreamA 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]¶ Bases:
tensortrade.feed.core.base.StreamA 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][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][source]¶ Computes the reduced maximum of the input streams.
- Returns
Stream[T] – A reduced maximum stream.
-
min() → tensortrade.feed.core.base.Stream[T][source]¶ Computes the reduced minimum of the input streams.
- Returns
Stream[T] – A reduced minimum stream.
-
prod() → tensortrade.feed.core.base.Stream[T][source]¶ Computes the reduced product of the input streams.
- Returns
Stream[T] – A reduced product stream.
-
sum() → tensortrade.feed.core.base.Stream[T][source]¶ Computes the reduced sum of the input streams.
- Returns
Stream[T] – A reduced sum stream.