tensortrade.feed.api.float.window.expanding module

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

class tensortrade.feed.api.float.window.expanding.Expanding(*args, **kwargs)[source]

Bases: tensortrade.feed.core.base.Stream

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][source]

Computes an aggregation of a stream’s history.

Parameters

func (Callable[[List[float]], float]) – A aggregation function.

Returns

Stream[float] – A stream producing aggregations of the stream history at each time step.

count()tensortrade.feed.core.base.Stream[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: str = '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][source]

Computes an expanding maximum fo the underlying stream.

Returns

Stream[float] – An expanding maximum stream.

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

Computes an expanding mean fo the underlying stream.

Returns

Stream[float] – An expanding mean stream.

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

Computes an expanding median fo the underlying stream.

Returns

Stream[float] – An expanding median stream.

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

Computes an expanding minimum fo the underlying stream.

Returns

Stream[float] – An expanding minimum stream.

std()tensortrade.feed.core.base.Stream[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][source]

Computes an expanding sum fo the underlying stream.

Returns

Stream[float] – An expanding sum stream.

var()tensortrade.feed.core.base.Stream[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(*args, **kwargs)[source]

Bases: tensortrade.feed.api.float.window.expanding.ExpandingNode

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(*args, **kwargs)[source]

Bases: tensortrade.feed.core.base.Stream

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], min_periods: int = 1)tensortrade.feed.core.base.Stream[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.