test_pricing_class.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:fftoptionlib 作者: arraystream 项目源码 文件源码
def test_cal_price_cosine_2(self):
        cosine_pricer = FourierPricer(self.vanilla_option)
        strike_arr = np.array([5, 10, 30, 36, 50, 60])
        put_call_arr = np.array(['call', 'call', 'put', 'call', 'call', 'put'])
        exp = np.array([3.09958568e+01, 2.60164423e+01, 9.56077953e-02, 8.81357807e-01,
                        1.41769466e-10, 2.37785797e+01]
                       )

        volatility = 0.20
        N = 2000

        cosine_pricer.set_log_st_process(MertonJump(sigma=volatility,
                                                    jump_rate=0.090913148257155449,
                                                    norm_m=-0.91157356544103341,
                                                    norm_sig=7.3383200797618833e-05))
        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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号