Summary: Computes the autocorrelation of an input array at a specified lag (τ). The function measures how correlated a signal is with a delayed version of itself.
Summary: Computes the Pearson correlation coefficient between two input arrays. The correlation coefficient measures the linear relationship between two datasets, ranging from -1 (perfect negative correlation) to +1 (perfect positive correlation).
Summary: Computes the Pearson correlation matrix for a set of asset price series. Converts prices to daily log returns and computes pairwise correlations using compute_correlation.
Summary: Computes the correlogram (autocorrelation function) of an input array over multiple lags. The function calculates autocorrelation values for lag values ranging from 0 to n/5, where n is the length of the input array.
Summary: Computes the geometric average (also known as the geometric mean) of an input array. The function applies a logarithmic transformation to the input values before computing the mean.
Summary: Computes a histogram by binning numerical values into a specified number of intervals (bins_length). The function normalizes input values and counts occurrences within each bin.
Summary: Computes the arithmetic mean (average) of an input array.
Summary: Computes both the arithmetic mean and standard deviation of a given range of numbers in a single pass. This function is optimized for performance by avoiding multiple iterations over the data.
Summary: Computes the Ordinary Least Squares (OLS) regression coefficients for a simple linear regression model. The function finds the best-fitting line y = b1 + b2 * x that minimizes the sum of squared residuals.
Summary: Computes the standard deviation of an input array. The function calculates the square root of the variance, which measures the spread of the data relative to its mean.
Summary: Identifies swing highs and swing lows in a time series of price data based on a given swing percentage threshold. The function detects turning points where price movement changes direction beyond the specified percentage.
Summary: Computes the variance of an input array. Variance measures the spread of data relative to the mean by calculating the squared deviation of each value.
Summary: Computes the Z-score normalization of an input array. Each element is transformed to represent how many standard deviations it is from the mean. This helps standardize data with different magnitudes or units.
Summary: Generates an AutoRegressive Moving Average (ARMA) process of order (1,1). The function simulates a time series where each value is influenced by both past values (autoregressive component) and white noise (moving average component).
Summary: Generates an AutoRegressive (AR) process of order 1 (AR(1)). The function models a time series where each value is influenced by the previous value, a deterministic term (alpha), and a random noise component.
Summary: Generates an AutoRegressive (AR) process with stochastic perturbations determined by a dice-based mechanism. The function models a time series where each value is influenced by its previous value, a deterministic term (alpha), and a stochastic noise term (e_t) that randomly switches sign.
Summary: Generates a time series using Geometric Brownian Motion (GBM), commonly used to model asset prices. Ensures prices are always positive.
Summary: Generates a Moving Average (MA) process of order 1 (MA(1)). The function simulates a time series where each value is derived from white noise and a weighted influence of the previous value.
Summary: Generates an array of white noise values uniformly distributed in the range [-1.0, 1.0]. White noise consists of random values with a mean of approximately zero and no discernible pattern.
Summary: Performs a Monte Carlo simulation to model possible future equity values based on a given return distribution. This function generates multiple possible futures by iteratively sampling returns and compounding the equity value.
Summary: Prints a text-based histogram representation of a given histogram dataset. The function scales the frequency of each bin into a visual bar made of asterisks (*).
Generates a single sample from the standard normal distribution (mean = 0, stddev = 1) using the Box-Muller transform.
Summary: Represents the results of a swing analysis, storing detected swing highs and lows along with their corresponding dates.
Copyright (C) 2026 Safepine LLC
This file is part of Safepine OS.
Safepine OS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Safepine OS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with Safepine OS. If not, see <https://www.gnu.org/licenses/>.