Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Option-Expiry-using-Date-and-time-intraday-decay-fractional-days-tp140p141.html
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