Hi everyone. 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 a relatively small contribution and a small enough project to get me started with contributing to QuantLib and learn how to contribute code etc. Would that be useful? Best regards, Dima ------------------------------------------------------------------------- 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 |
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 |
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 |
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: ------------------------------------------------------------------------- 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 |
On Thu, Nov 13, 2008 at 8:33 PM, Dima <[hidden email]> wrote:
> 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: [...] Not sure I agree, anyway it could be the right way to start: code it the way it best suits you, provide unit tests (!!!!!), we quickly add it to the experimental folder, gather feedback, and then maybe later refactor the code 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 |
Question:
In the BlackCalculator constructor we have if (stdDev_>=QL_EPSILON) { ... } else{ if (forward>strike_) { cum_d1_ = 1.0; cum_d2_= 1.0;
} else { cum_d1_ = 0.0; cum_d2_= 0.0; } } I wonder if that's 100% right or if I've overlooked something. But if forward==strike,
then we have log(f/K)=0, so, if vol is not zero, we should rather have cum_d1=N (0*5*stdDev_) which would be approximately 0.5 for very small vols. Opinions?
2008/11/14 Ferdinando Ametrano <[hidden email]>
------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Dima
> I plan to add some new FX machinery to QuantLib. if applicable please consider adding generic formulas to ql/pricingengines/blackformula.hpp > In the BlackCalculator constructor we have > if (stdDev_>=QL_EPSILON) { > ... > } > else{ > if (forward>strike_) { > cum_d1_ = 1.0; > cum_d2_= 1.0; > } else { > cum_d1_ = 0.0; > cum_d2_= 0.0; > } > } > I wonder if that's 100% right or if I've overlooked something. But if > forward==strike, > then we have log(f/K)=0, > so, if vol is not zero, we should rather have > cum_d1=N (0*5*stdDev_) > which would be approximately 0.5 for very small vols. Opinions? yeah, you're right. It should be patched as below, isn't it? if (stdDev_>=QL_EPSILON) { if (close(strike_, 0.0)) { cum_d1_ = 1.0; cum_d2_ = 1.0; n_d1_ = 0.0; n_d2_ = 0.0; } else { D1_ = std::log(forward/strike_)/stdDev_ + 0.5*stdDev_; D2_ = D1_-stdDev_; CumulativeNormalDistribution f; cum_d1_ = f(D1_); cum_d2_ = f(D2_); n_d1_ = f.derivative(D1_); n_d2_ = f.derivative(D2_); } } else { if (close(forward, strike_)) { cum_d1_ = 0.5; cum_d2_ = 0.5; n_d1_ = M_SQRT_2 * M_1_SQRTPI; n_d2_ = M_SQRT_2 * M_1_SQRTPI; } else if (forward>strike_) { cum_d1_ = 1.0; cum_d2_ = 1.0; n_d1_ = 0.0; n_d2_ = 0.0; } else { cum_d1_ = 0.0; cum_d2_ = 0.0; n_d1_ = 0.0; n_d2_ = 0.0; } } ciao -- Nando ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Nando, I think the modification should be ok for the blackcalculator. I've uploaded
my current working version of the deltacalculator including a testsuite(your recent change not incl.). You can get it here: longvega.com/DeltaEngine.zip Now as you see its not really incorporated into blackcalculator and lets see how we might be able to join the concepts. My reasons were the following: 1) First of all, we have 4 deltas to take care of and even more atm quotes, which are rather FX specific, since we have 2 numeraires. So I have enums, which basically have only FX specific types, don't know if that should go into a general blackcalculator. 2) I needed functions such as Real deltaFromStrike(const Real &strike) const; Real strikeFromDelta(const Real &delta) const; since they will be later called very often in some numerical procedures in the smile setup. Again, its FX specific to quote vols again deltas from which we can extract strikes. And again, the functions return different values for different deltas. It would be a bit incoherent from my point of view to return a strike different from the one given in the constructor, as would be the case for the blackcalc. Here functions are generic, in a blackcalculator I might need to setup 8 new functions? The bigger problem for me was, that the strike in blackcalc is in the payoff, and I need it to change very often. So I've created a parsimonious constructor which doesn't need a strike nor a delta. If you look into strikeFromDelta, you'll see numerical procedures for premium adjusted stuff, so I can't really make use of cached data anyways and it doesn't have to do a lot with the standard black formulas anymore. Btw: I'd appreciate a function which returns d1 and d2 in blackcalc, which I need for other functions I'm working on as well. If that would be possible, I'd setup a blackcalc in my class and the whole class would be basically based on the blackcalc. I'm open to discussion. Whats your oppinion? Thanks 2009/4/20 Ferdinando Ametrano <[hidden email]> Hi Dima ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
While I'm still waiting for feedback, I continue coding and have VannaVolga and
Malz ready, testing included. Can I ask for a simple feature which I need in these implementations? I'd need smilesection.hpp to return the reference date. Is this possible? Thanks 2009/4/21 Dima <[hidden email]> Nando, I think the modification should be ok for the blackcalculator. I've uploaded ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Mon, Apr 27, 2009 at 11:03 AM, Dima <[hidden email]> wrote:
> While I'm still waiting for feedback I've just committed your fix for the (stdDev<QL_EPSILON, fwd==strike) case > I'd need smilesection.hpp to return the reference date. Is this possible? just done. > I continue coding and have VannaVolga and > Malz ready, testing included. share them as a patch whenever you're comfortable with them ciao -- Nando ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Thanks a lot. Did you have the chance to look at the black calculator that I posted?
Sorry for annoying, but since I'm using it intensively in all of my current classes I'm just afraid that the discussion will start later and I have to go back and change everything in all of the classes :) 2009/4/27 Ferdinando Ametrano <[hidden email]>
------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Dimathematician
On Tue, 2009-04-21 at 09:49 +0200, Dima wrote:
> I've uploaded > my current working version of the deltacalculator including a > testsuite(your recent change not incl.). > > You can get it here: > > longvega.com/DeltaEngine.zip > Dimitri, I've added your stuff to the Subversion trunk under q;/experimental/fx. May you check it out and see that I haven't broken anything? Thanks, Luigi -- Academic: a term of opprobrium applied to those that do their job well by those who cannot. -- Sir Ernest Gowers ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Thanks Luigi and sorry for not having answered earlier. I'm busy. I tried to build QL from the latest trunk
but was not sucessfull. And the stuff you added is not in the official 1.0 version, so I couldn't really check. Don't know what happened to the trunk files, they seem to be corrupted. For example, in smilesection.hpp I find <<<<<<<<<<.mine in the code. Its either a problem here or in the trunk. 2010/2/15 Luigi Ballabio <[hidden email]>
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Wed, 2010-03-03 at 09:47 +0100, Dima wrote:
> Thanks Luigi and sorry for not having answered earlier. I'm busy. I > tried to build QL from the latest trunk > but was not sucessfull. And the stuff you added is not in the official > 1.0 version, so I couldn't really check. > Don't know what happened to the trunk files, they seem to be > corrupted. For example, in smilesection.hpp > I find > > <<<<<<<<<<.mine > > in the code. Its either a problem here or in the trunk. The trunk is clean. You modified the code on your machine, made a svn update, and got a conflict between your local changes and the changes pulled in by the update. Subversion doesn't know how to merge them and keeps both sets of changes between markers such as the one above. You'll have to resolve the conflict manually. You can see <http://svnbook.red-bean.com/en/1.5/svn.tour.cycle.html#svn.tour.cycle.resolve> for more details. Luigi -- The box said "Use Windows 95 or better," so I got a Macintosh. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
I see, thanks. Will get back to you
2010/3/3 Luigi Ballabio <[hidden email]>
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
I feel kind of bad since I needed so much time to check! Anyways, I
checked and everything seems to be ok. I've attached an example project which uses the contributed class, similar to the other example projects. You might want to add it to the trunk. Anyways, I appologize for such a slow response time! Bad bad. Meanwhile I've extended the class... 2010/3/3 Dima <[hidden email]> I see, thanks. Will get back to you ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev FxBlackDeltaExamples.rar (8M) Download Attachment |
On Mon, 2010-06-07 at 18:05 +0200, Dima wrote:
> I feel kind of bad since I needed so much time to check! After seeing _my_ response times? You're too harsh on yourself :) > Anyways, I checked and everything seems to be ok. I've attached an > example project which uses the contributed class, similar to the other > example projects. You might want to add it to the trunk. Ok, I'll have a look. Thanks, Luigi -- There's no sense in being precise when you don't even know what you're talking about. -- John von Neumann ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi there,
I am using Quantlib for a bit, and I started to develop some enhancements to the library. As I am new to Quantlib development, I am not sure about the right procedure to supply source code to QuantLib. How and with whom can/should I discuss my solution? Is there anybody who can help me? These are my topics: 1) I developed a minor enhancement to QL, allowing to use ZeroBonds in class "FittedBondDiscountCurve", furthermore I added the complete "FittedBondDiscountCurve" functionality to QuantlibAddin / XL, to be able to calculate the curve fitting in XL. I would like to provide these enhancement to the project or someone who will review these changes to ensure that they are conform to the coding styles from Quantlib. Can you please let me know how to continue or whom to contact? 2) Currently I am working on simultaneously fitting credit spread curves based on coporate bonds with different ratings as input. In other words: I am simultaneously fitting multiple sets of bonds (Fixedratebonds and Zerobonds) for different ratings. For each set of bonds I am calculating the spread on top of a basis curve (e.g. Swapcurve) which will be simultaneously fitted with a simplified Nelson-Siegel method. The fit is done with constraints, so that the resulting curves have the expected behaviour. This functionality is completely available in XL (and QuantLibAddin) as well. Might this be of interest for the QL-project? Please let me know. Kind regards Michael ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Tue, 2010-06-22 at 10:06 +0200, Michael Waßmann wrote:
> I am using Quantlib for a bit, and I started to develop some enhancements > to the library. > > As I am new to Quantlib development, I am not sure about the right > procedure to supply source code to QuantLib. How and with whom can/should > I discuss my solution? Is there anybody who can help me? You can either post your code here, or submit a patch to the Sourceforge patch manager. If you're contributing modifications to old files (as opposed to entirely new files), a diff would be the best way. Later, Luigi -- Blessed is the man who, having nothing to say, abstains from giving wordy evidence of the fact. -- George Eliot ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Michael Waßmann
Hi Michael
> I developed a minor enhancement to QL, allowing to use > ZeroBonds in class "FittedBondDiscountCurve", furthermore I > added the complete "FittedBondDiscountCurve" functionality to > QuantlibAddin / XL, to be able to calculate the curve > fitting in XL. Replacing FixedRateBondHelper with BondHelper does compile successfully (and no problem from the test suite), so the usage of FixedRateBondHelper was probably just a legacy limitation and any kind of Bond can be used now. Am I missing something ? ciao -- Nando ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |