Skip to content

Statistic Functions

Back to API overview

13 functions.

pta.beta

Beta

pta.beta(real0, real1, time_period=5)

TA-Lib name: BETA

Inputs

Input Default
real0 required
real1 required

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 5 1 .. 100000

Outputs

Field dtype
real Float64

Example

df.select(pta.beta(pl.col("close"), pl.col("open"), time_period=20).alias("beta"))

pta.correl

Pearson's Correlation Coefficient (r)

pta.correl(real0, real1, time_period=30)

TA-Lib name: CORREL

Inputs

Input Default
real0 required
real1 required

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 30 1 .. 100000

Outputs

Field dtype
real Float64

Example

df.select(pta.correl(pl.col("close"), pl.col("open"), time_period=20).alias("correl"))

pta.kurtosis

Rolling Excess Kurtosis

pta.kurtosis(real=pl.col("close"), time_period=30)

TA-Lib name: KURTOSIS

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 30 4 .. 10000

Outputs

Field dtype
real Float64

Example

df.select(pta.kurtosis(time_period=20).alias("kurtosis"))

pta.linearreg

Linear Regression

pta.linearreg(real=pl.col("close"), time_period=14)

TA-Lib name: LINEARREG

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 14 2 .. 100000

Outputs

Field dtype
real Float64

Example

df.select(pta.linearreg(time_period=20).alias("linearreg"))

pta.linearreg_angle

Linear Regression Angle

pta.linearreg_angle(real=pl.col("close"), time_period=14)

TA-Lib name: LINEARREG_ANGLE

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 14 2 .. 100000

Outputs

Field dtype
real Float64

Example

df.select(pta.linearreg_angle(time_period=20).alias("linearreg_angle"))

pta.linearreg_intercept

Linear Regression Intercept

pta.linearreg_intercept(real=pl.col("close"), time_period=14)

TA-Lib name: LINEARREG_INTERCEPT

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 14 2 .. 100000

Outputs

Field dtype
real Float64

Example

df.select(pta.linearreg_intercept(time_period=20).alias("linearreg_intercept"))

pta.linearreg_slope

Linear Regression Slope

pta.linearreg_slope(real=pl.col("close"), time_period=14)

TA-Lib name: LINEARREG_SLOPE

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 14 2 .. 100000

Outputs

Field dtype
real Float64

Example

df.select(pta.linearreg_slope(time_period=20).alias("linearreg_slope"))

pta.median

Rolling Median

pta.median(real=pl.col("close"), time_period=30)

TA-Lib name: MEDIAN

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 30 2 .. 10000

Outputs

Field dtype
real Float64

Example

df.select(pta.median(time_period=20).alias("median"))

pta.percentile

Percentile (nearest rank)

pta.percentile(real=pl.col("close"), time_period=100, percentile=50)

TA-Lib name: PERCENTILE

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 100 2 .. 10000
percentile optInPercentile float 50 0 .. 100

Outputs

Field dtype
real Float64

Example

df.select(pta.percentile(time_period=20).alias("percentile"))

pta.percentrank

Percent Rank

pta.percentrank(real=pl.col("close"), time_period=100)

TA-Lib name: PERCENTRANK

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 100 2 .. 10000

Outputs

Field dtype
real Float64

Example

df.select(pta.percentrank(time_period=20).alias("percentrank"))

pta.stddev

Standard Deviation

pta.stddev(real=pl.col("close"), time_period=5, nb_dev=1)

TA-Lib name: STDDEV

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 5 2 .. 100000
nb_dev optInNbDev float 1 -3e+37 .. 3e+37

Outputs

Field dtype
real Float64

Example

df.select(pta.stddev(time_period=20).alias("stddev"))

pta.tsf

Time Series Forecast

pta.tsf(real=pl.col("close"), time_period=14)

TA-Lib name: TSF

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 14 2 .. 100000

Outputs

Field dtype
real Float64

Example

df.select(pta.tsf(time_period=20).alias("tsf"))

pta.var

Variance

pta.var(real=pl.col("close"), time_period=5, nb_dev=1)

TA-Lib name: VAR

Inputs

Input Default
real pl.col("close")

Parameters

Parameter TA-Lib name Type Default Range / values
time_period optInTimePeriod int 5 1 .. 100000
nb_dev optInNbDev float 1 -3e+37 .. 3e+37

Outputs

Field dtype
real Float64

Example

df.select(pta.var(time_period=20).alias("var"))