expanding.py contains functions and classes for expanding stream operations.

class tensortrade.feed.api.float.window.expanding.Expanding(min_periods: int = 1)[source]

A stream that generates the entire history of a stream at each time step.

Parameters: min_periods (int, default 1) – The number of periods to wait before producing values from the aggregation function.
agg(func: Callable[[List[float]], float]) → tensortrade.feed.core.base.Stream[float][float][source]

Computes an aggregation of a stream’s history.

Parameters: func (Callable[[List[float]], float]) – A aggregation function. Stream[float] – A stream producing aggregations of the stream history at each time step.
count() → tensortrade.feed.core.base.Stream[float][float][source]

Computes an expanding count fo the underlying stream.

Returns: Stream[float] – An expanding count stream.
forward() → List[float][source]

Generates the next value from the underlying data streams.

Returns: T – The next value in the stream.
generic_name = 'expanding'
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[float][float][source]

Computes an expanding maximum fo the underlying stream.

Returns: Stream[float] – An expanding maximum stream.
mean() → tensortrade.feed.core.base.Stream[float][float][source]

Computes an expanding mean fo the underlying stream.

Returns: Stream[float] – An expanding mean stream.
median() → tensortrade.feed.core.base.Stream[float][float][source]

Computes an expanding median fo the underlying stream.

Returns: Stream[float] – An expanding median stream.
min() → tensortrade.feed.core.base.Stream[float][float][source]

Computes an expanding minimum fo the underlying stream.

Returns: Stream[float] – An expanding minimum stream.
reset() → None[source]

Resets all inputs to and listeners of the stream and sets stream value to None.

std() → tensortrade.feed.core.base.Stream[float][float][source]

Computes an expanding standard deviation fo the underlying stream.

Returns: Stream[float] – An expanding standard deviation stream.
sum() → tensortrade.feed.core.base.Stream[float][float][source]

Computes an expanding sum fo the underlying stream.

Returns: Stream[float] – An expanding sum stream.
var() → tensortrade.feed.core.base.Stream[float][float][source]

Computes an expanding variance fo the underlying stream.

Returns: Stream[float] – An expanding variance stream.
class tensortrade.feed.api.float.window.expanding.ExpandingCount[source]

A stream operator that counts the number of non-missing values.

forward() → float[source]

Generates the next value from the underlying data streams.

Returns: T – The next value in the stream.
class tensortrade.feed.api.float.window.expanding.ExpandingNode(func: Callable[[List[float]], float])[source]

A stream operator for aggregating an entire history of a stream.

Parameters: func (Callable[[List[float]], float]) – A function that aggregates the history of a stream.
forward() → float[source]

Generates the next value from the underlying data streams.

Returns: T – The next value in the stream.
has_next()[source]

Checks if there is another value.

Returns: bool – If there is another value or not.
tensortrade.feed.api.float.window.expanding.expanding(s: tensortrade.feed.core.base.Stream[float][float], min_periods: int = 1) → tensortrade.feed.core.base.Stream[typing.List[float]][List[float]][source]

Computes a stream that generates the entire history of a stream at each time step.

Parameters: s (Stream[float]) – A float stream. min_periods (int, default 1) – The number of periods to wait before producing values from the aggregation function.