Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
srfm::causal::CausalConeFilter Class Reference

#include <causal_cone.hpp>

Classes

struct  Config
 Configuration for the causal cone filter. More...
 

Public Member Functions

 CausalConeFilter (Config config=Config{}) noexcept
 Construct with an optional configuration.
 
std::vector< CausalHistory > build_histories (std::span< const core::OHLCV > bars, std::span< const manifold::SpacetimeEvent > events) const noexcept
 
std::optional< CausalSignal > compute_signal (const CausalHistory &history, std::span< const double > returns, std::size_t bar_idx) const noexcept
 
std::size_t look_back () const noexcept
 Return the configured look_back window.
 

Detailed Description

Filters a bar sequence to identify causal predecessors for each bar.

For every bar B in the sequence, looks back up to look_back bars and classifies each as TIMELIKE (causal) or SPACELIKE (excluded) using SpacetimeInterval::classify.

Usage:

auto histories = filter.build_histories(bars);
for (auto& h : histories) {
auto sig = filter.compute_signal(h, bars, bar_index);
// use sig.causal_mean_return instead of all-bars mean
}
std::size_t look_back() const noexcept
Return the configured look_back window.

Definition at line 115 of file causal_cone.hpp.

Constructor & Destructor Documentation

◆ CausalConeFilter()

srfm::causal::CausalConeFilter::CausalConeFilter ( Config  config = Config{})
explicitnoexcept

Construct with an optional configuration.

Definition at line 22 of file causal_cone.cpp.

Member Function Documentation

◆ build_histories()

std::vector< CausalHistory > srfm::causal::CausalConeFilter::build_histories ( std::span< const core::OHLCV >  bars,
std::span< const manifold::SpacetimeEvent >  events 
) const
noexcept

Build a CausalHistory for every bar in the sequence.

The first look_back bars will have fewer predecessors as the rolling window fills up.

Parameters
barsSequence of OHLCV bars (must be pre-converted to events).
eventsCorresponding spacetime events for each bar.
Returns
One CausalHistory per bar (same size as bars).

Definition at line 38 of file causal_cone.cpp.

◆ compute_signal()

std::optional< CausalSignal > srfm::causal::CausalConeFilter::compute_signal ( const CausalHistory &  history,
std::span< const double >  returns,
std::size_t  bar_idx 
) const
noexcept

Compute a CausalSignal for bar at index bar_idx.

Parameters
historyThe CausalHistory for this bar.
returnsClose-to-close returns for the full bar sequence.
bar_idxIndex of the current bar in returns.
Returns
CausalSignal or nullopt if history has no causal predecessors.

Definition at line 87 of file causal_cone.cpp.

◆ look_back()

std::size_t srfm::causal::CausalConeFilter::look_back ( ) const
inlinenoexcept

Return the configured look_back window.

Definition at line 163 of file causal_cone.hpp.


The documentation for this class was generated from the following files: