Special Relativity in Financial Modeling
1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
include
srfm
stream
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
24
namespace
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
*/
39
enum 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
*/
76
struct
StreamRelativisticSignal
{
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
srfm::stream
Definition
signal_consumer.cpp:33
srfm::stream::regime_to_str
const char * regime_to_str(Regime r) noexcept
Convert Regime to a null-terminated ASCII string.
Definition
stream_signal.hpp:50
srfm::stream::Regime
Regime
Spacetime interval regime derived from the Lorentz-transformed coordinates of consecutive ticks.
Definition
stream_signal.hpp:39
srfm::stream::Regime::TIMELIKE
@ TIMELIKE
srfm::stream::Regime::LIGHTLIKE
@ LIGHTLIKE
srfm::stream::Regime::SPACELIKE
@ SPACELIKE
srfm::stream::StreamRelativisticSignal
Fully-characterised relativistic signal for one processed tick.
Definition
stream_signal.hpp:76
srfm::stream::StreamRelativisticSignal::regime
Regime regime
Spacetime interval regime.
Definition
stream_signal.hpp:80
srfm::stream::StreamRelativisticSignal::gamma
double gamma
Lorentz factor γ.
Definition
stream_signal.hpp:79
srfm::stream::StreamRelativisticSignal::bar
std::int64_t bar
Bar sequence number.
Definition
stream_signal.hpp:77
srfm::stream::StreamRelativisticSignal::signal
double signal
Relativistic signal value.
Definition
stream_signal.hpp:81
srfm::stream::StreamRelativisticSignal::ds2
double ds2
Spacetime interval Δs² (diagnostic).
Definition
stream_signal.hpp:82
srfm::stream::StreamRelativisticSignal::beta
double beta
Market velocity β.
Definition
stream_signal.hpp:78
Generated on Fri Sep 25 2026 23:20:56 for Special Relativity in Financial Modeling by
1.9.8