Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Namespaces
signal_consumer.cpp File Reference

SignalConsumer implementation — JSON serialisation and batched I/O. More...

#include "../../include/srfm/stream/signal_consumer.hpp"
#include <cstdio>
#include <thread>

Go to the source code of this file.

Namespaces

namespace  srfm
 
namespace  srfm::stream
 

Detailed Description

SignalConsumer implementation — JSON serialisation and batched I/O.

See include/srfm/stream/signal_consumer.hpp for the full module contract.

JSON format (one line per signal)

{"bar": 0, "beta": 0.0000, "gamma": 1.0000, "regime": "LIGHTLIKE", "signal": 0.0000}

I/O batching

std::fflush() is expensive. We accumulate FLUSH_INTERVAL signals in the internal buffer (backed by the OS I/O buffer) before flushing. On stop(), we drain the ring and perform a final flush to ensure no signals are lost.

Output correctness

std::fprintf() is used rather than std::cout to avoid locale effects and C++ stream synchronisation overhead. The format string is compile-time constant; no dynamic allocation occurs in write_one().

Definition in file signal_consumer.cpp.