From 10c2884d522678de4457b0019167ffabc6beab1e Mon Sep 17 00:00:00 2001 From: femtotrader Date: Sun, 7 Jul 2024 18:02:47 +0200 Subject: [PATCH] cleanup --- talipp/indicators/SOBV.py | 52 ++------------------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/talipp/indicators/SOBV.py b/talipp/indicators/SOBV.py index 9730ae7..2c013ee 100644 --- a/talipp/indicators/SOBV.py +++ b/talipp/indicators/SOBV.py @@ -1,54 +1,6 @@ -from typing import Any - -from talipp.indicator_util import has_valid_values -from talipp.indicators.Indicator import Indicator, InputModifierType from talipp.indicators.OBV import OBV -from talipp.ma import MAFactory, MAType - - -class SmoothedIndicator(Indicator): - def __init__(self, indicator_class, ma_type: MAType): - super().__init__() - - self.indicator_class = indicator_class - self.ma_type = ma_type - - def __call__( - self, - smoothing_period: int, - input_values=None, - input_indicator=None, - *args: Any, - **kwargs - ) -> Any: - self.ma = MAFactory.get_ma(self.ma_type, smoothing_period) - - self.internal_indicator = self.indicator_class(*args, **kwargs) - self.add_sub_indicator(self.internal_indicator) - - self.initialize(input_values, input_indicator) - - return self - - def _calculate_new_value(self) -> Any: - self.ma.add(self.internal_indicator.output_values) - return self.ma.output_values[-1] - - -class SmootherFactory: - """Smoother factory.""" - - @staticmethod - def get_smoother(indicator_class, ma_type: MAType = MAType.SMA): - """ - Return a smoother indicator - - Args: - indicator_class: indicator class - smoothing_period: Smoothing period. - ma_type: Moving average type. - """ - return SmoothedIndicator(indicator_class, ma_type) +from talipp.indicators.Smoother import SmootherFactory +from talipp.ma import MAType """Smoothed On Balance Volume.