Hi-
I've been browsing through the object hierarchy for a bit now and noticed that QuantLib has a great date handling system which handles internationalization and Holiday exceptions, but it appears to me that something is missing. There does not appear to be a built-in provision to simply calculate the expiration dates of options. The majority of options traded in the United States are traded on Exchanges with set expiration dates and an American Style expiry. Lets say that I had a list of options. Supposed all of these options have the same strike for simplicity. Let us pretend that these are Exchange-style options, not OTC options. How would one rapidly know how much time there is until the expiration date of these options? I could write up a OO-proposal for this functionality, I supposed, but first wanted to check in to see if th is had been done yet? For instance: Obj 1: Oct 30 Calls misc details Obj 2: Oct 30 Puts misc details Obj 3: Nov 30 Puts misc details Obj 4: Nov 35 Calls misc details Today is 10/18/06. Days_To_Expiry = Obj1.DaysToExpiry Now this is passable to the calculation engine. Any thoughts? David Brown |
I have felt the same way about this issue.
this would be a really useful feature imo. Since the option expiration falls
on the 3rd Friday of each month it may be possible to determine this
day without any hardcoding. Does anyone know of some logic like this. I am eager to hear thoughts on this
request. From:
[hidden email] [mailto:[hidden email]]
On Behalf Of David Brown Hi- |
I and another fellow have written the code to figure out which day is valid.
The issue is of course that you also have to know the valid holidays for each year.
Then you need to be able to do this for other locales.
I would be happy to pass along the code, so the logic could be extracted.
Dave
-----Original Message-----
Hi- The information contained in and accompanying this communication is for your information only. Such information is strictly confidential and is intended solely for the use of the intended recipient (s) - recipient. If you are not the intended recipient (s) of this communication, please delete and destroy all copies immediately. This is not an offer or solicitation with respect to the purchase or sale of any security. The information is based upon information that TANSTAAFL Research & Trading, L.L.C believes to be reliable. TANSTAAFL Research & Trading, L.L.C does not accept responsibility to update any opinions or other information contained in this communication. |
Perhaps it would be nice to see this incorporated into the Actual Date Handling model. Perhaps more research is necessary to know the option expiry standards on different exchanges throughout the world, but I feel it would be well worth the effort in the end. QL needs to move towards rapid Portfolio Management of many objects and this would be a necessary step.
DB On 10/18/06, David Palmer <[hidden email]> wrote:
|
In reply to this post by Vangipuram, Satish
Hi all
> Since the option expiration falls on the 3rd Friday of each > month it may be possible to determine this day without any hardcoding. the function static Date nthWeekday(Size n, Weekday, Month m, Year y); is already available, and could be used as in e.g. nthWeekday(3, Friday, Octrober, 2006) to get the option expiry for this month. Is there more than this in your proposals? You might also want to look at static Date IMMdate(const std::string& IMMcode, const Date& referenceDate = Date()); for an example about how to go from "Z6" -> 20-Dec-2006 ciao -- Nando |
All that needs to be done is check for holidays. The CBOT has a different set of rules for their financial products than does the US equity single stock world. In addition there are some indices that expire at the open on Friday i.e. NDX whereby the Friday expiration and settlement is actually untradable. So when vauling the derivative, while you are getting Friday, you are getting Friday and 8:30 AM CST / 9:30 AM EST as opposed to 3:00 CST / 4:00 EST.
In the event that the Friday is a holiday the Thursday is used. This is for single stock options. Dave ________________________________ From: [hidden email] on behalf of Ferdinando Ametrano Sent: Thu 10/19/2006 4:57 AM To: Vangipuram, Satish Cc: [hidden email] Subject: Re: [Quantlib-users] Simple Expiration Date Handling Hi all > Since the option expiration falls on the 3rd Friday of each > month it may be possible to determine this day without any hardcoding. the function static Date nthWeekday(Size n, Weekday, Month m, Year y); is already available, and could be used as in e.g. nthWeekday(3, Friday, Octrober, 2006) to get the option expiry for this month. Is there more than this in your proposals? You might also want to look at static Date IMMdate(const std::string& IMMcode, const Date& referenceDate = Date()); for an example about how to go from "Z6" -> 20-Dec-2006 ciao -- Nando ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users The information contained in and accompanying this communication is for your information only. Such information is strictly confidential and is intended solely for the use of the intended recipient (s) - recipient. If you are not the intended recipient (s) of this communication, please delete and destroy all copies immediately. This is not an offer or solicitation with respect to the purchase or sale of any security. The information is based upon information that TANSTAAFL Research & Trading, L.L.C believes to be reliable. TANSTAAFL Research & Trading, L.L.C does not accept responsibility to update any opinions or other information contained in this communication. |
The rule isn't the third friday. The rule is the third friday after the third thursday. its a subtle but very important difference. Therefore, there is a 1/7 chance that it could be the fourth friday. Get what I'm saying?
DB On 10/19/06, David Palmer <[hidden email]> wrote: All that needs to be done is check for holidays. The CBOT has a different set of rules for their financial products than does the US equity single stock world. In addition there are some indices that expire at the open on Friday i.e. NDX whereby the Friday expiration and settlement is actually untradable. So when vauling the derivative, while you are getting Friday, you are getting Friday and 8:30 AM CST / 9:30 AM EST as opposed to 3:00 CST / 4:00 EST. |
OK. So if this already object already exists, all we need to do, as D. Palmer said, is to somehow create a new object which inherrits these properties and creates a few new ones using:
1) Logic about third Friday after the third Thursday. This is cake and a simple conditional-if or case statement will work fine. 2) Incorporate holiday checking and handling into step one above and determine when the rearranged expiration time is set. Does anyone know the rule for this? 3) As D. Palmer was saying, depending on the object being evaluated, change the expiration times appropriately. Finally, we must recall that this typically only coordinates to American-Style exchange traded options on certain exchanges in the USA. What is to be done for other countries. Assuming we could get complete information on when options expire in different parts of the world, could this then be handled inside of the localization classes? I see this as the only long-term way to handle multiple currencies and options across the world reliably and quickly. Please chime in here with any thoughts. DB p.s. Two years ago I wrote about working with a FpML/XML parser. A large list of exchange traded options could be handled smoothly if these things were implemented properly. On 10/20/06, David Brown <[hidden email]> wrote: The rule isn't the third friday. The rule is the third friday after the third thursday. its a subtle but very important difference. Therefore, there is a 1/7 chance that it could be the fourth friday. Get what I'm saying? |
Hi all
> 1) Logic about third Friday after the third Thursday. This is cake and a > simple conditional-if or case statement will work fine. > 2) Incorporate holiday checking and handling into step one above and > determine when the rearranged expiration time is set. Does anyone know the > rule for this? What happen if the Friday after the third Thursday is an holiday? If the expiry day just rolls up to the next business day, what about: static Date fridayAfterThirdThursday(Calendar c, Month m, Year y) { Date thirdThursday = nthWeekday(3, Thursday, m, y); Date result = nextWeekday(thirdThursday, Friday); result = c.adjust(result, Following); } if this is what you are looking for I can add it to QuantLib. > p.s. Two years ago I wrote about working with a FpML/XML parser. A large > list of exchange traded options could be handled smoothly if these things > were implemented properly. We are very interested about FpMLsupport/compliance. Please look the mailing list archives for related threads. ciao -- Nando |
On Fri, 2006-10-20 at 18:12 +0200, Ferdinando Ametrano wrote:
> If the expiry day just rolls up to the next business day, what about: > static Date fridayAfterThirdThursday(Calendar c, Month m, Year y) { > Date thirdThursday = nthWeekday(3, Thursday, m, y); > Date result = nextWeekday(thirdThursday, Friday); > result = c.adjust(result, Following); > } > > if this is what you are looking for I can add it to QuantLib. Are you going to add a static method to Date for each country convention? You better make it a separate function or class... Luigi ---------------------------------------- Never mistake motion for action. -- Ernest Hemingway |
In reply to this post by David Brown-27
http://www.theocc.com/publications/xcal/xcal.jsp
Good starting place to understand expirations of various OCC cleared products. The actual expiration for US listed options is the third Friday, regardless of whether there is a third Thursday. The date range is 15 to 21 for any given month. "The Expiration day for equity options is the Saturday following the third Friday of the month. Therefore, the third Friday of the month is the last trading day for all expiring equity options" The above is quoted from the OCC site. While we all know there is no trading on Saturday, there is a reason for this language. When options were first listed and before electronic trading of them, all out-trades were resolved the next morning, therefore the validity of the contract needed to be in force for the resolution of the out-trade. It is a legacy rule since all trades here in the US now are expected to settle prior to the close of business that Friday. Dave -----Original Message----- From: Luigi Ballabio [mailto:[hidden email]] Sent: Friday, October 20, 2006 12:19 PM To: Ferdinando Ametrano Cc: David Brown; [hidden email]; Vangipuram, Satish; David Palmer Subject: Re: [Quantlib-users] Simple Expiration Date Handling On Fri, 2006-10-20 at 18:12 +0200, Ferdinando Ametrano wrote: > If the expiry day just rolls up to the next business day, what about: > static Date fridayAfterThirdThursday(Calendar c, Month m, Year y) { > Date thirdThursday = nthWeekday(3, Thursday, m, y); > Date result = nextWeekday(thirdThursday, Friday); > result = c.adjust(result, Following); > } > > if this is what you are looking for I can add it to QuantLib. Are you going to add a static method to Date for each country convention? You better make it a separate function or class... Luigi ---------------------------------------- Never mistake motion for action. -- Ernest Hemingway The information contained in and accompanying this communication is for your information only. Such information is strictly confidential and is intended solely for the use of the intended recipient (s) - recipient. If you are not the intended recipient (s) of this communication, please delete and destroy all copies immediately. This is not an offer or solicitation with respect to the purchase or sale of any security. The information is based upon information that TANSTAAFL Research & Trading, L.L.C believes to be reliable. TANSTAAFL Research & Trading, L.L.C does not accept responsibility to update any opinions or other information contained in this communication. |
Free forum by Nabble | Edit this page |