feed.api.float package

Submodules

feed.api.float.accumulators module

class feed.api.float.accumulators.CumMax(skip_na: bool = True)[source]

Bases: feed.core.base.Stream

A stream operator that creates a cumulative maximum of values.

Parameters:skip_na (bool, default True) – Exclude NA/null values. If a value is NA, the result will be NA.

References

[1] https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.cummax.html

forward() → float[source]

Generates the next value from the underlying data streams.

Returns:The next value in the stream.
Return type:T
has_next() → bool[source]

Checks if there is another value.

Returns:If there is another value or not.
Return type:bool
class feed.api.float.accumulators.CumMin(skip_na: bool = True)[source]

Bases: feed.core.base.Stream

A stream operator that creates a cumulative minimum of values.

Parameters:skip_na (bool, default True) – Exclude NA/null values. If a value is NA, the result will be NA.

References

[1] https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.cummin.html

forward() → float[source]

Generates the next value from the underlying data streams.

Returns:The next value in the stream.
Return type:T
has_next() → bool[source]

Checks if there is another value.

Returns:If there is another value or not.
Return type:bool
class feed.api.float.accumulators.CumProd[source]

Bases: feed.core.base.Stream

A stream operator that creates a cumulative product of values.

References

[1]https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.cumprod.html
forward() → float[source]

Generates the next value from the underlying data streams.

Returns:The next value in the stream.
Return type:T
has_next() → bool[source]

Checks if there is another value.

Returns:If there is another value or not.
Return type:bool
class feed.api.float.accumulators.CumSum[source]

Bases: feed.core.base.Stream

A stream operator that creates a cumulative sum of values.

References

[1]https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.cumsum.html
forward() → float[source]

Generates the next value from the underlying data streams.

Returns:The next value in the stream.
Return type:T
has_next() → bool[source]

Checks if there is another value.

Returns:If there is another value or not.
Return type:bool
feed.api.float.accumulators.cummax(s: feed.core.base.Stream[float][float], skipna: bool = True) → feed.core.base.Stream[float][float][source]

Computes the cumulative maximum of a stream.

Parameters:
  • s (Stream[float]) – A float stream.
  • skipna (bool, default True) – Exclude NA/null values. If a value is NA, the result will be NA.
Returns:

The cumulative maximum stream of s.

Return type:

Stream[float]

feed.api.float.accumulators.cummin(s: feed.core.base.Stream[float][float], skipna: bool = True) → feed.core.base.Stream[float][float][source]

Computes the cumulative minimum of a stream.

Parameters:
  • s (Stream[float]) – A float stream.
  • skipna (bool, default True) – Exclude NA/null values. If a value is NA, the result will be NA.
Returns:

The cumulative minimum stream of s.

Return type:

Stream[float]

feed.api.float.accumulators.cumprod(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the cumulative product of a stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The cumulative product stream of s.
Return type:Stream[float]
feed.api.float.accumulators.cumsum(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the cumulative sum of a stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The cumulative sum stream of s.
Return type:Stream[float]

feed.api.float.imputation module

feed.api.float.imputation.ffill(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Fill in missing values by forward filling.

Parameters:s (Stream[float]) – A float stream.
Returns:An imputed stream via forward filling.
Return type:Stream[float]
feed.api.float.imputation.fillna(s: feed.core.base.Stream[float][float], fill_value: float = 0.0) → feed.core.base.Stream[float][float][source]

Fill in missing values with a fill value.

Parameters:
  • s (Stream[float]) – A float stream.
  • fill_value (float) – A value to fill in missing values with.
Returns:

An imputed stream via padding.

Return type:

Stream[float]

feed.api.float.operations module

operations.py contains functions for computing arithmetic operations on float streams.

feed.api.float.operations.abs(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the absolute value of a float stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The absolute value stream of s.
Return type:Stream[float]
feed.api.float.operations.add(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the addition of two float streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float] or float) – The second float stream.
Returns:

A stream created from adding s1 and s2.

Return type:

Stream[float]

feed.api.float.operations.mul(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the multiplication of two float streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float] or float) – The second float stream.
Returns:

A stream created from multiplying s1 and s2.

Return type:

Stream[float]

feed.api.float.operations.neg(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the negation of a float stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The negated stream of s.
Return type:Stream[float]
feed.api.float.operations.pow(s: feed.core.base.Stream[float][float], power: float) → feed.core.base.Stream[float][float][source]

Computes the power of a float stream.

Parameters:
  • s (Stream[float]) – A float stream.
  • power (float) – The power to raise s by.
Returns:

The power stream of s.

Return type:

Stream[float]

feed.api.float.operations.radd(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the reversed addition of two float streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float] or float) – The second float stream.
Returns:

A stream created from adding s1 and s2.

Return type:

Stream[float]

feed.api.float.operations.rmul(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the reverse multiplication of two float streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float] or float) – The second float stream.
Returns:

A stream created from multiplying s2 and s1.

Return type:

Stream[float]

feed.api.float.operations.rsub(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the reverse subtraction of two float streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float] or float) – The second float stream.
Returns:

A stream created from subtracting s1 from s2.

Return type:

Stream[float]

feed.api.float.operations.rtruediv(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the reverse division of two float streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float] or float) – The second float stream.
Returns:

A stream created from dividing s2 by s1.

Return type:

Stream[float]

feed.api.float.operations.sub(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the subtraction of two float streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float] or float) – The second float stream.
Returns:

A stream created from subtracting s2 from s1.

Return type:

Stream[float]

feed.api.float.operations.truediv(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the division of two float streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float] or float) – The second float stream.
Returns:

A stream created from dividing s1 by s2.

Return type:

Stream[float]

feed.api.float.ordering module

feed.api.float.ordering.clamp(s: feed.core.base.Stream[float][float], c_min: float, c_max: float) → feed.core.base.Stream[float][float][source]

Clamps the minimum and maximum value of a stream.

Parameters:
  • s (Stream[float]) – A float stream.
  • c_min (float) – The mimimum value to clamp by.
  • c_max (float) – The maximum value to clamp by.
Returns:

The clamped stream of s.

Return type:

Stream[float]

feed.api.float.ordering.clamp_max(s: feed.core.base.Stream[float][float], c_max: float) → feed.core.base.Stream[float][float][source]

Clamps the maximum value of a stream.

Parameters:
  • s (Stream[float]) – A float stream.
  • c_max (float) – The maximum value to clamp by.
Returns:

The maximum clamped stream of s.

Return type:

Stream[float]

feed.api.float.ordering.clamp_min(s: feed.core.base.Stream[float][float], c_min: float) → feed.core.base.Stream[float][float][source]

Clamps the minimum value of a stream.

Parameters:
  • s (Stream[float]) – A float stream.
  • c_min (float) – The mimimum value to clamp by.
Returns:

The minimum clamped stream of s.

Return type:

Stream[float]

feed.api.float.ordering.max(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the maximum of two streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float]) – The second float stream.
Returns:

The maximum stream of s1 and s2.

Return type:

Stream[float]

feed.api.float.ordering.min(s1: feed.core.base.Stream[float][float], s2: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the minimum of two streams.

Parameters:
  • s1 (Stream[float]) – The first float stream.
  • s2 (Stream[float]) – The second float stream.
Returns:

The minimum stream of s1 and s2.

Return type:

Stream[float]

feed.api.float.utils module

feed.api.float.utils.ceil(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the ceiling of a float stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The ceiling stream of s.
Return type:Stream[float]
feed.api.float.utils.diff(s: feed.core.base.Stream[float][float], periods: int = 1) → feed.core.base.Stream[float][float][source]

Computes the difference of a float stream.

Parameters:
  • s (Stream[float]) – A float stream.
  • periods (int, default 1) – The number of periods to lag for until computing the difference.
Returns:

The difference stream of s.

Return type:

Stream[float]

feed.api.float.utils.floor(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the floor of a float stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The floor stream of s.
Return type:Stream[float]
feed.api.float.utils.log(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the log of a float stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The log stream of s.
Return type:Stream[float]
feed.api.float.utils.pct_change(s: feed.core.base.Stream[float][float], periods: int = 1, fill_method: str = 'pad') → feed.core.base.Stream[float][float][source]

Computes the percent change of a float stream.

Parameters:
  • s (Stream[float]) – A float stream.
  • periods (int, default 1) – The number of periods to lag for until computing the percent change.
  • fill_method (str, default "pad") – The fill method to use for missing values.
Returns:

The percent change stream of s.

Return type:

Stream[float]

feed.api.float.utils.sqrt(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the square root of a float stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The square root stream of s.
Return type:Stream[float]
feed.api.float.utils.square(s: feed.core.base.Stream[float][float]) → feed.core.base.Stream[float][float][source]

Computes the square of a float stream.

Parameters:s (Stream[float]) – A float stream.
Returns:The square stream of s.
Return type:Stream[float]

Module contents

class feed.api.float.Float[source]

Bases: object

A class to register accessor and instance methods.

classmethod register(names: List[str])[source]

A function decorator that adds accessor and instance methods for specified data type.

Parameters:names (List[str]) – A list of names used to register the function as a method.
Returns:A decorated function.
Return type:Callable
class feed.api.float.FloatMethods(stream: Stream)[source]

Bases: feed.core.methods.Methods

abs(*args, **kwargs)
add(*args, **kwargs)
ceil(*args, **kwargs)
clamp(*args, **kwargs)
clamp_max(*args, **kwargs)
clamp_min(*args, **kwargs)
cummax(*args, **kwargs)
cummin(*args, **kwargs)
cumprod(*args, **kwargs)
cumsum(*args, **kwargs)
diff(*args, **kwargs)
div(*args, **kwargs)
ewm(*args, **kwargs)
expanding(*args, **kwargs)
ffill(*args, **kwargs)
fillna(*args, **kwargs)
floor(*args, **kwargs)
log(*args, **kwargs)
max(*args, **kwargs)
min(*args, **kwargs)
mul(*args, **kwargs)
neg(*args, **kwargs)
pct_change(*args, **kwargs)
pow(*args, **kwargs)
radd(*args, **kwargs)
rdiv(*args, **kwargs)
rmul(*args, **kwargs)
rolling(*args, **kwargs)
rsub(*args, **kwargs)
sqrt(*args, **kwargs)
square(*args, **kwargs)
sub(*args, **kwargs)
class feed.api.float.FloatMixin[source]

Bases: feed.core.mixins.DataTypeMixin

abs(*args, **kwargs)
add(*args, **kwargs)
ceil(*args, **kwargs)
clamp(*args, **kwargs)
clamp_max(*args, **kwargs)
clamp_min(*args, **kwargs)
cummax(*args, **kwargs)
cummin(*args, **kwargs)
cumprod(*args, **kwargs)
cumsum(*args, **kwargs)
diff(*args, **kwargs)
div(*args, **kwargs)
ewm(*args, **kwargs)
expanding(*args, **kwargs)
ffill(*args, **kwargs)
fillna(*args, **kwargs)
floor(*args, **kwargs)
log(*args, **kwargs)
max(*args, **kwargs)
min(*args, **kwargs)
mul(*args, **kwargs)
neg(*args, **kwargs)
pct_change(*args, **kwargs)
pow(*args, **kwargs)
radd(*args, **kwargs)
rdiv(*args, **kwargs)
rmul(*args, **kwargs)
rolling(*args, **kwargs)
rsub(*args, **kwargs)
sqrt(*args, **kwargs)
square(*args, **kwargs)
sub(*args, **kwargs)