Hi all.
I am having a rough time with the QuantLib::TimeSeries class. I pasted my snippet code below. I don't get (at all!) the result I expect. (See code the console output at the bottom of the code). Can anyone provide a bit of help on this, please? #include<vector> #include<iostream> #include<ql\quantlib.hpp> int main() { std::vector<QuantLib::Date> dates; std::vector<double> quotes; dates.push_back(QuantLib::Date(12, QuantLib::Nov, 2012)); dates.push_back(QuantLib::Date(13, QuantLib::Nov, 2012)); dates.push_back(QuantLib::Date(14, QuantLib::Nov, 2012)); quotes.push_back(40.05); quotes.push_back(40.84); quotes.push_back(41.03); QuantLib::TimeSeries<double> series(dates.begin(), dates.begin(), quotes.end()); // Is my time series empty? std::cout << "Is
series empty?\t" << series.empty()
<< std::endl;
std::cout << "Value
on November 14th, 2012?\t" <<
series[QuantLib::Date(14, QuantLib::Nov, 2012)] << std::endl; return 0; } /* Console Output: Is series empty? 1 Value on November 14th 2012? 3.40282e +038 */ ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Most likely you wanted quotes.begin() I should think. Alexander On Feb 10, 2013 1:34 PM, "Edouard Tallent" <[hidden email]> wrote:
Hi all. ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |