|
From: Francois B. <ig...@gm...> - 2014-08-10 11:08:04
|
Hi, I think you have to use BespokeCalendar. See the discussion at http://quantlib.10058.n7.nabble.com/Calendar-with-custom-set-holidays-and-name-td53.html . You'll have to do the CSV input yourself. regards Francois Botha On 8 August 2014 15:59, user0112358132134 <use...@ya...> wrote: > Hi, > > As indicated in the title, I would like to modify the calendar class so as > to be able to read in a set of customized values from a csv file and > arrange > those to be the holidays. > > I'm not very familiar with C++ development. > > My initial idea was that I could use the other calendar classes as a > template of sorts, for instance I could copy the argentina.hpp file and > just > modify it according to my needs, for instance, readFromFile.hpp and > accordingly modify all the other references to argentina, is this getting > in > the right direction? > > I'm also thinking I can make a readFromFile.cpp and put some method like > this in there: > BespokeCalendar Calendar::TOKCal(string input_file_name, string > input_market) > { > /* Declare the variables to be used */ > BespokeCalendar result; > string filename = input_file_name; > string marekt = input_market; > > string csvLine > string csvMarket; > string csvDate; > > ifstream csvFile ( filename ); // declare file stream > if( csvFile.good() ) > { > while (getline (csvFile,csvLine) > { > stringstream ss(csvLine); > string csvMarket; > string csvDate; > > getline(ss, csvMarket, ','); > getline(ss, csvDate, ','); > > if (csvMarket == marekt) > { > result.addHoliday( csvDate ); > } > } > } > else > { > cout << "Unable to open file"; > } > > return result; > } > > Would such a thing work? > > I want to be able to call it like this: > > Calendar XXXXCal = FromFile("C:\\temp\\XXXXHoliday.csv","XXXX"); > > How can I test my results, I'm a bit confused about the documentation > regarding testing, do I create that main file in the solution of QuantLib > itself or somewhere else? > > Is there some way to work on this code where I dont have to build the > library every time I make a change as I'm now doing? > > Cheers, > > AB > > > > -- > View this message in context: > http://quantlib.10058.n7.nabble.com/Modifying-Calendar-Class-Customs-Dates-By-CSV-File-tp15722.html > Sent from the quantlib-dev mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > |