![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
The numeric vocabulary: Scalar, missing(), and the matrix and vector types. More...
Classes | |
| struct | Observed |
| A series split into zero-filled values and a presence mask, for sums that skip gaps. More... | |
Typedefs | |
| using | Matrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor> |
| A dense, column-major matrix of Scalar. | |
| using | Vector = Eigen::Matrix<Scalar, Eigen::Dynamic, 1> |
| A dense column vector of Scalar. | |
| using | SeriesView = Eigen::Ref<const Vector> |
| A read-only reference to one series. | |
| using | MutableSeriesView = Eigen::Ref<Vector> |
| A writable reference to one series, such as a Vector or a column of a Matrix. | |
| using | MatrixView = Eigen::Ref<const Matrix> |
| A read-only reference to a whole matrix. | |
| using | Index = Eigen::Index |
| The signed index type of rows and columns. | |
| using | Llt = Eigen::LLT<Matrix> |
| Cholesky decomposition of a symmetric positive-definite matrix. Check info(). | |
| using | Ldlt = Eigen::LDLT<Matrix> |
| Pivoting Cholesky (LDLT) decomposition of a symmetric, possibly semi-definite matrix. | |
| using | HouseholderQr = Eigen::HouseholderQR<Matrix> |
| Householder QR decomposition: the fastest QR, with no rank information. | |
| using | ColPivQr = Eigen::ColPivHouseholderQR<Matrix> |
| Column-pivoting Householder QR: a least-squares solution and a rank. | |
| using | FullPivQr = Eigen::FullPivHouseholderQR<Matrix> |
| Full-pivoting Householder QR: slower than ColPivQr, with the most reliable rank. | |
| using | FullPivLu = Eigen::FullPivLU<Matrix> |
| LU decomposition with full pivoting, for a square system with no known structure. | |
| using | Svd = Eigen::BDCSVD<Matrix> |
| Divide-and-conquer SVD: minimum-norm least-squares solutions and singular values. | |
| using | SelfAdjointEigen = Eigen::SelfAdjointEigenSolver<Matrix> |
| Eigenvalues (ascending) and eigenvectors of a symmetric matrix. Check info(). | |
| using | Scalar = double |
| The floating-point type the analytics and math layers compute in (double). | |
Functions | |
| Vector | unobserved (std::size_t count) |
| Makes a vector filled with missing(). | |
| Matrix | unobserved (std::size_t rows, std::size_t columns) |
| Makes a matrix filled with missing(). | |
| Observed | observed_parts (SeriesView values) |
| Splits a series into zero-filled values and a presence mask. | |
| Vector | observed_or (SeriesView values, Scalar filler) |
| Replaces every unobserved entry of a series. | |
| Vector | both_present (const Vector &left, const Vector &right) |
| Combines two presence masks: 1 only where both series are observed. | |
| Svd | thin_svd (const Matrix &a) |
| Computes a thin SVD, ready to solve(). | |
| Scalar | missing () |
| Returns the value that stands for "no observation" (a quiet NaN). | |
| bool | observed (Scalar value) |
| Tests whether a value is an observation. | |
| Scalar | undefined () |
| Returns the value that stands for "the data was there, but the statistic does not exist". | |
| bool | is_undefined (Scalar value) |
| Tests whether a value is the undefined() marker. | |
Variables | |
| constexpr unsigned int | LOWER = Eigen::Lower |
| Selects the lower triangle, as in matrix.selfadjointView<math::LOWER>(). | |
| constexpr unsigned int | UPPER = Eigen::Upper |
| Selects the upper triangle. | |
| constexpr unsigned int | UNIT_LOWER = Eigen::UnitLower |
| Selects the lower triangle with an implicit unit diagonal. | |
| constexpr unsigned int | UNIT_UPPER = Eigen::UnitUpper |
| Selects the upper triangle with an implicit unit diagonal. | |
| constexpr auto | SUCCESS = Eigen::Success |
| The value a decomposition's info() returns on success. | |
| using algotradelib::math::ColPivQr = Eigen::ColPivHouseholderQR<Matrix> |
| using algotradelib::math::FullPivLu = Eigen::FullPivLU<Matrix> |
| using algotradelib::math::FullPivQr = Eigen::FullPivHouseholderQR<Matrix> |
| using algotradelib::math::HouseholderQr = Eigen::HouseholderQR<Matrix> |
| using algotradelib::math::Index = Eigen::Index |
| using algotradelib::math::Ldlt = Eigen::LDLT<Matrix> |
| using algotradelib::math::Llt = Eigen::LLT<Matrix> |
| using algotradelib::math::Matrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor> |
A dense, column-major matrix of Scalar.
Frames put time on the rows and one series per column, so a column binds to SeriesView without a copy.
| using algotradelib::math::MatrixView = Eigen::Ref<const Matrix> |
| using algotradelib::math::MutableSeriesView = Eigen::Ref<Vector> |
| using algotradelib::math::Scalar = double |
The floating-point type the analytics and math layers compute in (double).
Prices, quantities and money in orders and broker data stay Decimal64; convert between the two with the functions in analytics/conversion.hpp.
Definition at line 18 of file scalar.hpp.
| using algotradelib::math::SelfAdjointEigen = Eigen::SelfAdjointEigenSolver<Matrix> |
| using algotradelib::math::SeriesView = Eigen::Ref<const Vector> |
| using algotradelib::math::Svd = Eigen::BDCSVD<Matrix> |
Divide-and-conquer SVD: minimum-norm least-squares solutions and singular values.
Construct it with thin_svd(), which requests the thin factors solve() needs on every supported Eigen release.
| using algotradelib::math::Vector = Eigen::Matrix<Scalar, Eigen::Dynamic, 1> |
Combines two presence masks: 1 only where both series are observed.
Use it to restrict a co-moment (covariance, correlation) and both series' deviations to the same rows; otherwise a correlation can fall outside [-1, 1].
| left | The first series' Observed::present_. |
| right | The second series' Observed::present_, of the same length. |
Definition at line 144 of file eigen.hpp.
Referenced by both_present().
|
inline |
Tests whether a value is the undefined() marker.
| value | The value to test. |
Definition at line 69 of file scalar.hpp.
Referenced by is_undefined().
|
inline |
Returns the value that stands for "no observation" (a quiet NaN).
Used for an indicator's warm-up rows, a gap in a panel, or a field a broker did not report. Every reduction in the analytics layer skips it.
Definition at line 28 of file scalar.hpp.
Referenced by missing(), unobserved(), and unobserved().
|
inline |
Tests whether a value is an observation.
| value | The value to test. |
Definition at line 36 of file scalar.hpp.
Referenced by algotradelib::strategy::vanilla::adjusted_ema(), algotradelib::strategy::vanilla::exponential_line(), algotradelib::strategy::vanilla::last_two(), observed(), algotradelib::strategy::vanilla::DonchianBreakout::on_bar(), algotradelib::strategy::vanilla::RsiThreshold::on_bar(), algotradelib::strategy::vanilla::VolatilityTargetSizing::on_bar(), and algotradelib::strategy::vanilla::ZScoreReversion::on_bar().
|
inline |
Replaces every unobserved entry of a series.
| values | The series; any NaN counts as unobserved. |
| filler | The value to put in place of each unobserved entry. |
Definition at line 130 of file eigen.hpp.
Referenced by observed_or(), algotradelib::analytics::rolling_max(), and algotradelib::analytics::rolling_min().
|
inline |
Splits a series into zero-filled values and a presence mask.
| values | The series; any NaN counts as unobserved. |
Definition at line 113 of file eigen.hpp.
Referenced by algotradelib::analytics::bollinger(), observed_parts(), algotradelib::analytics::rolling_max(), algotradelib::analytics::rolling_mean(), algotradelib::analytics::rolling_min(), algotradelib::analytics::rolling_stdev(), algotradelib::analytics::rolling_sum(), algotradelib::analytics::wma(), and algotradelib::analytics::zscore().
Computes a thin SVD, ready to solve().
| a | The matrix to decompose. |
Definition at line 202 of file eigen.hpp.
Referenced by thin_svd().
|
inline |
Returns the value that stands for "the data was there, but the statistic does not exist".
Examples: a z-score over a window with no dispersion, a correlation against a constant, a Sortino ratio over a series that never fell below its target. It differs from missing(), which means there was no data. Both are quiet NaNs, so observed() is false for both and reductions skip both; only is_undefined() tells them apart.
Definition at line 51 of file scalar.hpp.
Referenced by algotradelib::analytics::beta(), algotradelib::analytics::max_drawdown(), algotradelib::analytics::rolling_corr(), undefined(), and algotradelib::analytics::zscore().
|
inline |
Makes a vector filled with missing().
| count | The number of entries. |
Definition at line 73 of file eigen.hpp.
Referenced by algotradelib::strategy::vanilla::adjusted_ema(), algotradelib::analytics::beta(), algotradelib::analytics::bollinger(), algotradelib::analytics::cumulative_returns(), algotradelib::analytics::ema(), algotradelib::analytics::log_returns(), algotradelib::analytics::macd(), algotradelib::analytics::one_way_turnover(), algotradelib::analytics::SeriesBuffer::push(), algotradelib::analytics::returns(), algotradelib::analytics::rolling_corr(), algotradelib::analytics::rolling_cov(), algotradelib::analytics::rolling_max(), algotradelib::analytics::rolling_mean(), algotradelib::analytics::rolling_min(), algotradelib::analytics::rolling_stdev(), algotradelib::analytics::rolling_sum(), algotradelib::analytics::rsi(), algotradelib::analytics::SeriesBuffer::SeriesBuffer(), algotradelib::analytics::true_range(), unobserved(), unobserved(), algotradelib::analytics::wma(), and algotradelib::analytics::zscore().
|
inline |
|
inlineconstexpr |
Selects the lower triangle, as in matrix.selfadjointView<math::LOWER>().
A self-adjoint view tells a decomposition to read one triangle and assume the other.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |