SignalPipelineΒΆ

Defined in fynance.signal

class SignalPipeline(model, mapper, mapper_kwargs=None)[source]

Bases: object

A SignalModel plus a position mapper.

Wraps a model exposing fit/predict and a mapper turning predictions into positions, exposing predict_position.

Parameters:
modelSignalModel

Object with fit(X, y) and predict(X).

mappercallable

Function mapping a prediction array to positions (e.g. fynance.signal.sign).

mapper_kwargsdict, optional

Extra keyword arguments forwarded to mapper.

fit(X, y)[source]

Fit the underlying model and return self.

predict(X)[source]

Return the raw model predictions.

predict_position(X)[source]

Predict, then map predictions to positions.