joshuaulrich / joshuaulrich/quantmod

[R-Forge #624] options.expiry does not recognize days where market is closed

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
R
Stars
906
Forks
233
PR merge metrics
No merged PRs in 30d

Description

Submitted by: Nicolas Chapados
Assigned to: Nobody
[R-Forge link](http://r-forge.r-project.org/tracker/index.php?func=detail&aid=624&group_id=125&atid=544)

The options.expiry function does not properly give expiration dates when the market happens to be closed on the 3rd Friday of a month. Consider::

> getSymbols('QQQQ', src='yahoo')
> QQQQ[options.expiry(QQQQ), ]
> QQQQ.Open QQQQ.High QQQQ.Low QQQQ.Close QQQQ.Volume QQQQ.Adjusted
> [snip]
> 2008-01-18 45.64 46.14 44.98 45.35 273063300 45.06
> 2008-02-15 43.73 43.98 43.45 43.82 100053300 43.54
> 2008-04-18 46.47 46.93 46.22 46.71 133022500 46.44
> 2008-05-16 50.07 50.11 49.45 50.01 146563200 49.73
> 2008-06-20 48.33 48.35 47.21 47.42 197434200 47.18
> [snip]

Note that the expiration for March 2008 is missing: on that year, the third Friday of the month happened to fall on Good Friday, and the US market was closed. Hence, OpEx fell on the Thursday for that month, and the options.expiry() function SHOULD HAVE indicated 2008-03-20 as the expiration date.

Best regards,
- Nicolas Chapados

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the R implementation and tests for options.expiry, then reproduce the QQQQ example around March 2008. The fix is done when an expiration falling on a market holiday is recognized on the preceding trading day, including 2008-03-20 for Good Friday.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
fintech-quant
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.