Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
srfm::CoordinateNormalizer Class Reference

#include <normalizer.hpp>

Public Member Functions

 CoordinateNormalizer (std::size_t window=20, std::size_t min_samples=0) noexcept
 
std::optional< manifold::SpacetimeEvent > normalize (const manifold::SpacetimeEvent &raw) noexcept
 
std::size_t size () const noexcept
 Number of samples currently in the rolling window (≤ window_size()).
 
std::size_t window_size () const noexcept
 Configured maximum window size.
 
std::size_t total_samples () const noexcept
 Total number of samples seen so far (does not saturate at window_size()).
 
bool warmed_up () const noexcept
 
void reset () noexcept
 Reset the normalizer, clearing all buffered observations.
 

Static Public Attributes

static constexpr std::size_t DEFAULT_MIN_SAMPLES = 20
 Minimum number of samples required before warmed_up() returns true.
 

Detailed Description

Rolling z-score normalizer for SpacetimeEvent spatial coordinates.

Maintains independent rolling windows for price, volume, and momentum. Each call to normalize() updates the windows and returns a z-scored event.

Definition at line 62 of file normalizer.hpp.

Constructor & Destructor Documentation

◆ CoordinateNormalizer()

srfm::CoordinateNormalizer::CoordinateNormalizer ( std::size_t  window = 20,
std::size_t  min_samples = 0 
)
explicitnoexcept

Construct with a given window size and optional min_samples warm-up guard.

Arguments

  • window — Number of bars to use for rolling statistics. Minimum 1. Default: 20.
  • min_samples — Number of samples that must be seen before warmed_up() returns true and normalize() emits non-zero z-scores. Defaults to max(window, DEFAULT_MIN_SAMPLES).

Definition at line 23 of file normalizer.cpp.

Member Function Documentation

◆ normalize()

std::optional< manifold::SpacetimeEvent > srfm::CoordinateNormalizer::normalize ( const manifold::SpacetimeEvent &  raw)
noexcept

Normalize the spatial coordinates of a SpacetimeEvent.

Updates the rolling window with the current event's coordinates, then returns a new SpacetimeEvent where each spatial coordinate is z-scored using the updated window statistics.

Returns

SpacetimeEvent with:

  • time: unchanged (pass-through, no normalization)
  • price: z-scored using current rolling window
  • volume: z-scored using current rolling window
  • momentum: z-scored using current rolling window

If stddev < 1e-9 for a coordinate (flat series, no variance), that coordinate is returned as 0.0.

Definition at line 90 of file normalizer.cpp.

◆ reset()

void srfm::CoordinateNormalizer::reset ( )
noexcept

Reset the normalizer, clearing all buffered observations.

Definition at line 133 of file normalizer.cpp.

◆ size()

std::size_t srfm::CoordinateNormalizer::size ( ) const
noexcept

Number of samples currently in the rolling window (≤ window_size()).

Definition at line 116 of file normalizer.cpp.

◆ total_samples()

std::size_t srfm::CoordinateNormalizer::total_samples ( ) const
noexcept

Total number of samples seen so far (does not saturate at window_size()).

Definition at line 125 of file normalizer.cpp.

◆ warmed_up()

bool srfm::CoordinateNormalizer::warmed_up ( ) const
noexcept

Returns true once at least min_samples data points have been accumulated.

Before warmed_up() is true, normalize() returns a zero-valued event to avoid producing wild z-scores from an insufficient statistical window.

Definition at line 129 of file normalizer.cpp.

◆ window_size()

std::size_t srfm::CoordinateNormalizer::window_size ( ) const
noexcept

Configured maximum window size.

Definition at line 121 of file normalizer.cpp.

Member Data Documentation

◆ DEFAULT_MIN_SAMPLES

constexpr std::size_t srfm::CoordinateNormalizer::DEFAULT_MIN_SAMPLES = 20
staticconstexpr

Minimum number of samples required before warmed_up() returns true.

Definition at line 65 of file normalizer.hpp.


The documentation for this class was generated from the following files: