'generated source for method calculateOptionPrice'

@synchronized(mlock)
def calculateOptionPrice(self, reqId, contract, volatility, underPrice):

    if (not self.m_connected):
        self.notConnected()
        return
    if (self.m_serverVersion < self.MIN_SERVER_VER_REQ_CALC_OPTION_PRICE):
        self.error(reqId, EClientErrors.UPDATE_TWS, '        It    does    not    support    calculate    option    price    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    calculateOptionPrice.')
            return
    VERSION = 2
    try:
        self.send(self.REQ_CALC_OPTION_PRICE)
        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(volatility)
        self.send(underPrice)
    except Exception as e:
        self.error(reqId, EClientErrors.FAIL_SEND_REQCALCOPTIONPRICE, str(e))
        self.close()
