def on_message(self, message):
    if self._log_to:
        pickle.dump(message, self._log_to)
    sequence = message.get('sequence', (- 1))
    if (self._sequence == (- 1)):
        self.reset_book()
        return
    if (sequence <= self._sequence):
        return
    elif (sequence > (self._sequence + 1)):
        self.on_sequence_gap(self._sequence, sequence)
        return
    msg_type = message['type']
    if (msg_type == 'open'):
        self.add(message)
    elif ((msg_type == 'done') and ('price' in message)):
        self.remove(message)
    elif (msg_type == 'match'):
        self.match(message)
        self._current_ticker = message
    elif (msg_type == 'change'):
        self.change(message)
    self._sequence = sequence
def on_message(self, message):
    if self._log_to:
        pickle.dump(message, self._log_to)
    sequence = message.get('sequence', (- 1))
    if (self._sequence == (- 1)):
        self.reset_book()
        return
    if (sequence <= self._sequence):
        return
    elif (sequence > (self._sequence + 1)):
        self.on_sequence_gap(self._sequence, sequence)
        return
    msg_type = message['type']
    if (msg_type == 'open'):
        self.add(message)
    elif ((msg_type == 'done') and ('price' in message)):
        self.remove(message)
    elif (msg_type == 'match'):
        self.match(message)
        self._current_ticker = message
    elif (msg_type == 'change'):
        self.change(message)
    self._sequence = sequence