function deltaToSignal(delta) {
  const abs = Math.abs(delta);
  if (abs < 0.5) return delta >= 0 ? 'neutral' : 'neutral';
  if (abs < 2.0) return delta >= 0 ? 'lean' : 'lean_bearish';
  if (abs < 4.0) return delta >= 0 ? 'bullish' : 'bearish';
  return delta >= 0 ? 'strong_bullish' : 'strong_bearish';
}

function directedDelta(avg, line, direction) {
  // For "over", positive delta is good. For "under", negative delta is good.
  const raw = avg - line;
  return direction === 'under' ? -raw : raw;
}

module.exports = { deltaToSignal, directedDelta };
