'generated source for method calculateImpliedVolatility'

@synchronized(mlock)
def calculateImpliedVolatility(self, reqId, contract, optionPrice, underPrice):

    if (not self.m_connected):
        self.notConnected()
        return
    if (self.m_serverVersion < self.MIN_SERVER_VER_REQ_CALC_IMPLIED_VOLAT):
        self.error(reqId, EClientErrors.UPDATE_TWS, '        It    does    not    support    calculate    implied    volatility    requests.')
        return
    if (self.m_serverVersion < self.MIN_SERVER_VER_TRADING_CLASS):
        if (not self.IsEmpty(contract.m_tradingClass)):
            self.error(reqId, EClientErrors.UPDATE_TWS, '        It    does    not    support    tradingClass    parameter    in    calculateImpliedVolatility.')
            return
    VERSION = 2
    try:
        self.send(self.REQ_CALC_IMPLIED_VOLAT)
        self.send(VERSION)
        self.send(reqId)
        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_primaryExch)
        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(optionPrice)
        self.send(underPrice)
    except Exception as e:
        self.error(reqId, EClientErrors.FAIL_SEND_REQCALCIMPLIEDVOLAT, str(e))
        self.close()
