Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Classes | Namespaces
normalizer.hpp File Reference

CoordinateNormalizer — rolling z-score normalizer for SpacetimeEvent. More...

#include "srfm/manifold.hpp"
#include <cassert>
#include <cstddef>
#include <deque>
#include <optional>

Go to the source code of this file.

Classes

class  srfm::CoordinateNormalizer
 

Namespaces

namespace  srfm
 

Detailed Description

CoordinateNormalizer — rolling z-score normalizer for SpacetimeEvent.

Module: Coordinate Normalizer

Responsibility

Normalize the spatial coordinates of SpacetimeEvent instances using a rolling window of observed values before they are passed to SpacetimeInterval::compute.

Why This Matters

Raw market coordinates differ by many orders of magnitude:

Without normalization, volume dominates ds² by ~10 orders of magnitude, making interval classification (timelike/spacelike) meaningless. After z-score normalization each coordinate contributes equally.

Formula

For each spatial coordinate x, rolling window of n observations: x_norm = (x - rolling_mean(x)) / rolling_stddev(x)

Time coordinate passes through unchanged.

Warm-up Guard

Before at least min_samples data points have been accumulated (default = window_size, minimum 20), the z-scores are potentially unreliable due to insufficient statistical history. warmed_up() returns false during this period, and normalize() returns a zero-valued event (all spatial coordinates set to 0.0 with time unchanged) instead of a potentially wild z-score. Callers should check warmed_up() before using the output of normalize() for trading decisions.

Edge Cases

Guarantees

Definition in file normalizer.hpp.