def test_cal_price_cosine_6(self):
cosine_pricer = FourierPricer(self.vanilla_option)
strike_arr = np.array([5, 10, 30, 36, 40, 60])
put_call_arr = np.array(['call', 'call', 'put', 'call', 'call', 'put'])
exp = np.array([30.9958673, 26.01656399, 0.15928293, 1.72971868, 0.56756891, 23.82357896])
volatility = 0.20
N = 2000
cosine_pricer.set_log_st_process(CGMY(c=0.1,
g=2,
m=2,
y=1.5))
cosine_pricer.set_pricing_engine(CosineEngine(N, L=30))
res = cosine_pricer.calc_price(strike_arr, put_call_arr, put_label='put')
npt.assert_array_almost_equal(res, exp, 6)
评论列表
文章目录