SMOOTHING_METHODS,
WEIGHT_STRATEGIES,
TrendDirection,
+ WeightStrategy,
alligator,
bottom_change_percent,
calculate_n_extrema,
_TRADING_MODES: Final[tuple[TradingMode, ...]] = ("spot", "margin", "futures")
def version(self) -> str:
- return "3.3.173"
+ return "3.3.174"
timeframe = "5m"
@staticmethod
def _get_weights(
- strategy: str, amplitudes: list[float], amplitude_excesses: list[float]
+ strategy: WeightStrategy,
+ amplitudes: list[float],
+ amplitude_excesses: list[float],
) -> list[float]:
- if not isinstance(strategy, str):
- return []
- strategy = strategy.lower().strip()
- if strategy == "amplitude_excess":
+ if strategy == WEIGHT_STRATEGIES[2]: # "amplitude_excess"
return (
amplitude_excesses
if len(amplitude_excesses) == len(amplitudes)
else amplitudes
)
- if strategy == "amplitude":
+ if strategy == WEIGHT_STRATEGIES[1]: # "amplitude"
return amplitudes
return []
amplitude = np.nan
else:
amplitude = abs(value - prev_value) / abs(prev_value)
- threshold_current = thresholds[pos]
+ current_threshold = thresholds[pos]
if (
- np.isfinite(threshold_current)
- and threshold_current > 0
+ np.isfinite(current_threshold)
+ and current_threshold > 0
and np.isfinite(amplitude)
):
- amplitude_excess = amplitude / threshold_current
+ amplitude_excess = amplitude / current_threshold
else:
amplitude_excess = np.nan
else: