Posted by
Dimathematician on
Nov 13, 2008; 7:33pm
URL: http://quantlib.414.s1.nabble.com/Adding-new-functions-to-blackcalculator-tp13518p13521.html
Ok, thanks a lot for your replies! After thinking about it I'd suggest
to code the delta calculations in a new class called BlackDeltaCalculator
with a similar constructor as the BlackCalculator class. This might look like
overkill (an own class for Delta calculation) on first sight, but my reasons are
as follows:
- we'll have to deal with 4 deltas, which could be conveniently
coded in an enumeration which could be passed to the
constructor.
- we'll need 4 different functions to return a strike for a given
delta. 2 of them will include a zero root search algorithm (premium
adjusted ones). This could be all handled by one function strike().
- We will need at least two functions, which return the strike for
an ATM convention (e.g. atm forward or atm delta neutral straddle).
Delta neutral straddle strike depends again on the 4 delta conventions.
So, to summarize: if we would try to build that in the current BlackCalculator
class, this would mess things up a lot, since many delta specific functions
would be needed, which are mostly used in FX.
I'm very open to other suggestions. What do you think? Regards, Dima
2008/11/13 Ferdinando Ametrano
<[hidden email]>
On Thu, Nov 13, 2008 at 12:42 PM, Dima <[hidden email]> wrote:
> Ok, good. [...] So, how to proceed?
It would be better if you work on the current trunk version, so
familiarize yourself with svn and check out the trunk snapshot. See
http://quantlib.org/svn.shtml
Also please read the "Developer introduction" at
http://quantlib.org/newdeveloper.shtml
> Will I work with someone of the core
> developers of the class closely?
I am the class main developer, but a) I'm not that proud of its design
b) it's not that complex c) Luigi is THE man
Just post on the dev list and somebody will step up and help you.
> Since I wasn't sure
> what to do with the blackcalculator class.
Please take a look at the blackformula file, where you can find
(hopefully) efficient formula for price and implied vol. You might
probably consider to implement strikeForDelta as function instead of
BlackCalculator class method.
BlackCalculator is just an aggregation of less used formulae with some
common calculation factorized at construction time.
See also BlackScholesCalculator. ImpliedVol and StrikeForDelta might
be wrapped as BlackCalculator methods if needed
> It seems,
> like Asset or Nothing and Cash or Nothing options
> are dealed with in the same class. But that is something
> that would be difficult to incorporate for functions such
> as strikeForDelta, since it basically applies to vanilla
> option deltas only.
check for the payoff and throw, or if you go for the function approach
use the appropriate vanilla payoff signature
> I can do Vanna-Volga and Malz, if needed.
It would be appreciated; take a look at Sabr and/or Abcd interpolation
> Also, I'd need some guidance how
> to start with the contribution...
Feel fre to ask here on the public mailing list any further questions
ciao -- Nando
> 2008/11/13 Ferdinando Ametrano <
[hidden email]>
>>
>> Hi Dimitri
>>
>> > I'm new to this list. I'm thinking about adding new functions
>> > to the blackcalculator, which are in particular needed in the
>> > FX area. In particular, I'd like to add:
>> >
>> > - premium adjusted black scholes deltas (spot and forward)
>> > - functions, which return the strike for a given black scholes delta or
>> > ATM
>> > quotation
>>
>> this would be very much appreciated! I've been thinking about tackling
>> the last issue it's long time now, but never had the occasion.
>> BTW I've noticed that an algorithm is provided in the last version of
>> Haug Fomulas book, anyway i don't know if it is the most efficient
>> algorithm available
>>
>> As for premium adjusted black scholes deltas I'm not familiar with FX,
>> but just go ahead and document the features.
>>
>> And while there, anyone willing to provide Vanna-Volga interpolation?
>>
>> ciao -- Nando
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev