Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
momentum.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file include/srfm/momentum.hpp
4/// @brief Momentum-Velocity Signal Processor — AGT-03 public API (implemented by AGT-06).
5///
6/// # Module: Momentum Processor
7///
8/// ## Responsibility
9/// Apply relativistic momentum corrections to raw strategy signals. In the
10/// financial spacetime analogy, a signal generated during a high-β market regime
11/// carries more "momentum" than the same signal in a quiet Newtonian market.
12///
13/// ## The Core Idea
14/// Classical momentum: p = m·v
15/// Relativistic momentum: p_rel = γ(β) · m_eff · v
16///
17/// Mapping to finance:
18/// - v (velocity) → raw strategy signal value
19/// - m_eff (effective mass) → liquidity proxy (e.g. ADV)
20/// - β (velocity fraction) → normalised market velocity from BetaCalculator
21/// - γ(β) → Lorentz factor ≥ 1; amplifies signals in fast-moving markets
22///
23/// ## Guarantees
24/// - All methods are `noexcept` and return `std::optional` for fallible operations
25/// - No dynamic allocation in hot path
26/// - Thread-safe: MomentumProcessor is stateless
27
28#include "srfm/types.hpp"
29#include "srfm/constants.hpp"
30
31#include <optional>
32#include <span>
33#include <vector>
34
35namespace srfm::momentum {
36
37// ─── MomentumSignal ───────────────────────────────────────────────────────────
38
39/// Input descriptor for a single relativistic momentum computation.
41 double raw_value; ///< Unmodified strategy signal (any finite double)
42 BetaVelocity beta; ///< Normalised market velocity β ∈ [0, BETA_MAX_SAFE)
43 double effective_mass; ///< Liquidity proxy m_eff > 0 (e.g. ADV normalised)
44};
45
46// ─── RelativisticMomentum ─────────────────────────────────────────────────────
47
48/// Result of applying relativistic momentum correction to a single signal.
50 double raw_value; ///< Original signal before correction
51 double adjusted_value; ///< γ · m_eff · raw_value
52 LorentzFactor gamma; ///< Lorentz factor used (≥ 1)
53 BetaVelocity beta; ///< Market velocity at the time of the signal
54};
55
56// ─── MomentumProcessor ────────────────────────────────────────────────────────
57
58/// Stateless utility for applying relativistic momentum corrections.
59///
60/// The processor translates the BetaVelocity at each bar into a Lorentz factor
61/// γ and returns the corrected signal p_rel = γ · m_eff · raw_signal.
63public:
64 /// Apply relativistic momentum correction to a single signal.
65 ///
66 /// # Returns
67 /// - `nullopt` if `effective_mass <= 0` or `beta` is invalid (|β| ≥ BETA_MAX_SAFE)
68 /// - `RelativisticMomentum` with `adjusted_value = γ · m_eff · raw_value`
69 [[nodiscard]] static std::optional<RelativisticMomentum>
70 process(const MomentumSignal& signal) noexcept;
71
72 /// Compute relativistic momentum magnitude: p_rel = γ(β) · mass · speed.
73 ///
74 /// # Arguments
75 /// * `beta` — Market velocity β
76 /// * `mass` — Effective mass m_eff > 0
77 /// * `speed` — Speed component (|raw signal| or |price velocity|)
78 ///
79 /// # Returns
80 /// p_rel ≥ 0, or `nullopt` on invalid inputs.
81 [[nodiscard]] static std::optional<double>
83 double mass,
84 double speed) noexcept;
85
86 /// Apply corrections to a full series of signals in one call.
87 ///
88 /// Signals with invalid β fall back to the raw value (γ = 1 Newtonian limit).
89 ///
90 /// # Returns
91 /// Vector of adjusted values, same length as `signals`.
92 /// Returns `nullopt` if `signals` is empty.
93 [[nodiscard]] static std::optional<std::vector<RelativisticMomentum>>
94 process_series(std::span<const MomentumSignal> signals) noexcept;
95};
96
97} // namespace srfm::momentum
Normalised market velocity β = price_velocity / c_market.
Definition momentum.hpp:72
Pre-computed Lorentz factor γ = 1/√(1−β²). Always ≥ 1.0.
Definition momentum.hpp:98
static std::optional< std::vector< RelativisticMomentum > > process_series(std::span< const MomentumSignal > signals) noexcept
static std::optional< double > relativistic_momentum(BetaVelocity beta, double mass, double speed) noexcept
static std::optional< RelativisticMomentum > process(const MomentumSignal &signal) noexcept
Physical and financial constants for the SRFM system.
Input descriptor for a single relativistic momentum computation.
Definition momentum.hpp:40
double raw_value
Unmodified strategy signal (any finite double)
Definition momentum.hpp:41
BetaVelocity beta
Normalised market velocity β ∈ [0, BETA_MAX_SAFE)
Definition momentum.hpp:42
double effective_mass
Liquidity proxy m_eff > 0 (e.g. ADV normalised)
Definition momentum.hpp:43
Result of applying relativistic momentum correction to a single signal.
Definition momentum.hpp:49
double adjusted_value
γ · m_eff · raw_value
Definition momentum.hpp:51
BetaVelocity beta
Market velocity at the time of the signal.
Definition momentum.hpp:53
LorentzFactor gamma
Lorentz factor used (≥ 1)
Definition momentum.hpp:52
double raw_value
Original signal before correction.
Definition momentum.hpp:50
Shared primitive types for the Special Relativity in Financial Modeling (SRFM) system.