':type ask: Ask'

def insert_ask(self, ask):

    assert isinstance(ask, Ask), type(ask)
    if ((not self._asks.tick_exists(ask.order_id)) and ask.is_valid()):
        self._asks.insert_tick(ask)
        timeout_delay = ((float(ask.timestamp) + float(ask.timeout)) - time.time())
        task = deferLater(reactor, timeout_delay, self.timeout_ask, ask.order_id)
        self.register_task(('ask_%s_timeout' % ask.order_id), task)
        return task.addErrback(self.on_timeout_error)
    return fail(Failure(RuntimeError('ask    invalid'))).addErrback(self.on_invalid_tick_insert)
