setPricingEngine导入pyql

时间:2016-06-25 04:42:53

标签: python quantlib

<div id="locationField">
      <input id="autocomplete" placeholder="Enter your address"
             onFocus="geolocate()" type="text"></input>
</div>

给出错误

european_option = VanillaOption(payoff, exercise)


spot_handle = SimpleQuote(spot_price)
flat_ts = FlatForward(calculation_date, risk_free_rate, day_count)
dividend_yield = FlatForward(calculation_date, dividend_rate, day_count)
flat_vol_ts = BlackConstantVol(calculation_date, cal, volatility, day_count)

bsm_process = BlackScholesMertonProcess(spot_handle, 
                                        dividend_yield, 
                                        flat_ts, 
                                        flat_vol_ts)

european_option.setPricingEngine(AnalyticEuropeanEngine(bsm_process))

我需要什么导入?

1 个答案:

答案 0 :(得分:2)

您无需额外导入。错误的原因是pyql开发人员已经导出了一些具有不同名称的QuantLib,以便遵循PEP 8并在Python中更加惯用。正确的电话是

european_option.set_pricing_engine(AnalyticEuropeanEngine(bsm_process))

this pyql example可以看到。