factor_agent.aggregations#

Session aggregations: the operators that reduce each session’s intraday bars to one value per stock and day.

Each is a marker: a KunQuant operator class that computes nothing itself. Candidate code calls it like any operator and the Gate records it as one node of the graph, so a graph’s identity does not depend on how the aggregation is computed; factor_agent.session.SessionFactor expands it into KunQuant accumulators when it builds its function. An operator file registers an aggregation like any operator, by its class here.

WithinSession is no aggregation: the stage split wraps each window of the intraday stage in it, so the window is missing until it fits in the session. Candidate code never calls it.

Classes

SessionAggregation

The base of the session aggregations: a reduction of its inputs over each session's bars.

SessionCorr

The correlation of x and y over the bars where both have a value; NaN when one is constant there.

SessionCount

The number of the session's bars where x has a value; 0 when it has none.

SessionFirst

The first value of x present in the session; NaN when it has none.

SessionLast

The last value of x present in the session; NaN when it has none.

SessionMax

The greatest value of x in the session; NaN when it has none.

SessionMean

The mean of x over the session's bars where it has a value; NaN when it has none.

SessionMin

The least value of x in the session; NaN when it has none.

SessionSkew

The unbiased skewness of x over the session's bars where it has a value; NaN below three or when constant.

SessionStd

The unbiased standard deviation of x over the session's bars where it has a value; NaN below two.

SessionSum

The sum of x over the session's bars where it has a value; 0 when it has none.

SessionWeightedMean

The mean of x weighted by w over the bars where both have a value; NaN when the weights sum to 0.

WithinSession

x on the bars at least bars bars into their session, NaN on the session's first bars.