Stateless online calculator for market β velocity.
Stateless online calculator for market β velocity."Online" means the calculation consumes a sequence of price observations and computes a single representative β for the whole window. The representative β is the normalised mean log-return velocity.
std::vector<double> prices = {100.0, 100.5, 101.0, 100.8};
BetaCalculator calc;
auto result = calc.fromPriceVelocityOnline(prices, 1.0);
#pragma once
#include <cmath>
#include <optional>
#include <vector>
#include "../momentum/momentum.hpp"
using momentum::BetaVelocity;
struct BetaVelocityResult {
};
[[nodiscard]] std::optional<double>
[[nodiscard]] std::optional<double>
[[nodiscard]] std::optional<BetaVelocityResult>
class BetaCalculator {
public:
[[nodiscard]] std::optional<BetaVelocityResult>
double c_market = 1.0) const noexcept;
};
}
BetaCalculator() noexcept=default
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< BetaVelocityResult > full_beta_result(double beta_value) noexcept
Compute full BetaVelocityResult for a given β value.
std::optional< double > doppler_factor(BetaVelocity beta) noexcept
Compute relativistic Doppler factor D(β) = √((1+β)/(1−β)).
std::optional< double > rapidity(BetaVelocity beta) noexcept
Compute rapidity φ = atanh(β).
constexpr double BETA_MAX_SAFE
double beta
Normalised market velocity β ∈ (−BETA_MAX_SAFE, BETA_MAX_SAFE)
double rapidity
φ = atanh(β) (additive under composition)
double gamma
Lorentz factor γ = 1/√(1−β²) ≥ 1.
double doppler
D(β) = √((1+β)/(1−β)) (Doppler factor > 0)