10#include "../beta_calculator/beta_calculator.hpp"
11#include "../geodesic/geodesic_solver.hpp"
12#include "../manifold/spacetime_manifold.hpp"
13#include "../momentum/momentum.hpp"
25Engine::parse_prices(std::string_view data)
const noexcept {
26 std::vector<double> prices;
29 const char* ptr = data.data();
30 const char* end = ptr + data.size();
34 while (ptr < end && !std::isdigit(
static_cast<unsigned char>(*ptr))
35 && *ptr !=
'-' && *ptr !=
'+' && *ptr !=
'.') {
38 if (ptr >= end)
break;
42 auto [next_ptr, ec] = std::from_chars(ptr, end, value);
43 if (ec == std::errc{} && std::isfinite(value) && value > 0.0) {
44 prices.push_back(value);
47 if (next_ptr == ptr) {
59std::optional<PipelineResult>
62 const auto prices = parse_prices(data);
63 if (prices.size() < 2)
return std::nullopt;
68 if (!beta_result)
return std::nullopt;
72 double mean_price = 0.0;
73 for (
const double p : prices) mean_price += p;
74 mean_price /=
static_cast<double>(prices.size());
77 static_cast<double>(prices.size()),
80 beta_result->gamma - 1.0
83 auto regime_opt = mfld.
process(event);
84 if (!regime_opt)
return std::nullopt;
91 init_state.
x[0] =
event.t;
92 init_state.x[1] =
event.x;
93 init_state.x[2] =
event.y > 0.0 ? std::log(event.y) : 0.0;
94 init_state.x[3] =
event.z;
95 init_state.u[0] = 1.0;
96 init_state.u[1] = beta_result->beta;
97 init_state.u[2] = 0.0;
98 init_state.u[3] = 0.0;
101 const auto geo_result = solver.
solve(init_state, flat_metric, 10, 0.01);
102 if (!geo_result)
return std::nullopt;
107 if (!bv)
return std::nullopt;
114 if (!meff)
return std::nullopt;
118 auto sig_result = proc.
process_one(raw_sig, *bv, *meff);
119 if (!sig_result)
return std::nullopt;
124 beta_result->rapidity,
125 beta_result->doppler,
127 sig_result->adjusted_value,
std::optional< BetaVelocityResult > fromPriceVelocityOnline(const std::vector< double > &prices, double c_market=1.0) const noexcept
Compute BetaVelocityResult from a streaming price series.
std::optional< PipelineResult > process(std::string_view data) const noexcept
Process a CSV-like byte sequence through the full pipeline.
std::optional< GeodesicState > solve(const GeodesicState &initial, const MetricTensor &metric, int steps, double dt) const noexcept
Integrate the geodesic equation for steps RK4 steps.
std::optional< Regime > process(const SpacetimeEvent &event) const noexcept
Classify a spacetime event into a relativistic regime.
static std::optional< BetaVelocity > make(double value) noexcept
Validate and construct a BetaVelocity.
static std::optional< EffectiveMass > make(double value) noexcept
Validate and construct an EffectiveMass.
std::optional< RelativisticSignal > process_one(RawSignal signal, BetaVelocity beta, EffectiveMass m_eff) const noexcept
Process a single raw signal (convenience wrapper).
Full SRFM pipeline engine: CSV → relativistic signal (AGT-13 / SRFM)
Full output of one Engine pipeline run.
double beta
Normalised market velocity β
State of a particle on a geodesic: position x^μ and 4-velocity u^μ.
std::array< double, DIM > x
Position x^μ (μ = 0…3)
static MetricTensor minkowski() noexcept
Construct the flat Minkowski metric η = diag(−1,+1,+1,+1).
A point in 4D spacetime (t, x, y, z).
A raw (pre-correction) market signal value.