Fwd: fdm 3/4 dimensional solver for long dated fx

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: fdm 3/4 dimensional solver for long dated fx

Theo Boafo
Hi Klaus/Luigi,

I am looking at long dated fx i.e. stochastic vol with stochastic interest rates
4 factor model, Heston stochastic vol with stochastic domestic and foreign shot rates  i.e 
ds/s = (rd-rf) dt + sqrt(v) dw1
dv = k(@(t)-v) dt + volvol sqrt(v) dw2
drd = (theta(t) –rd) dt + sigma(t) dw3
drf = (theta(t) –rf) dt + sigma(t) dw4
I have made some code changes to the following files in Quantlib
(a) hybridhestonhullwhiteprocess.cpp/.hpp
(b) fdmhestonhullwhiteop.hpp/.cpp
(c) fdmhestonhullwhitesolver.cpp/.hpp
(d) fdhestonhullwhiteengine.cpp/.hpp

I have created 2 new files hybridhestonhullwhitemodel.hpp/.cpp and have the following errors
(a) QuantLib::HybridFXHestonHullWhiteModel::arguments is ambiguous
(b) The following line below in my calling program LongDatedFX has error QuantLib::HybridFXHestonHullWhiteModel::calibrate is ambiguous,so something wrong with design of HybridFXHestonHullWhiteModel class
	boost::shared_ptr<HybridFXHestonHullWhiteProcess> hybridFXHestonHullWhiteProcess(
		 new HybridFXHestonHullWhiteProcess(hestonModel->process(),domesticHwProcess,foreignHwProcess,corrFXDomesticShortRate,
		 corrFXForeignShortRate,corrDomesticForeignShortRate));

	boost::shared_ptr<HybridFXHestonHullWhiteModel> hybridFXRatesmodel(new HybridFXHestonHullWhiteModel(hybridFXHestonHullWhiteProcess));        

    LevenbergMarquardt vm(1e-6, 1e-2, 1e-2);
    hybridFXRatesmodel->calibrate(options, vm,EndCriteria(400, 40, 1.0e-8, 1.0e-4, 1.0e-8));

Please find attached the files.
Regards
Theo




------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

fdhestonhullwhitevanillaengine.cpp (20K) Download Attachment
fdhestonhullwhitevanillaengine.hpp (5K) Download Attachment
hybridhestonhullwhitemodel.cpp (2K) Download Attachment
hybridhestonhullwhitemodel.hpp (2K) Download Attachment
fdmhestonhullwhitesolver.hpp (4K) Download Attachment
fdmhestonhullwhitesolver.cpp (5K) Download Attachment
fdmhestonhullwhiteop.cpp (14K) Download Attachment
fdmhestonhullwhiteop.hpp (5K) Download Attachment
hybridhestonhullwhiteprocess.hpp (6K) Download Attachment
hybridhestonhullwhiteprocess.cpp (19K) Download Attachment
LongDatedFX.cpp (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: fdm 3/4 dimensional solver for long dated fx

Luigi Ballabio
You're inheriting HybridFXHestonHullWhiteModel from HestonModel and HullWhite. Both define an arguments_ array that your class inherits, so the compiler can't decide which one you're referring to. The same holds for calibrate().

I don't think the whole multiple-inheritance thing is going to work, anyway. For instance, you can't just call the constructors of HestonModel and HullModel from the constructor of your class; they're going to write into the same positions in the arguments_ array, because each one thinks it owns it.  You're probably better off writing the class from scratch.

Luigi



On Wed, Nov 5, 2014 at 1:35 PM, Theo Boafo <[hidden email]> wrote:
Hi Klaus/Luigi,

I am looking at long dated fx i.e. stochastic vol with stochastic interest rates
4 factor model, Heston stochastic vol with stochastic domestic and foreign shot rates  i.e 
ds/s = (rd-rf) dt + sqrt(v) dw1
dv = k(@(t)-v) dt + volvol sqrt(v) dw2
drd = (theta(t) –rd) dt + sigma(t) dw3
drf = (theta(t) –rf) dt + sigma(t) dw4
I have made some code changes to the following files in Quantlib
(a) hybridhestonhullwhiteprocess.cpp/.hpp
(b) fdmhestonhullwhiteop.hpp/.cpp
(c) fdmhestonhullwhitesolver.cpp/.hpp
(d) fdhestonhullwhiteengine.cpp/.hpp

I have created 2 new files hybridhestonhullwhitemodel.hpp/.cpp and have the following errors
(a) QuantLib::HybridFXHestonHullWhiteModel::arguments is ambiguous
(b) The following line below in my calling program LongDatedFX has error QuantLib::HybridFXHestonHullWhiteModel::calibrate is ambiguous,so something wrong with design of HybridFXHestonHullWhiteModel class
	boost::shared_ptr<HybridFXHestonHullWhiteProcess> hybridFXHestonHullWhiteProcess(
		 new HybridFXHestonHullWhiteProcess(hestonModel->process(),domesticHwProcess,foreignHwProcess,corrFXDomesticShortRate,
		 corrFXForeignShortRate,corrDomesticForeignShortRate));

	boost::shared_ptr<HybridFXHestonHullWhiteModel> hybridFXRatesmodel(new HybridFXHestonHullWhiteModel(hybridFXHestonHullWhiteProcess));        

    LevenbergMarquardt vm(1e-6, 1e-2, 1e-2);
    hybridFXRatesmodel->calibrate(options, vm,EndCriteria(400, 40, 1.0e-8, 1.0e-4, 1.0e-8));

Please find attached the files.
Regards
Theo



------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users




--

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: fdm 3/4 dimensional solver for long dated fx

Theo Boafo
Hi Luigi,

Many thanks for getting back to me.  I would write the class from scratch.

Regards

Theo


-----Original Message-----
From: Luigi Ballabio <[hidden email]>
To: Theo Boafo <[hidden email]>
CC: QuantLib users <[hidden email]>
Sent: Tue, 18 Nov 2014 15:08
Subject: Re: [Quantlib-users] Fwd: fdm 3/4 dimensional solver for long dated fx

You're inheriting HybridFXHestonHullWhiteModel from HestonModel and HullWhite. Both define an arguments_ array that your class inherits, so the compiler can't decide which one you're referring to. The same holds for calibrate().

I don't think the whole multiple-inheritance thing is going to work, anyway. For instance, you can't just call the constructors of HestonModel and HullModel from the constructor of your class; they're going to write into the same positions in the arguments_ array, because each one thinks it owns it.  You're probably better off writing the class from scratch.

Luigi



On Wed, Nov 5, 2014 at 1:35 PM, Theo Boafo <[hidden email]> wrote:
Hi Klaus/Luigi,

I am looking at long dated fx i.e. stochastic vol with stochastic interest rates
4 factor model, Heston stochastic vol with stochastic domestic and foreign shot rates  i.e 
ds/s = (rd-rf) dt + sqrt(v) dw1
dv = k(@(t)-v) dt + volvol sqrt(v) dw2
drd = (theta(t) –rd) dt + sigma(t) dw3
drf = (theta(t) –rf) dt + sigma(t) dw4
I have made some code changes to the following files in Quantlib
(a) hybridhestonhullwhiteprocess.cpp/.hpp
(b) fdmhestonhullwhiteop.hpp/.cpp
(c) fdmhestonhullwhitesolver.cpp/.hpp
(d) fdhestonhullwhiteengine.cpp/.hpp

I have created 2 new files hybridhestonhullwhitemodel.hpp/.cpp and have the following errors
(a) QuantLib::HybridFXHestonHullWhiteModel::arguments is ambiguous
(b) The following line below in my calling program LongDatedFX has error QuantLib::HybridFXHestonHullWhiteModel::calibrate is ambiguous,so something wrong with design of HybridFXHestonHullWhiteModel class
	boost::shared_ptr<HybridFXHestonHullWhiteProcess> hybridFXHestonHullWhiteProcess(
		 new HybridFXHestonHullWhiteProcess(hestonModel->process(),domesticHwProcess,foreignHwProcess,corrFXDomesticShortRate,
		 corrFXForeignShortRate,corrDomesticForeignShortRate));

	boost::shared_ptr<HybridFXHestonHullWhiteModel> hybridFXRatesmodel(new HybridFXHestonHullWhiteModel(hybridFXHestonHullWhiteProcess));        

    LevenbergMarquardt vm(1e-6, 1e-2, 1e-2);
    hybridFXRatesmodel->calibrate(options, vm,EndCriteria(400, 40, 1.0e-8, 1.0e-4, 1.0e-8));

Please find attached the files.
Regards
Theo



------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users




--

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users