Namespace Virtufin.Core.Behaviour
Classes
- IndicatorExtensions
Pure combinators over IIndicator<TSelf, TSample, TValue> — the foldable counterparts of SignalExtensions's
map/zip(domain spec §10.4). An indicator's current value can't be derived from another indicator's value alone the way a plain ISignal<T> can, because the combinator itself must stay foldable — it needs an Add(TSample) that threads new samples into the wrapped indicator(s). Each combinator therefore returns a small concrete wrapper type (not just the IIndicator<TSelf, TSample, TValue> interface) so the self-referentialTSelfconstraint has something nameable to bind to, and so the result can itself be composed further.
- ProcessExtensions
Drivers that fold an IProcess<TState, TInput, TOutput> coalgebra over a stream of inputs. The coalgebra itself stays pure and pull-based; these extensions add the reactive layer on demand — the
scancombinator of the domain spec (§10.4).
- SignalExtensions
Pure combinators over ISignal<T> — the
map/ziprows of the domain spec's stream algebra (§10.4), specialised to a single current value rather than a stream. Each result wraps its source(s) lazily: reading Value re-evaluates from the source's current value at read time, so there is no cached/stale copy to keep in sync as the source changes.
Structs
- CombinedIndicator<TLeft, TRight, TSample, TL, TR, TResult>
Result of Combine<TLeft, TRight, TSample, TL, TR, TResult>(IIndicator<TLeft, TSample, TL>, IIndicator<TRight, TSample, TR>, Func<TL, TR, TResult>). Wraps two source indicators sharing a sample type, fanning each incoming sample to both and deriving a value from their current values.
- MappedIndicator<TInner, TSample, TValue, TResult>
Result of Map<TSelf, TSample, TValue, TResult>(IIndicator<TSelf, TSample, TValue>, Func<TValue, TResult>). Wraps a source indicator with a pure value transform, threading Add(TSample) into the source on every sample.
Interfaces
- IAlgebra<TEvent, TState>
An F-algebra over an event log. Given a current state and an event, produce the next state. Combined with the initial state and an event log, the algebra defines a derived signal via the fold (or scan for running computation).
- IDecide<TState, TMarket, TPortfolio, TAction>
The
decidemorphism of the trading loop: given the strategy's hidden state, a market observation, and the folded portfolio state, produce the next strategy state and zero or more trade actions. This is the coalgebraStrategyState × MarketEvent × PortfolioState → StrategyState × TradeAction[]of the domain spec (§6.4), exposed as an IProcess<TState, TInput, TOutput> so strategies compose with the genericscan/folddrivers (ProcessExtensions).
- IIndicator<TSelf, TSample, TValue>
An immutable, self-folding indicator: consumes samples one at a time and exposes its current value via ISignal<T>. Composes with ISignal<T> rather than IAlgebra<TEvent, TState> or IProcess<S,E> because the indicator's own state doesn't need to be threaded as an explicit external parameter —
thisalready is the state.
- IPortfolioState
Marker for any type that represents the folded portfolio state — the derived holdings (positions, cash, average entry prices) a strategy observes at each step of the trading loop. Counterpart of the raw
IPositionEventstream: the state is produced by folding the events with an IAlgebra<TEvent, TState>.
- IProcess<TState, TInput, TOutput>
Coalgebra shape for a stateful process: given the current state and an input observation, produce the next state and an output. The domain instantiations are IDecide<TState, TMarket, TPortfolio, TAction> (
decide) andIExecutor(execute), where the process carries hidden state that must be exposed explicitly. Drive a process over an observable stream of inputs with Run<TState, TInput, TOutput>(IProcess<TState, TInput, TOutput>, IObservable<TInput>).
- ISignal<T>
A continuously derivable value computed from an event log. Signals are never transported on Dapr topics; consumers reconstruct them on demand by folding the log.
- IStrategyState
Marker for any type that carries the hidden state of a strategy: indicator values, model weights, momentum windows, cooldown timers. Counterpart of IExecutionState on the executor side — it exists so IDecide<TState, TMarket, TPortfolio, TAction> can constrain its state parameter.