A set of tools useful in exploring statistical arbitrage
Project description
StatArbTools
StatArbTools is a Python library primarily for determining if a pair of time series are cointegrated. It also includes tools for generating an array of log returns from a price array, looking for a linear relationship, and creating a potentially stationary distribution.
Installation
Use the package manager pip to install StatArbTools
pip install StatArbTools
Usage
import StatArbTools
StatArbTools.gen_log_returns(numpy_time_series_1, numpy_time_series_2) # returns numpy arrays of the log returns for each time series
StatArbTools.gen_linear_relationship(numpy_log_returns_1, numpy_log_returns_2) # returns the coefficient from a linear regression between the two log returns arrays
StatArbTools.gen_stationary_distr(numpy_log_returns_1, numpy_log_returns_2, coefficient) # returns the linear combination of the two log returns arrays based on a linear regression coefficient
StatArbTools.test_stationarity(numpy_time_series_1, numpy_time_series_2) # returns True if the null hypothesis of an Augmented Dickey Fuller test is rejected and False otherwise. It also returns the p-value of the ADF test.
StatArbTools.plot(stationary_distribution) # plots the passed distribution
Contributing
For changes, please open an issue first to discuss what you would like to change.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
StatArbTools-0.0.1.tar.gz
(1.7 kB
view hashes)
Built Distribution
Close
Hashes for StatArbTools-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2229d2fe9427f330ac182a12c448babf7bc0453ed6a8fd5a7edfaa966266c877 |
|
MD5 | c064731e0fc77be6727bd80e2c6ea101 |
|
BLAKE2b-256 | ce9ab4b6756e3a55da817bf5bd8b1f9f76033c367c679f68c9425b10738fd76b |