Closed ConradMellinNAB closed 10 years ago
Dear Conrad,
Thanks for reporting this. Could you confirm if the number of days should be a number of calendar days, weekdays or working days?
e.g. calendar days = number of days regardless of holidays or weekend weekdays = number of weekdays (skip weekends) working days = number of days that should not be holidays.
I guess that, for your purpose, a method using weekdays should be ok:
getNextIMMDate(startDate, 3)
would mean: startDate + 3 weekdays to be used as the starting point.
Fri 12-Sept 2014 + 3 weekdays -> Wed 17-Sept 2014 to be used in the calc and therefore, the next IMM should be 17 Dec 2014.
Would that work?
Benoit
Hi Benoit,
Yes, I implemented it with number of weekdays, so that would work perfect for me. I did it like this:
LinkedHashMap<String, LocalDate> getIMMDates() {
dateCalculator.setStartDate(tradeDate);
LocalDate startDate = dateCalculator.moveByBusinessDays(2).getCurrentBusinessDate();
LocalDate fwdDate = dateCalculator.moveByTenor(new Tenor(27, TenorCode.MONTH), 0).getCurrentBusinessDate();
List<LocalDate> immDates = immDateCalculator.getIMMDates(startDate, fwdDate);
LinkedHashMap<String, LocalDate> map = new LinkedHashMap<String, LocalDate>();
int ctr = 1;
for (LocalDate immDate : immDates) {
String immKey = new String("IMM");
immKey += ctr;
if (ctr < 9) // Only want IMM1 thru to IMM8 being published
{
map.put(immKey, immDate);
}
++ctr;
}
return map;
}
Regards,
Conrad
From: Benoit Xhenseval notifications@github.com Sent: 17 August 2014 19:48 To: Appendium/objectlabkit Cc: Conrad Mellin Subject: Re: [objectlabkit] Be able to specify how many days before the next IMM date it should be rolled off (#3)
Dear Conrad,
Thanks for reporting this. Could you confirm if the number of days should be a number of calendar days, weekdays or working days?
e.g. calendar days = number of days regardless of holidays or weekend weekdays = number of weekdays (skip weekends) working days = number of days that should not be holidays.
I guess that, for your purpose, a method using weekdays should be ok:
getNextIMMDate(startDate, 3)
would mean: startDate + 3 weekdays to be used as the starting point.
Fri 12-Sept 2014 + 3 weekdays -> Wed 17-Sept 2014 to be used in the calc and therefore, the next IMM should be 17 Dec 2014.
Would that work?
Benoit
Reply to this email directly or view it on GitHubhttps://github.com/Appendium/objectlabkit/issues/3#issuecomment-52417759.
The information contained in this email and any attached files is confidential and intended solely for the addressee(s). The email may be legally privileged or prohibited from disclosure and unauthorised use. If you are not the named addressee you may not use, copy, or disclose this information to any other person. If you received this message in error please notify the sender immediately and delete it from your system.
Any opinion or views contained in this email message are those of the sender, and do not represent those of the Company in any way and reliance should not be placed upon its contents. Unless otherwise stated, this email message is not intended to be contractually binding. Where an Agreement exists between our respective companies and there is conflict between the contents of this email message and the Agreement then the terms of that Agreement shall prevail.
Excelian Limited / 44 Featherstone Street London / EC1Y 8RN / United Kingdom
T +44 (0)207 336 9595 / www.excelian.com
Thanks Conrad,
If I take your example of tradeDate being 12 Sept 2014, you would need to use 3 BusinessDays in order for the first IMM to be 17-Dec 2014 (i.e. the startDate should be Wed 17/9).
So for your roll-over, does it matter if you have any BankHoliday between your business Date and the rollOver day? i.e. you sure it is weekDays only?
Thanks
Benoit
Dear Conrad,
I have reviewed your code and I think that you have the right approach. The IMM Calculator really does not need to know about another date calculator (Working Week, holidays etc which could be involved in the calculation of the next "roll over date").
As such I do not think that the IMM code should change.
I have however, made a change which could slightly simplify your life, i.e. to calculate the next N IMM Dates, that way you do not have to calculate an artificial end date.
To that effect, I am adding the method:
/**
* Returns a list of N IMM dates from a given date, it will exclude the start
* date if it is an IMM date
* (same as as calling getIMMDates(start,end,IMMPeriod.QUARTERLY)).
*
* @param start
* start of the interval, excluded
* @param numberOfDates
* number of IMM dates to return.
* @return list of IMM dates
*/
List<E> getNextIMMDates(final E start, final int numberOfDates);
Here is a sample of code comparing your code and the new one. Do you have any feedback?
https://gist.github.com/benoitx/91438fdcbe26ee278081
Thank you
Benoit
Hello Benoit,
thanks very much for implementing the function. And, yes, I agree it will be easier to use it the way you have implemented it.
What is your release schedule like, and how soon would I be able to use the library with this version of the function?
Kind regards,
Conrad
From: Benoit Xhenseval notifications@github.com Sent: 19 August 2014 07:18 To: Appendium/objectlabkit Cc: Conrad Mellin Subject: Re: [objectlabkit] Be able to specify how many days before the next IMM date it should be rolled off (#3)
Dear Conrad,
I have reviewed your code and I think that you have the right approach. The IMM Calculator really does not need to know about another date calculator (Working Week, holidays etc which could be involved in the calculation of the next "roll over date").
As such I do not think that the IMM code should change.
I have however, made a change which could slightly simplify your life, i.e. to calculate the next N IMM Dates, that way you do not have to calculate an artificial end date.
To that effect, I am adding the method:
/**
* Returns a list of N IMM dates from a given date, it will exclude the start
* date if it is an IMM date
* (same as as calling getIMMDates(start,end,IMMPeriod.QUARTERLY)).
*
* @param start
* start of the interval, excluded
* @param numberOfDates
* number of IMM dates to return.
* @return list of IMM dates
*/
List<E> getNextIMMDates(final E start, final int numberOfDates);
Here is a sample of code comparing your code and the new one. Do you have any feedback?
https://gist.github.com/benoitx/91438fdcbe26ee278081
Thank you
Benoit
Reply to this email directly or view it on GitHubhttps://github.com/Appendium/objectlabkit/issues/3#issuecomment-52556691.
The information contained in this email and any attached files is confidential and intended solely for the addressee(s). The email may be legally privileged or prohibited from disclosure and unauthorised use. If you are not the named addressee you may not use, copy, or disclose this information to any other person. If you received this message in error please notify the sender immediately and delete it from your system.
Any opinion or views contained in this email message are those of the sender, and do not represent those of the Company in any way and reliance should not be placed upon its contents. Unless otherwise stated, this email message is not intended to be contractually binding. Where an Agreement exists between our respective companies and there is conflict between the contents of this email message and the Agreement then the terms of that Agreement shall prevail.
Excelian Limited / 44 Featherstone Street London / EC1Y 8RN / United Kingdom
T +44 (0)207 336 9595 / www.excelian.com
Hi
I need to finish off the currency date calculator but I would hope to wrap this up in a couple of weeks max.
In the meantime a maven snapshot is available right now (and with every travis-ci build) on the Sonatype OSS repository.
Version 1.4.0-snapshot
Enjoy
Benoit
Important Notice This communication contains information that is considered confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender and delete the original
On 18 Aug 2014, at 23:32, ConradMellin notifications@github.com wrote:
Hello Benoit,
thanks very much for implementing the function. And, yes, I agree it will be easier to use it the way you have implemented it.
What is your release schedule like, and how soon would I be able to use the library with this version of the function?
Kind regards,
Conrad
From: Benoit Xhenseval notifications@github.com Sent: 19 August 2014 07:18 To: Appendium/objectlabkit Cc: Conrad Mellin Subject: Re: [objectlabkit] Be able to specify how many days before the next IMM date it should be rolled off (#3)
Dear Conrad,
I have reviewed your code and I think that you have the right approach. The IMM Calculator really does not need to know about another date calculator (Working Week, holidays etc which could be involved in the calculation of the next "roll over date").
As such I do not think that the IMM code should change.
I have however, made a change which could slightly simplify your life, i.e. to calculate the next N IMM Dates, that way you do not have to calculate an artificial end date.
To that effect, I am adding the method:
/**
Here is a sample of code comparing your code and the new one. Do you have any feedback?
https://gist.github.com/benoitx/91438fdcbe26ee278081
Thank you
Benoit
Reply to this email directly or view it on GitHub< https://github.com/Appendium/objectlabkit/issues/3#issuecomment-52556691>.
The information contained in this email and any attached files is confidential and intended solely for the addressee(s). The email may be legally privileged or prohibited from disclosure and unauthorised use. If you are not the named addressee you may not use, copy, or disclose this information to any other person. If you received this message in error please notify the sender immediately and delete it from your system.
Any opinion or views contained in this email message are those of the sender, and do not represent those of the Company in any way and reliance should not be placed upon its contents. Unless otherwise stated, this email message is not intended to be contractually binding. Where an Agreement exists between our respective companies and there is conflict between the contents of this email message and the Agreement then the terms of that Agreement shall prevail.
Excelian Limited / 44 Featherstone Street London / EC1Y 8RN / United Kingdom
T +44 (0)207 336 9595 / www.excelian.com
— Reply to this email directly or view it on GitHub https://github.com/Appendium/objectlabkit/issues/3#issuecomment-52564955.
Eg, the next IMM date is on Wed 17-Sep-2014, and at the close of business on Fri 12-Sep-2014 I want the next IMM date to become the 17-Dec-2014 IMM date.