Hi,
What does forwardengine.hpp do as from snippet below, the forwardprocess is constructed using spot,dividendYield and risk free rate, but my forward process is driftless?
Basically what I am getting at is I want to price an option on a commodity forward contract.
boost::shared_ptr<GeneralizedBlackScholesProcess> fwdProcess(
new GeneralizedBlackScholesProcess(spot, dividendYield,
riskFreeRate,
blackVolatility));
Also I dont see the use of blackformula in the unit test.
There is a forwardoption in the unit test ie.
struct ForwardOptionData {
Option::Type type;
Real moneyness;
Real s; // spot
Rate q; // dividend
Rate r; // risk-free rate
Time start; // time to reset
Time t; // time to maturity
Volatility v; // volatility
Real result; // expected result
Real tol; // tolerance
};
which uses which is using s,q, and r to form forward price and then use blacksholes merton process to price option on forwards, its not using,forward.hpp/forward.cpp and black formula.
Regards
Theo
-----Original Message-----
From: quantlib-dev-request <[hidden email]> To: quantlib-dev <[hidden email]> Sent: Wed, 14 Nov 2012 9:50 Subject: QuantLib-dev Digest, Vol 78, Issue 3 Send QuantLib-dev mailing list submissions to [hidden email] To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/quantlib-dev or, via email, send a message with subject or body 'help' to [hidden email] You can reach the person managing the list at [hidden email] When replying, please edit your Subject line so it is more specific than "Re: Contents of QuantLib-dev digest..." Today's Topics: 1. Black Vega (Peter Caspers) 2. [ quantlib-Patches-3582579 ] Differential Evolution improvement (SourceForge.net) 3. Re: Garch11 in Quantlib (Luigi Ballabio) (Luigi Ballabio) 4. Re: Multicurve discounting (ED) 5. [ quantlib-Patches-3102452 ] GARCH calibration (SourceForge.net) ---------------------------------------------------------------------- Message: 1 Date: Mon, 12 Nov 2012 11:49:05 +0100 From: Peter Caspers <[hidden email]> Subject: [Quantlib-dev] Black Vega To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset="iso-8859-1" Hi, in blackformula.cpp , blackFormulaStdDevDerivative(...) the limit case stdDev == 0.0 seems to be treated false, lines 307ff if (stdDev==0.0) { if (forward>strike) return discount * forward; else return 0.0; } should be if (stdDev==0.0) return 0.0; because \phi(x) -> 0 whenever |x| -> \infty, right ? Thanks Peter -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 2 Date: Mon, 12 Nov 2012 07:24:08 -0800 From: SourceForge.net <[hidden email]> Subject: [Quantlib-dev] [ quantlib-Patches-3582579 ] Differential Evolution improvement To: SourceForge.net <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=UTF-8 Patches item #3582579, was opened at 2012-11-01 15:38 Message generated for change (Comment added) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3582579&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mateusz Kapturski (fenixcitizen) Assigned to: Nobody/Anonymous (nobody) Summary: Differential Evolution improvement Initial Comment: Hi All, I have come across the new implementation of Differential Evolution that appeared in QuantLib HEAD source code recently. I decided to improve it slightly. I took performance very seriously as the DE implementation should be light in order to avoid unnecessary time overhead. The most significant change is that I use DiffEvolConfiguration object that defines the behavior of the algorithm. The reason is that it makes the implementation more flexible. There are dozens of DE variants... I tried to be in line with current QuantLib optimization interface. Important changes: 1) DE Optimizer consumes configuration object that defines its behavior - as I mentioned, the number of variations of the DE algorithm is huge. This approach makes it possible to extend the implementations in the future. 2) Constraints that define search space are not the part of the algorithm itself - this is why additional upperBound and lowerBound functions were added to Constraint object. NonhomogeneousBoundaryConstraint to define box constraints was added too. The other aspect is if the bounds are going to be valid for emerging populations - practical advise is that it should as for certain parameters, new populations seem to diverge. On the other hand, it adds some additional overhead. General observation is that it is always possible to improve performance for a given objective function. One needs to find appropriate DE configuration only. 3) I added three different crossover types: normal, binomial and exponential (the name for the first crossover type comes from the fact that assuming binomial crossover, the number of mutants taken into account in a given population converges in distribution to normal variable for growing problem size) 4) There are 6 methods available in this implementation. However, it is possible to go further and implement various base element types, differences of a given size, various weights distributions for the differences etc. Implemented approaches are the most common used in practice as the more complicated recombination procedure, the higher computation cost is. 5) For ModFourthDeJong objective function as I was able to find a point for which the objective function value is 8.86549 which is significantly lower than 12.3724219287 : DE type: bestMemberWithJitter Crossover type: normal Apply Bounds: true CrossoverProb: 0.25 NumOfPopulationMembers: 500 PrintFullInfo: false StepsizeWeight: 0.2 MaxIterations Point: [ 0.299015; 0.352861; -0.0306954; -0.349516; 0.202407; 0.111475; 0.0783742; -0.0640798; 0.284987; -0.00386122; 0.134481; -0.174184; -0.0188605; 0.217705; 0.0557937; 0.176954; -0.0757169; 0.219995; -0.079788; -0.142831; -0.129607; 0.135615; -0.152286; 0.0420379; -0.193061; 0.0582583; -0.0617313; -0.238126; -0.11224; -0.069721 ] Objective function value: 8.86549 However, this is the best result only. Usually, the algorithm was stuck in several local minimas - most of them in [10;15] range. Further investigation is needed. 6) I have problem with Griewangk function too. I am not able to find fully successful method although the objective function value oscillated around 0.1 which is not bad. It needs to be verified. I find the bestMemberWithJitter method the most successful and this is the only reason I set it as default method to be used. Hope it helps. I am happy to answer your questions. In case my patch does not work properly, please use changed files directly. Kind regards, Mateusz Kapturski ---------------------------------------------------------------------- Comment By: https://www.google.com/accounts () Date: 2012-11-12 07:24 Message: Hi Mateusz, good that the adaptive method seems to add some value to your implemetation ;-) When I run the test cases, 4 out of 5 pass now. However, for the ModFourthDeJong objective function, I get 12.0945 instead of your 10.964. Maybe this is due to the fact that I'm using a different boost version (1.47.0) and that boost's MT impementation has changed, but I don't know if it's worth investgating on this issue or rather exclude the ModFourthDeJong test case for now (because both values are valid). Ralph ---------------------------------------------------------------------- Comment By: Mateusz Kapturski (fenixcitizen) Date: 2012-11-11 13:35 Message: Hi Ralph, Luigi you were right - self adapting method is quite successful. I have already added it to my implementation. All tests are passed now. I would be grateful if you double check my results. I think this is a stable version that can go to QL trunk. QL users have much more options now. Recent changes/remarks: 1) Crossover self-adaptation is a separate option - it was very easy to implement it that way. 2) User can decide if DE should use fixed seed or not (as discussed earlier) 3) Adaptation is performed on the population member basis as stated in the paper. 4) Additional rotation was added to the self-adaptive method to improve its performance. 5) Extracted some logic into separate private methods. 6) Original Griewangk function is usually defined on [-600, 600]^n box and my DE implementation is successful on this search domain. ---------------------------------------------------------------------- Comment By: https://www.google.com/accounts () Date: 2012-11-08 00:23 Message: Hi Mateusz, thank you for your reply. The adaptive method can be found here (section V): Brest, J. et al., 2006, "Self-Adapting Control Parameters in Differential Evolution: A Comparative Study on Numerical Benchmark Problems." ( A link which worked for me is http://150.214.190.154/docencia/sf1/Brest06.pdf) And yes, the adaptive method always found the minimum of the Griewanck function when I played around with it. Ralph ---------------------------------------------------------------------- Comment By: Mateusz Kapturski (fenixcitizen) Date: 2012-11-07 14:44 Message: Hi Ralph, thank you for your remarks. 1) Fixing the seed for reproducibility is a great idea. I simply forgot to do it. I tested my implementation against current time as seed to be perfectly sure that results are reliable. I added an optional config param. One may want "increase randomness" using the useFixedSeed_=false parameter. Therefore, both options are available now. 2) This is a philosophical aspect. I used Boost as it was just easier for me and I find it a reliable tool. It does not add external dependency as QL already uses Boost libraries. The question is if there is value added if we change it. In my view - not significant. If you would like to change it, just go for it. 3) I see your point now with respect to ModFourthDeJong. My random results were connected with your first observation - after fixing the seed, I obtained stable minimum equal to 10.409792. I have already amended the test case. 4) The adaptive method is not implemented yet but it can be easily added. Could you provide more details on the method as I could not find it in the literature. The most important aspects are: how many differences are taken into account and how are weights applied to it? Was crossover important aspect for this method? And last practical question: Was the adaptive strategy successful for every chosen seed in your implementation? Griewangk objective function is probably the last major issue to resolve now. Thanks Mateusz ---------------------------------------------------------------------- Comment By: https://www.google.com/accounts () Date: 2012-11-07 00:42 Message: Hi Mateusz, I have some remarks/questions concerning your DE implementation: 1. You are using time(0) for the seed in the generation of the initial population (differentialevolution.cpp, line 27). Wouldn't a fix seed be better for reproducability, in the sense that the same data yield the same result? 2. As a part of QuantLib, shouldn't one choose QuantLib's random number generator instead of boost's? 3. For the ModFourthDeJong you mention that you find a lower minimum than the previous implementation. But that's not the point. If you take a look at the function, you see the uniform random part, i.e. the functional minimum is f(0) <= 30*Expectation(uniform) = 15. Therefore you'll get different realizations for different random numbers, which is ok as long as the minimum found is below 15. 4. For the Griewangk function, the adaptive method in the current DE implementation succeeds to find the minimum f(0) = 0. Is the adaptive method implemented (or implementable) in your code as well? Thanks, Ralph ---------------------------------------------------------------------- Comment By: Mateusz Kapturski (fenixcitizen) Date: 2012-11-06 16:15 Message: Hi Luigi, I have a habit of constant auto forrmatting when coding in Eclipse... Unfortunately, the autoformat profile cannot be adjusted to QL style easily. I removed unnecessary changes in order to make the patch more readable. Mateusz BTW. Is it possible to use other external tool (e.g. vim or emacs) to format source code file in line with QL style? First line in each QL file specifies autoformat options, doesn't it? ---------------------------------------------------------------------- Comment By: Luigi Ballabio (lballabio) Date: 2012-11-06 00:29 Message: Mateusz, thanks for the contribution. However, the patch is made practically unreadable by the fact that you re-indented the files (for instance, the Constraint class shows as completely changed, whereas you only actually added the lowerBound and upperBound methods). May you reformat the files so that they match the original indentation, and therefore so that the patch only contains the actual differences? This might seem picky on my part, and I know I'm asking some work; but on the one hand, as I said, the patch (and the diffs from version-control, once your changes get in) would be made more clearly readable, and on the other hand, having a consistent format in the library sources makes it easier to see the context. Thanks, Luigi ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3582579&group_id=12740 ------------------------------ Message: 3 Date: Tue, 13 Nov 2012 13:25:29 +0100 From: Luigi Ballabio <[hidden email]> Subject: Re: [Quantlib-dev] Garch11 in Quantlib (Luigi Ballabio) To: Slava Mazur <[hidden email]> Cc: "[hidden email]" <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 Done. Apologies for the delay. Luigi On Tue, May 15, 2012 at 3:12 PM, Slava Mazur <[hidden email]> wrote: > Check it out: > > http://sourceforge.net/tracker/?func=detail&aid=3102452&group_id=12740&atid=312740 > > Submitted there on Nov 2010. > > Cheers, > > Slava Mazur > > > Message: 5 > Date: Mon, 14 May 2012 13:25:47 -0400 > From: Yue Zhao <[hidden email]> > Subject: [Quantlib-dev] Garch11 in Quantlib > To: QuantLib Dev <[hidden email]> > Message-ID: > <[hidden email]> > Content-Type: text/plain; charset="iso-8859-1" > > Hi, > > My question might be silly. I am using the Garch11 class in QL, but I didn't see how to calibrate this model. Does anyone know how do calibration? > > Best > > Yue > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > Message: 6 > Date: Tue, 15 May 2012 09:35:10 +0200 > From: Luigi Ballabio <[hidden email]> > Subject: Re: [Quantlib-dev] Garch11 in Quantlib > To: Yue Zhao <[hidden email]> > Cc: QuantLib Dev <[hidden email]> > Message-ID: > <[hidden email]> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > at this time there's no code for calibration in the library (the > Garch11 class declares a calibrate method, but it's empty). If anyone wants to contribute it, I'll be glad to add it to the repository. > > Luigi > > On Mon, May 14, 2012 at 7:25 PM, Yue Zhao <[hidden email]> wrote: >> My question might be silly. I am using the Garch11 class in QL, but I >> didn't see how to calibrate this model. Does anyone know how do calibration? > > > > ------------------------------ > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > ------------------------------ > > _______________________________________________ > QuantLib-dev mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > > > End of QuantLib-dev Digest, Vol 72, Issue 5 > ******************************************* > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > QuantLib-dev mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-dev ------------------------------ Message: 4 Date: Tue, 13 Nov 2012 20:33:07 -0500 From: ED <[hidden email]> Subject: Re: [Quantlib-dev] Multicurve discounting To: [hidden email], [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=UTF-8 On Mon, Sep 3, 2012 at 12:19 PM, Ferdinando Ametrano<[hidden email]> wrote: > On Mon, Sep 3, 2012 at 5:11 PM, Grze? Andruszkiewicz > <[hidden email]> wrote: >> Does QuantLib support multicurve discounting, i.e. when you discount >> using one curve (OIS), but use another curve (i.e. 3M LIBOR) for >> determining of the cash flows? > yes it does Hi Nando, What if all you have to build your OIS curve is FFvs3M basis swaps? In that case you need to jointly calibrate your 3M and OIS curves, as they are interdependent. Would you have some pointers on how to do that within Quantlib? Best Regards, Ed ------------------------------ Message: 5 Date: Tue, 13 Nov 2012 04:21:56 -0800 From: SourceForge.net <[hidden email]> Subject: [Quantlib-dev] [ quantlib-Patches-3102452 ] GARCH calibration To: SourceForge.net <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=UTF-8 Patches item #3102452, was opened at 2010-11-03 13:16 Message generated for change (Comment added) made by lballabio You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3102452&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Slava Mazur (shlagbaum) >Assigned to: Luigi Ballabio (lballabio) Summary: GARCH calibration Initial Comment: Re-designed GARCH volatility model with calibration proposed. Calibration is based on two types of initial approximation and employs simplex optimization method as a default. An ability to provide a user defined optimization method, end criteria and initial guess are also included. More details and examples of use can be found in the attached QuantLib test suite unit. ---------------------------------------------------------------------- Comment By: Luigi Ballabio (lballabio) Date: 2012-11-13 04:21 Message: The patch was applied (with some modifications) to the code repository. It will be included in next release. Thank you. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3102452&group_id=12740 ------------------------------ ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ------------------------------ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev End of QuantLib-dev Digest, Vol 78, Issue 3 ******************************************* ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Theo,
just to check: I'm not sure that the forward option implemented in forwardengine.hpp is what you mean as "an option on a forward". What it prices is an option whose strike will be fixed at a later time as a percentage of the forward price. For instance, when we close the deal today we agree that the maturity will be in 9 months, and the strike will be 90% of the underlying price in 3 months. Three months from today, we observe the underlying price, we calculate the strike accordingly, and from that point hence the option is a normal one. Is this what you had in mind? Also, I'd like to post the answer to the mailing list as well, since it might be useful to others. Should I remove your name and/or address before doing so? Later, Luigi On Thu, Nov 15, 2012 at 11:29 AM, Theo Boafo <[hidden email]> wrote: > Hi, > > I want to price an European Option on a forward contract, so I can create a > forward contract using forward in Instrument ie forward.hpp/forward.cpp and > then use black formula to price. > > What does forwardengine.hpp do as from snippet below, the forwardprocess is > constructed using spot,dividendYield and risk free rate, but my forward > process is driftless? > > Basically what I am getting at is I want to price an option on a commodity > forward contract. > > boost::shared_ptr<GeneralizedBlackScholesProcess> fwdProcess( > new GeneralizedBlackScholesProcess(spot, > dividendYield, > riskFreeRate, > blackVolatility)); > > Also I dont see the use of blackformula in the unit test. > > There is a forwardoption in the unit test ie. > > struct ForwardOptionData { > Option::Type type; > Real moneyness; > Real s; // spot > Rate q; // dividend > Rate r; // risk-free rate > Time start; // time to reset > Time t; // time to maturity > Volatility v; // volatility > Real result; // expected result > Real tol; // tolerance > }; > > > which uses which is using s,q, and r to form forward price and then use > blacksholes merton process to price option on forwards, its not > using,forward.hpp/forward.cpp and black formula. > > Regards > > Theo ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Oh, I see. You had sent this to the mailing list already. I got a
very similar email recently that was sent to me directly, and when I saw yours I mixed them up. Sorry, I made a fool of myself again. Folks, word of advice: write to the mailing list as Theo did. Later, Luigi On Mon, Nov 26, 2012 at 3:31 PM, Luigi Ballabio <[hidden email]> wrote: > Theo, > just to check: I'm not sure that the forward option implemented in > forwardengine.hpp is what you mean as "an option on a forward". What > it prices is an option whose strike will be fixed at a later time as a > percentage of the forward price. For instance, when we close the deal > today we agree that the maturity will be in 9 months, and the strike > will be 90% of the underlying price in 3 months. Three months from > today, we observe the underlying price, we calculate the strike > accordingly, and from that point hence the option is a normal one. Is > this what you had in mind? > > Also, I'd like to post the answer to the mailing list as well, since > it might be useful to others. Should I remove your name and/or > address before doing so? > > Later, > Luigi > > > On Thu, Nov 15, 2012 at 11:29 AM, Theo Boafo <[hidden email]> wrote: >> Hi, >> >> I want to price an European Option on a forward contract, so I can create a >> forward contract using forward in Instrument ie forward.hpp/forward.cpp and >> then use black formula to price. >> >> What does forwardengine.hpp do as from snippet below, the forwardprocess is >> constructed using spot,dividendYield and risk free rate, but my forward >> process is driftless? >> >> Basically what I am getting at is I want to price an option on a commodity >> forward contract. >> >> boost::shared_ptr<GeneralizedBlackScholesProcess> fwdProcess( >> new GeneralizedBlackScholesProcess(spot, >> dividendYield, >> riskFreeRate, >> blackVolatility)); >> >> Also I dont see the use of blackformula in the unit test. >> >> There is a forwardoption in the unit test ie. >> >> struct ForwardOptionData { >> Option::Type type; >> Real moneyness; >> Real s; // spot >> Rate q; // dividend >> Rate r; // risk-free rate >> Time start; // time to reset >> Time t; // time to maturity >> Volatility v; // volatility >> Real result; // expected result >> Real tol; // tolerance >> }; >> >> >> which uses which is using s,q, and r to form forward price and then use >> blacksholes merton process to price option on forwards, its not >> using,forward.hpp/forward.cpp and black formula. >> >> Regards >> >> Theo ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |