import numbers


def discrete_signal(signal, step_size):
    """Discretize signal
    
    Parameters
    ----------
    signal: pd.Series
        Signals for betting size ranged [-1, 1]
    step_size: float
        Discrete size
    
    Returns
    -------
    pd.Series
    """
    if isinstance(signal, numbers.Number):
        signal = round(signal / step_size) * step_size
        signal = min(1, signal)
        signal = max(-1, signal)
    else:
        signal = (signal / step_size).round() * step_size
        signal[signal > 1] = 1
        signal[signal < -1] = -1
    return signal