|
Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
|
Rolling z-score normaliser using Welford's online algorithm. More...
#include <coordinate_normalizer.hpp>
Public Member Functions | |
| CoordinateNormalizer (std::size_t window) | |
| Construct with a given rolling window size. | |
| void | update (double close) noexcept |
| Ingest one new close price into the rolling window. | |
| double | normalise (double close) const noexcept |
Return the z-score of value relative to the current window. | |
| double | mean () const noexcept |
| Rolling mean of the window. 0.0 if window not yet full. | |
| double | sigma () const noexcept |
| Rolling sample standard deviation. 0.0 if window not yet full. | |
| std::size_t | count () const noexcept |
| Number of ticks seen so far (saturates at window size). | |
| bool | warmed_up () const noexcept |
| Whether the window has been filled at least once. | |
| std::size_t | window () const noexcept |
| Configured window size. | |
| void | reset () noexcept |
| Reset all state as if no ticks have been seen. | |
Rolling z-score normaliser using Welford's online algorithm.
Window size is fixed at construction time. Call update() with each new close price, then normalise() to obtain the current z-score.
Definition at line 61 of file coordinate_normalizer.hpp.
|
inlineexplicit |
Construct with a given rolling window size.
| window | Number of ticks in the rolling window. Must be ≥ 2. |
Definition at line 68 of file coordinate_normalizer.hpp.
|
inlinenoexcept |
Number of ticks seen so far (saturates at window size).
Definition at line 141 of file coordinate_normalizer.hpp.
|
inlinenoexcept |
Rolling mean of the window. 0.0 if window not yet full.
Definition at line 131 of file coordinate_normalizer.hpp.
|
inlinenoexcept |
Return the z-score of value relative to the current window.
Returns 0.0 if the window is not yet full or if the standard deviation is effectively zero (constant price series).
| value | Value to normalise (typically the current close price). |
Definition at line 120 of file coordinate_normalizer.hpp.
|
inlinenoexcept |
Reset all state as if no ticks have been seen.
The window size is preserved.
Definition at line 156 of file coordinate_normalizer.hpp.
|
inlinenoexcept |
Rolling sample standard deviation. 0.0 if window not yet full.
Definition at line 134 of file coordinate_normalizer.hpp.
|
inlinenoexcept |
Ingest one new close price into the rolling window.
Updates the internal circular buffer and the running mean/M2 accumulators using Welford's online algorithm. O(1) per call.
| close | Raw close price. Must be finite and positive. |
Definition at line 89 of file coordinate_normalizer.hpp.
|
inlinenoexcept |
Whether the window has been filled at least once.
Definition at line 144 of file coordinate_normalizer.hpp.
|
inlinenoexcept |
Configured window size.
Definition at line 147 of file coordinate_normalizer.hpp.