Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
stream_signal.hpp
Go to the documentation of this file.
1#pragma once
2/**
3 * @file stream_signal.hpp
4 * @brief StreamRelativisticSignal — output unit of the signal-processing pipeline.
5 *
6 * Module: include/srfm/stream/
7 * Owner: AGT-10 (Builder) — 2026-03-01
8 *
9 * Responsibility
10 * --------------
11 * Define the canonical output type emitted by SignalProcessor and consumed by
12 * SignalConsumer. Each StreamRelativisticSignal corresponds to one processed
13 * OHLCVTick and carries the full relativistic characterisation of that bar.
14 *
15 * Design Constraints
16 * ------------------
17 * • Trivially movable — stored in SPSCRing<StreamRelativisticSignal, 65536>.
18 * • No dynamic allocation — fixed-size plain struct.
19 * • Regime is an enum (not std::string) — string formatting done at output.
20 */
21
22#include <cstdint>
23
24namespace srfm::stream {
25
26// ── Spacetime regime classification ───────────────────────────────────────────
27
28/**
29 * @brief Spacetime interval regime derived from the Lorentz-transformed
30 * coordinates of consecutive ticks.
31 *
32 * The invariant spacetime interval is Δs² = Δt'² - Δx'² (c = 1 in
33 * normalised units).
34 *
35 * TIMELIKE : Δs² > ε — causal connection; signal is meaningful.
36 * LIGHTLIKE : |Δs²| ≤ ε — on the light cone boundary.
37 * SPACELIKE : Δs² < -ε — acausal separation; signal strength is attenuated.
38 */
39enum class Regime : std::uint8_t {
40 TIMELIKE = 0,
41 LIGHTLIKE = 1,
42 SPACELIKE = 2,
43};
44
45/**
46 * @brief Convert Regime to a null-terminated ASCII string.
47 *
48 * Returned pointer is to a string literal (static storage).
49 */
50[[nodiscard]] inline const char* regime_to_str(Regime r) noexcept {
51 switch (r) {
52 case Regime::TIMELIKE: return "TIMELIKE";
53 case Regime::LIGHTLIKE: return "LIGHTLIKE";
54 case Regime::SPACELIKE: return "SPACELIKE";
55 }
56 return "UNKNOWN";
57}
58
59// ── StreamRelativisticSignal ──────────────────────────────────────────────────
60
61/**
62 * @brief Fully-characterised relativistic signal for one processed tick.
63 *
64 * Emitted by SignalProcessor into the output SPSCRing, consumed by
65 * SignalConsumer for JSON serialisation.
66 *
67 * Fields
68 * ------
69 * bar — Monotonically increasing tick sequence number (0-based).
70 * beta — Normalised market velocity β ∈ (-BETA_MAX_SAFE, BETA_MAX_SAFE).
71 * gamma — Lorentz factor γ = 1/√(1−β²) ≥ 1.0.
72 * regime — Spacetime interval classification of this bar.
73 * signal — Relativistic-adjusted signal value: γ · m_eff · normalised_close.
74 * ds2 — Raw spacetime interval Δs² (diagnostic; not in JSON output).
75 */
77 std::int64_t bar{0}; ///< Bar sequence number.
78 double beta{0.0}; ///< Market velocity β.
79 double gamma{1.0}; ///< Lorentz factor γ.
80 Regime regime{Regime::LIGHTLIKE}; ///< Spacetime interval regime.
81 double signal{0.0}; ///< Relativistic signal value.
82 double ds2{0.0}; ///< Spacetime interval Δs² (diagnostic).
83};
84
85} // namespace srfm::stream
const char * regime_to_str(Regime r) noexcept
Convert Regime to a null-terminated ASCII string.
Regime
Spacetime interval regime derived from the Lorentz-transformed coordinates of consecutive ticks.
Fully-characterised relativistic signal for one processed tick.
Regime regime
Spacetime interval regime.
std::int64_t bar
Bar sequence number.
double signal
Relativistic signal value.
double ds2
Spacetime interval Δs² (diagnostic).