最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Quantlib pyhton heston model path generation - Stack Overflow

programmeradmin0浏览0评论

I would like to use my fitted Heston model to generate paths to price an exotic type of option, but I have a couple questions I can't seem to answer with the docs and examples.

Why does the GaussianMultiPathGenerator or GaussianSobolMultiPathGenerator only take the process and not the model? The model contains the fitted parameters with the help of the volatility surfaces, but the process doesn't seem to contain a reference to those, how is it working? Should I fit the model, take the parameters and create a new process with the fitted parameters? Additionally, as I'm working with futures, I was planning to pass the rates and yield curves as 0 for all points. Would that work so the process has no drift?

dt = 1/252
# number of days from today to 31 march 2026
days = np.busday_count(pd.Timestamp.today().date(),pd.Timestamp('2026-03-31').date())
T = days*dt
N_paths = 10000
N_steps = days
busines_days = pd.bdate_range(start_date,periods=days)

uniform_gen = ql.UniformRandomSequenceGenerator(int(2*N_steps),ql.UniformRandomGenerator())
gaussian_gen = ql.GaussianRandomSequenceGenerator(uniform_gen)
times = list(ql.TimeGrid(T, int(N_steps)))

multipath = ql.GaussianMultiPathGenerator(heston_process, times, gaussian_gen, False)

I would like to use my fitted Heston model to generate paths to price an exotic type of option, but I have a couple questions I can't seem to answer with the docs and examples.

Why does the GaussianMultiPathGenerator or GaussianSobolMultiPathGenerator only take the process and not the model? The model contains the fitted parameters with the help of the volatility surfaces, but the process doesn't seem to contain a reference to those, how is it working? Should I fit the model, take the parameters and create a new process with the fitted parameters? Additionally, as I'm working with futures, I was planning to pass the rates and yield curves as 0 for all points. Would that work so the process has no drift?

dt = 1/252
# number of days from today to 31 march 2026
days = np.busday_count(pd.Timestamp.today().date(),pd.Timestamp('2026-03-31').date())
T = days*dt
N_paths = 10000
N_steps = days
busines_days = pd.bdate_range(start_date,periods=days)

uniform_gen = ql.UniformRandomSequenceGenerator(int(2*N_steps),ql.UniformRandomGenerator())
gaussian_gen = ql.GaussianRandomSequenceGenerator(uniform_gen)
times = list(ql.TimeGrid(T, int(N_steps)))

multipath = ql.GaussianMultiPathGenerator(heston_process, times, gaussian_gen, False)
Share Improve this question edited Mar 3 at 21:50 Félix Rodriguez Moya asked Mar 3 at 16:29 Félix Rodriguez MoyaFélix Rodriguez Moya 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The path generator, which is generic, takes a process because not all processes have a corresponding model class.

In C++, once the Heston model is calibrated, one can call model->process() to obtain the process with the correct parameters. However, that method seems to have been overlooked in the Python wrappers. I'll make it available in one of the next releases, but for now, as you said, you'll have to take the parameters and create a new process.

As for the rates: passing 0 would give you no drift but also no discounting, which is probably not what you want. Instead, you can do what the BlackProcess class does; pass a dividend yield equal to the risk-free rate, so they cancel out in the drift but you still have the correct interest rates for discounting.

发布评论

评论列表(0)

  1. 暂无评论