'Get the trend regarding to the last nb values
The trend is the diff between the mean of the last nb values
and the current one.'

def get_trend(self, item, nb=6):

    raw_history = self.get_raw_history(item=item, nb=nb)
    if ((raw_history is None) or (len(raw_history) < nb)):
        return None
    last_nb = [v[1] for v in raw_history]
    return (last_nb[(-1)] - mean(last_nb[:(-1)]))
