Option Expiry using Date and time (intraday decay/fractional days)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Option Expiry using Date and time (intraday decay/fractional days)

Shailesh Parmar
I am trying to calculate Implied Volatility for European options using
fractional days. Currently Expiry date only takes date. Is it possible
to modify the code so that I can take into account time of day as well
in evaluating. I would like some guidance as to how I should go about
implementing this.

Thanks in advance,

Shailesh Parmar

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Option Expiry using Date and time (intraday decay/fractional days)

Luigi Ballabio
Hi,
    it's probably not that easy.  You might try adding a time part to
the Date class (which is delicate work, since you'll have to make sure
that the whole date algebra still works correctly).  At that point,
modifying DayCounter::yearFraction so that it takes the added time
part into account should cause all term structures to work correctly
and your calculation to work.  Assuming that there are no problems
down the road that I'm not foreseeing, of course.

If you want to patch the current option quickly, you might add a time
part to its constructor, copy it to its arguments class, and patch the
analytic engine so that it takes it into account. You'll have to
manage time conversions yourself to do that; for instance, you'll
replace:

    DiscountFactor riskFreeDiscount =
        process_->riskFreeRate()->discount(arguments_.exercise->lastDate());

with:

    Time t = process_->riskFreeRate()->dayCounter().yearFraction(
            process_->riskFreeRate()->referenceDate(),
            arguments_.exercise->lastDate());
    DiscountFactor riskFreeDiscount =
        process_->riskFreeRate()->discount(t + fractional_time_in_years);

where fractional_time_in_years is the fractional day, converted to a
fraction of year to be consistent with t.  This would do the job
quickly for you, but I don't think I'd put it in the library.

Later,
    Luigi


On Wed, Feb 29, 2012 at 11:46 PM, Shailesh Parmar
<[hidden email]> wrote:

> I am trying to calculate Implied Volatility for European options using
> fractional days. Currently Expiry date only takes date. Is it possible
> to modify the code so that I can take into account time of day as well
> in evaluating. I would like some guidance as to how I should go about
> implementing this.
>
> Thanks in advance,
>
> Shailesh Parmar
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Option Expiry using Date and time (intraday decay/fractional days)

Simon Ibbotson-2
In reply to this post by Shailesh Parmar
As an information point, discounting on a part-day basis makes little sense as you simply cannot hedge it (the market for intra-day depos is tiny). However, calculating variance (and vols) on a part-day basis including expiration times is increasingly important.

Simon


----- Original Message -----
From: Luigi Ballabio <[hidden email]>
To: Shailesh Parmar <[hidden email]>
Cc: [hidden email] <[hidden email]>
Sent: Thu Mar 01 09:19:17 2012
Subject: Re: [Quantlib-users] Option Expiry using Date and time (intraday decay/fractional days)

Hi,
    it's probably not that easy.  You might try adding a time part to
the Date class (which is delicate work, since you'll have to make sure
that the whole date algebra still works correctly).  At that point,
modifying DayCounter::yearFraction so that it takes the added time
part into account should cause all term structures to work correctly
and your calculation to work.  Assuming that there are no problems
down the road that I'm not foreseeing, of course.

If you want to patch the current option quickly, you might add a time
part to its constructor, copy it to its arguments class, and patch the
analytic engine so that it takes it into account. You'll have to
manage time conversions yourself to do that; for instance, you'll
replace:

    DiscountFactor riskFreeDiscount =
        process_->riskFreeRate()->discount(arguments_.exercise->lastDate());

with:

    Time t = process_->riskFreeRate()->dayCounter().yearFraction(
            process_->riskFreeRate()->referenceDate(),
            arguments_.exercise->lastDate());
    DiscountFactor riskFreeDiscount =
        process_->riskFreeRate()->discount(t + fractional_time_in_years);

where fractional_time_in_years is the fractional day, converted to a
fraction of year to be consistent with t.  This would do the job
quickly for you, but I don't think I'd put it in the library.

Later,
    Luigi


On Wed, Feb 29, 2012 at 11:46 PM, Shailesh Parmar
<[hidden email]> wrote:

> I am trying to calculate Implied Volatility for European options using
> fractional days. Currently Expiry date only takes date. Is it possible
> to modify the code so that I can take into account time of day as well
> in evaluating. I would like some guidance as to how I should go about
> implementing this.
>
> Thanks in advance,
>
> Shailesh Parmar
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



This communication and any attachments contains information which is confidential and may be subject to legal privilege. It is for intended recipients only. If you are not the intended recipient you must not copy, distribute, publish, rely on or otherwise use it without our consent. Some of our communications may contain confidential information which it could be a criminal offence for you to disclose or use without authority. If you have received this email in error please notify [hidden email] immediately and delete the email from your computer.

The FSA reserves the right to monitor all email communications for compliance with legal, regulatory and professional standards.
This email is not intended to nor should it be taken to create any legal relations or contractual relationships. This email has originated from

The Financial Services Authority (FSA)
25 The North Colonnade,
Canary Wharf,
London
E14 5HS
United Kingdom

Registered as a Limited Company in England and Wales No.1920623.
Registered Office as above

Switchboard: 020 7066 1000
Web Site: http://www.fsa.gov.uk
*****************************************************************

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Option Expiry using Date and time (intraday decay/fractional days)

Slava Mazur-2
In reply to this post by Luigi Ballabio
Greetings,

I'd recommend changing the underlying type from BigInteger to something more relevant to time arithmetic or better yet providing the underlying type as a template parameter.
This way the new date-time class would serve a simple wrapper around other existing time arithmetic solutions like time_t, Boost date time, etc.
I realize however, that given the current state of this project such a suggestion has a slim chance to succeed, so consider it just an idea.

Slava Mazur

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Thursday, March 01, 2012 4:19 AM
To: Shailesh Parmar
Cc: [hidden email]
Subject: Re: [Quantlib-users] Option Expiry using Date and time (intraday decay/fractional days)

Hi,
    it's probably not that easy.  You might try adding a time part to the Date class (which is delicate work, since you'll have to make sure that the whole date algebra still works correctly).  At that point, modifying DayCounter::yearFraction so that it takes the added time part into account should cause all term structures to work correctly and your calculation to work.  Assuming that there are no problems down the road that I'm not foreseeing, of course.

If you want to patch the current option quickly, you might add a time part to its constructor, copy it to its arguments class, and patch the analytic engine so that it takes it into account. You'll have to manage time conversions yourself to do that; for instance, you'll
replace:

    DiscountFactor riskFreeDiscount =
        process_->riskFreeRate()->discount(arguments_.exercise->lastDate());

with:

    Time t = process_->riskFreeRate()->dayCounter().yearFraction(
            process_->riskFreeRate()->referenceDate(),
            arguments_.exercise->lastDate());
    DiscountFactor riskFreeDiscount =
        process_->riskFreeRate()->discount(t + fractional_time_in_years);

where fractional_time_in_years is the fractional day, converted to a fraction of year to be consistent with t.  This would do the job quickly for you, but I don't think I'd put it in the library.

Later,
    Luigi


On Wed, Feb 29, 2012 at 11:46 PM, Shailesh Parmar <[hidden email]> wrote:

> I am trying to calculate Implied Volatility for European options using
> fractional days. Currently Expiry date only takes date. Is it possible
> to modify the code so that I can take into account time of day as well
> in evaluating. I would like some guidance as to how I should go about
> implementing this.
>
> Thanks in advance,
>
> Shailesh Parmar
>
> ----------------------------------------------------------------------
> -------- Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing also
> focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users




------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Option Expiry using Date and time (intraday decay/fractional days)

Luigi Ballabio
We'll sure consider the template when we start working on a 2.0
version---which, given the current state of the project, might take a
bit...

In the meantime, anyway, anything goes as long as the Date interface
stays the same.  Replacing BigInteger can be done, since it's in the
private part of the class.  I would be a bit concerned with going with
a float, since at least the date part of the algebra should be exact.
But as long as it works...

Luigi

On Thu, Mar 1, 2012 at 9:30 PM, Slava Mazur <[hidden email]> wrote:

> I'd recommend changing the underlying type from BigInteger to something more relevant to time arithmetic or better yet providing the underlying type as a template parameter.
> This way the new date-time class would serve a simple wrapper around other existing time arithmetic solutions like time_t, Boost date time, etc.
> I realize however, that given the current state of this project such a suggestion has a slim chance to succeed, so consider it just an idea.
>
> Slava Mazur
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Thursday, March 01, 2012 4:19 AM
> To: Shailesh Parmar
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] Option Expiry using Date and time (intraday decay/fractional days)
>
> Hi,
>    it's probably not that easy.  You might try adding a time part to the Date class (which is delicate work, since you'll have to make sure that the whole date algebra still works correctly).  At that point, modifying DayCounter::yearFraction so that it takes the added time part into account should cause all term structures to work correctly and your calculation to work.  Assuming that there are no problems down the road that I'm not foreseeing, of course.
>
> If you want to patch the current option quickly, you might add a time part to its constructor, copy it to its arguments class, and patch the analytic engine so that it takes it into account. You'll have to manage time conversions yourself to do that; for instance, you'll
> replace:
>
>    DiscountFactor riskFreeDiscount =
>        process_->riskFreeRate()->discount(arguments_.exercise->lastDate());
>
> with:
>
>    Time t = process_->riskFreeRate()->dayCounter().yearFraction(
>            process_->riskFreeRate()->referenceDate(),
>            arguments_.exercise->lastDate());
>    DiscountFactor riskFreeDiscount =
>        process_->riskFreeRate()->discount(t + fractional_time_in_years);
>
> where fractional_time_in_years is the fractional day, converted to a fraction of year to be consistent with t.  This would do the job quickly for you, but I don't think I'd put it in the library.
>
> Later,
>    Luigi
>
>
> On Wed, Feb 29, 2012 at 11:46 PM, Shailesh Parmar <[hidden email]> wrote:
>> I am trying to calculate Implied Volatility for European options using
>> fractional days. Currently Expiry date only takes date. Is it possible
>> to modify the code so that I can take into account time of day as well
>> in evaluating. I would like some guidance as to how I should go about
>> implementing this.
>>
>> Thanks in advance,
>>
>> Shailesh Parmar
>>
>> ----------------------------------------------------------------------
>> -------- Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing also
>> focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users