tensortrade.feed.core.operators module

class tensortrade.feed.core.operators.Accumulator(func: Callable[[T, T], T], dtype: str = None)[source]

Bases: tensortrade.feed.core.base.Stream

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(func: Callable[[T], K], dtype: str = None)[source]

Bases: tensortrade.feed.core.base.Stream

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(op: Callable[[T, T], T], dtype: str = None)[source]

Bases: tensortrade.feed.core.base.Stream

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

Bases: tensortrade.feed.core.base.Stream

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

Bases: tensortrade.feed.core.base.Stream

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 = '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(lag: int = 1, dtype: str = None)[source]

Bases: tensortrade.feed.core.base.Stream

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 = '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.