|
From: Brian S. <bri...@gm...> - 2020-09-22 18:48:35
|
Hi, It will really be very helpful if there is some way to achieve this using a variable string - std::string getIndex = "Euribor1M" Basically, for my case, the Currency and period are variable. So I want to be able to create index based on the dynamically supplied values. Another way to do the same is - boost::shared_ptr<IborIndex> MyIndex(new USDLibor(Period(3, Months), forecastingTermStructure)); But again, I require to chose "USDLibor" dynamically. Means, If currency is USD then use -> boost::shared_ptr<IborIndex> MyIndex(new USDLibor(Period(3, Months), forecastingTermStructure)); If currency is EUR then use -> boost::shared_ptr<IborIndex> MyIndex(new EURLibor(Period(3, Months), forecastingTermStructure)); etc. I have long list of currencies, so any pointer to achieve this flexibility will be very helpful. Thanks for your time. On Sat, 19 Sep 2020 at 23:01, Brian Smith <bri...@gm...> wrote: > > Hi, > > I understand that one way to create an index in QuantLib is, > > ext::shared_ptr<IborIndex> myIndex(new Euribor1M(termStructure)); > > However in my case the information like Euribor1M is variable and > stored in another variable like, > > std::string getIndex = "Euribor1M"; > > I am looking for some way to pass the variable getIndex, instead > Euribor1M directly, to create appropriate index based on my dynamic > situation. > > Is there any possible way to achieve this? |