The statio statistical library in Python.
Project description
statio is a statistical Python libary geared towards running computations across a sliding window of values.
- Download:
- Source:
Usage Model
Most statistical libraries are based on a single point in time. The -1 index of a list of values is the point in time in which the calculation is made.
statio is based on multiple points in time. Each index is considered a point in time in which the calculation is made.
Useful for simulation application types.
Useful for plotting or graphing applications types.
Overview
The major functions of statio:
- sum_values():
Builds a list of Running Sums over a sliding list of values.
- sma_values():
Builds a list of Simple Moving Averages over a sliding list of values.
- ema_values():
Builds a list of Exponential Moving Averages over a sliding list of values.
- wwma_values():
Builds a list of Welles Wilder Moving Averages over a sliding list of values.
- psa_values():
Builds a list of Power Sum Averages over a sliding list of values.
- varp_values():
Builds a list of Population Variances over a sliding list of values.
- var_values():
Builds a list of Sample Variances over a sliding list of values.
- stdp_values():
Builds a list of Population Standard Deviations over a sliding list of values.
- std_values():
Builds a list of Sample Standard Deviations over a sliding list of values.
- max_values():
Builds a list of the Maximum Values over a sliding list of values.
- min_values():
Builds a list of the Minimum Values over a sliding list of values.
- top_values():
Builds a list of the Top X Values over a sliding list of values.
- bottom_values():
Builds a list of the Bottom X Values over a sliding list of values.
License
Made available under the MIT License.
Usage
Import the library:
>>> import statio
Build list of running sums using a 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> statio.sum_values(values, 3) [34, 64, 93, 93, 101, 97, 98]
Build list of Simple Moving Averages using a 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = statio.sma_values(values, 3) >>> ["%.2f" % x for x in results] ['34.00', '32.00', '31.00', '31.00', '33.67', '32.33', '32.67']
Build list of Exponential Moving Averages using a 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = statio.ema_values(values, 3) >>> ["%.2f" % x for x in results] ['34.00', '32.00', '31.00', '32.50', '35.25', '30.13', '32.56']
Build list of Welles Wilder Averages using a 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = statio.wwma_values(values, 3) >>> ["%.2f" % x for x in results] ['34.00', '32.00', '31.00', '32.00', '34.00', '31.00', '32.33']
Build list of Population Variances using a 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = statio.varp_values(values, 3) >>> ["%.2f" % x for x in results] ['0.00', '4.00', '4.67', '4.67', '13.56', '29.56', '30.89']
Build list of Sample Variances using a 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = statio.var_values(values, 3) >>> ["%.2f" % x for x in results] ['0.00', '8.00', '7.00', '7.00', '20.33', '44.33', '46.33']
Build list of Population Standard Deviations using a 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = statio.stdp_values(values, 3) >>> ["%.2f" % x for x in results] ['0.00', '2.00', '2.16', '2.16', '3.68', '5.44', '5.56']
Build list of Sample Standard Deviations using a 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = statio.std_values(values, 3) >>> ["%.2f" % x for x in results] ['0.00', '2.83', '2.65', '2.65', '4.51', '6.66', '6.81']
Build list of the Maximum Value of 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = statio.max_values(values, 3) >>> ["%.2f" % x for x in results] ['34.00', '34.00', '34.00', '34.00', '38.00', '38.00', '38.00']
Build list of the Minimum Value of 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> statio.min_values(values, 3) [34, 30, 29, 29, 29, 25, 25]
Build list of the Top X Values of 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> statio.top_values(values, 3, 2) [[34], [30, 34], [30, 34], [30, 34], [34, 38], [34, 38], [35, 38]]
Build list of the Bottom X Values of 3 period window:
>>> values = [34, 30, 29, 34, 38, 25, 35] >>> statio.bottom_values(values, 3, 2) [[34], [30, 34], [29, 30], [29, 30], [29, 34], [25, 34], [25, 35]]
Roadmap
Add median_values.
Add recentmax_values: the index of the most recent max value.
Add sincemax_values: the number of bars since recent max value.
Add recentmin_values: the index of the most recent min value.
Add sincemin_values: the number of bars since recent min value.
Add covariance, correlation, alpha, beta computations.
- For additional information, please email:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file statio-0.0.2.zip
.
File metadata
- Download URL: statio-0.0.2.zip
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41330e2e9b54cca72657f4ecb2d293d3241d7a64eef6df3c3876d06dd42dcf99 |
|
MD5 | 0d48ae514f2aba887e542f9061a3735a |
|
BLAKE2b-256 | b2b703b9095ae7bfb2819e1ea9e8faeca64e301f2f91ca57c2ae717afe2a3001 |
File details
Details for the file statio-0.0.2.win32.exe
.
File metadata
- Download URL: statio-0.0.2.win32.exe
- Upload date:
- Size: 207.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cfc82399a24afd4aa312aaea8c63900516202d6e8bf0b8b358513e017515c09 |
|
MD5 | fbf13b8707a0fa43c9a3f4e81696b6a6 |
|
BLAKE2b-256 | 0d5e22d98776f63d923ef1bf8956f1e615ff17c11b537ef4387609fa402c5758 |
File details
Details for the file statio-0.0.2-py2.6.egg
.
File metadata
- Download URL: statio-0.0.2-py2.6.egg
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 627ad75f62cebfc0a17cc3c0473c3dd3d1d75adf4e19e175f3f26523cc698e26 |
|
MD5 | 1f93c0c3a8ad54da57077f9bb2df2e56 |
|
BLAKE2b-256 | 0426c13bd47dddf22c64c7fb3d3ed87fc9ca450d82f0a56bb360a71a2abc7260 |