pybroker.vect module

Contains vectorized utility functions.

cross(a: ndarray[Any, dtype[float64]], b: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[bool_]][source]

Checks for crossover of a above b.

Parameters:
Returns:

numpy.ndarray containing values of 1 when a crosses above b, otherwise values of 0.

highv(array: ndarray[Any, dtype[float64]], n: int) ndarray[Any, dtype[float64]][source]

Calculates the highest values for every n period in array.

Parameters:
Returns:

numpy.ndarray of the highest values for every n period in array.

lowv(array: ndarray[Any, dtype[float64]], n: int) ndarray[Any, dtype[float64]][source]

Calculates the lowest values for every n period in array.

Parameters:
Returns:

numpy.ndarray of the lowest values for every n period in array.

returnv(array: ndarray[Any, dtype[float64]], n: int = 1) ndarray[Any, dtype[float64]][source]

Calculates returns.

Parameters:

n – Return period. Defaults to 1.

Returns:

numpy.ndarray of returns.

sumv(array: ndarray[Any, dtype[float64]], n: int) ndarray[Any, dtype[float64]][source]

Calculates the sums for every n period in array.

Parameters:
Returns:

numpy.ndarray of the sums for every n period in array.