|
From: Luigi B. <lui...@gm...> - 2025-03-08 15:51:48
|
Hi Martin,
where the old DividendVanillaOption class used to take a vector of
dates and the corresponding vector of dividend amounts, the engines now
take a list of dividend objects. In Python, you'll have to go, for
instance, from the old code:
option = ql.DividendVanillaOption(payoff, exercise, dates, dividends)
option.setPricingEngine(ql.FdBlackScholesVanillaEngine(process))
to the new code:
option = ql.DividendVanillaOption(payoff, exercise)
dividend_list = [ql.FixedDividend(amount, d) for d, amount in
zip(dates, dividends)]
option.setPricingEngine(ql.FdBlackScholesVanillaEngine(process,
dividend_list))
The same goes for the other engines. In C++ there is a `DividendVector`
function that simplifies getting the list of dividends, but for some reason
it's not exported to Python; we should do that in a future release. When
that happens, you'll be able to write
`ql.FdBlackScholesVanillaEngine(process, ql.DividendVector(dates,
dividends))`.
As before, the continuous dividend yield (if any) goes into the
Black-Scholes process; that part didn't change.
Luigi
On Fri, Mar 7, 2025 at 6:51 PM Martin Adamec <ma...@da...>
wrote:
> Hi Luigi,
>
> Thank you for your response and useful hints. It it very helpful summary
> and it it matches our general understanding that we formed after checking
> of few previous posts in the mailing list as well as some other resources
> that we could find online.
>
> The only thing on which I couldn’t find more clarity is the way of
> “packaging” discrete dividends vs. dividend yield before sending it to
> either ql.AnalyticDividendEuropeanEngine or ql.FdBlackScholesVanillaEngine
> exercise engines. I noticed that some shifts in data preparation paradigm
> happened specifically in that area and that is actually the main reason why
> I sent this question to the mailing list. I know I should be more specific
> in my first email, but I hope I clarified my concern now.
>
> Please send me a few hints as how to proceed in either case when preparing
> dividend information to be passed to the exercise engine.
>
> Once more, thank you very much
>
> Martin
>
>
> Martin Adamec
> CTO, DataDock Solutions
> datadocksolutions.com
>
>
> 862-221-1246 | ma...@da...
> 40 Wall St, FL 43 | New York, NY 10005 | USA <https://maps.google.com/?q=40%20Wall%20St,%20FL%2042%20%7C%20New%20York,%20NY%2010005%20%7C%20USA>
>
>
>
> On Mar 7, 2025 at 10:09 AM -0500, Luigi Ballabio <lui...@gm...>,
> wrote:
>
> Hi Martin,
> your excerpt seems to miss some possible combinations (European
> option with actual dividend data), or to allow some that wouldn't work
> correctly (DividendVanillaOption with BinomialVanillaEngine) but that might
> be because it's an excerpt, and you have other checks elsewhere. Anyway,
> trying to summarize the current status:
>
> a) always use ql.VanillaOption(payoff, exercise), because
> ql.DividendVanillaOption has been absorbed into it;
> b) choose the engine depending on exercise and whether you have actual
> dividend data:
> - for European options without dividend data, use
> ql.AnalyticEuropeanEngine(process);
> - for European options with dividend data, use
> ql.AnalyticDividendEuropeanEngine(process, dividends);
> - for American options without dividend data, use
> either ql.FdBlackScholesVanillaEngine(process)
> or ql.BinomialVanillaEngine(process, ...);
> - for American options with dividend data, use
> ql.FdBlackScholesVanillaEngine(process, dividends). The binomial engine
> doesn't support dividends.
>
> In short, if you have actual dividend data, pass them to an engine that
> can take care of them.
>
> Hope this helps,
> Luigi
>
>
>
>
>
> On Tue, Mar 4, 2025 at 6:00 PM Martin Adamec via QuantLib-users <
> qua...@li...> wrote:
>
>> Hi quantlib-users,
>>
>> I am reaching out to ask you guys for some hints on proper transitioning
>> to the newly refactored classes and methods related to equity option
>> valuation calcs.
>>
>> We have in our code the older and now apparently outdated construct based
>> on previous organization of the code. It is semi-clear to us how to proceed
>> with the code available in version 1.37 (and most probably and hopefully up
>> for quite a long time).
>>
>> I attached an excerpt of the code that is dealing with the instantiation
>> and proper setup of the option object depending on the exercise style,
>> preselection of the engine, and finally the distinction between the
>> presence of discrete dividend data vs. dividend yield.
>>
>> My understanding is that the new code should be used in somehow simpler
>> fashion but cannot quit clearly figure out the proper way (and maybe order)
>> of setup steps to do to hit all of the input data variations we are
>> considering in our current code.
>>
>> Any hint or advice is going to be highly appreciated,
>>
>> Thank you
>>
>>
>> Martin Adamec
>> CTO, DataDock Solutions
>> datadocksolutions.com
>>
>>
>> 862-221-1246 | ma...@da...
>> 40 Wall St, FL 43 | New York, NY 10005 | USA <https://maps.google.com/?q=40%20Wall%20St,%20FL%2042%20%7C%20New%20York,%20NY%2010005%20%7C%20USA>
>>
>>
>>
>> _______________________________________________
>> QuantLib-users mailing list
>> Qua...@li...
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
>
|