'generated source for method exerciseOptions'

@synchronized(mlock)
def exerciseOptions(self, tickerId, contract, exerciseAction, exerciseQuantity, account, override):

    if (not self.m_connected):
        self.notConnected()
        return
    VERSION = 2
    try:
        if (self.m_serverVersion < 21):
            self.error(EClientErrors.NO_VALID_ID, EClientErrors.UPDATE_TWS, '        It    does    not    support    options    exercise    from    the    API.')
            return
        if (self.m_serverVersion < self.MIN_SERVER_VER_TRADING_CLASS):
            if ((not self.IsEmpty(contract.m_tradingClass)) or (contract.m_conId > 0)):
                self.error(tickerId, EClientErrors.UPDATE_TWS, '        It    does    not    support    conId    and    tradingClass    parameters    in    exerciseOptions.')
                return
        self.send(self.EXERCISE_OPTIONS)
        self.send(VERSION)
        self.send(tickerId)
        if (self.m_serverVersion >= self.MIN_SERVER_VER_TRADING_CLASS):
            self.send(contract.m_conId)
        self.send(contract.m_symbol)
        self.send(contract.m_secType)
        self.send(contract.m_expiry)
        self.send(contract.m_strike)
        self.send(contract.m_right)
        self.send(contract.m_multiplier)
        self.send(contract.m_exchange)
        self.send(contract.m_currency)
        self.send(contract.m_localSymbol)
        if (self.m_serverVersion >= self.MIN_SERVER_VER_TRADING_CLASS):
            self.send(contract.m_tradingClass)
        self.send(exerciseAction)
        self.send(exerciseQuantity)
        self.send(account)
        self.send(override)
    except Exception as e:
        self.error(tickerId, EClientErrors.FAIL_SEND_REQMKT, str(e))
        self.close()
