tensortrade.feed.core.operators module

class tensortrade.feed.core.operators.Accumulator(*args, **kwargs)[source]

Bases: Stream[T]

An operator stream that accumulates values of a given stream.

Parameters:
  • func (Callable[[T,T], T]) – An accumulator function.

  • dtype (str) – The data type of accumulated value.

forward()[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.

reset() None[source]

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

class tensortrade.feed.core.operators.Apply(*args, **kwargs)[source]

Bases: Stream[K]

An operator stream that applies a specific function to the values of a given stream.

Parameters:
  • func (Callable[[T], …]) – A function to be applied to the values of a stream.

  • dtype (str, optional) – The data type of the values after function is applied.

forward() K[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.

class tensortrade.feed.core.operators.BinOp(*args, **kwargs)[source]

Bases: Stream[T]

A stream operator that combines the values of two given streams into one value of the same type.

Parameters:
  • op (Callable[[T, T], T]) – The binary operation to be applied.

  • dtype (str, optional) – The data type of the stream.

forward() T[source]

Generates the next value from the underlying data streams.

Returns:

T – The next value in the stream.

generic_name: str = 'bin_op'
has_next() bool[source]

Checks if there is another value.

Returns:

bool – If there is another value or not.

class tensortrade.feed.core.operators.Copy(*args, **kwargs)[source]

Bases: Stream[T]

A stream operator that copies the values of a given stream.

forward() T[source]

Generates the next value from the underlying data streams.

Returns:

T – The next value in the stream.

generic_name: str = 'copy'
has_next() bool[source]

Checks if there is another value.

Returns:

bool – If there is another value or not.

class tensortrade.feed.core.operators.Freeze(*args, **kwargs)[source]

Bases: Stream[T]

A stream operator that freezes the value of a given stream and generates that value.

forward() T[source]

Generates the next value from the underlying data streams.

Returns:

T – The next value in the stream.

generic_name: str = 'freeze'
has_next() bool[source]

Checks if there is another value.

Returns:

bool – If there is another value or not.

reset() None[source]

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

class tensortrade.feed.core.operators.Lag(*args, **kwargs)[source]

Bases: Stream[T]

An operator stream that returns the lagged value of a given stream.

Parameters:
  • lag (int) – The number of steps to lag behind by

  • dtype (str, optional) – The data type of the stream

forward() T[source]

Generates the next value from the underlying data streams.

Returns:

T – The next value in the stream.

generic_name: str = 'lag'
has_next() bool[source]

Checks if there is another value.

Returns:

bool – If there is another value or not.

reset() None[source]

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