[R] Interpret List Label as Date from Quantmod getOptionChain

Sparks, John jspark4 at uic.edu
Mon Mar 5 04:13:47 CET 2018


Hi Dirk,


Thanks for your note.


I understand that expiry dates are the dates that the option expires, so I don't think that I am confused about that (although the upper limits of one's confusion is difficult to accurately estimate).


My lack of clarity come from treating those "dates"  as actual dates as opposed to strings, which one could reasonably interpret them to be from their appearance, yet the str() lists them in date order, not alphabetical order.


So if I execute


library(quantmod)

#in fairness, I did not include this last time and my example was therefore not reproducible.  Apologies to Bert and everyone else #for not following the posting guidelines.


aapl_total<-getOptionChain("AAPL", NULL)


How could I then get the subset of the entire list which only has expiry dates in 2019, or more specifically, in Mar or Apr or May of 2019?


Guidance (that is not too burdensome) would be appreciated.


--JJS




________________________________
From: Dirk Eddelbuettel <dirk.eddelbuettel at gmail.com> on behalf of Dirk Eddelbuettel <edd at debian.org>
Sent: Sunday, March 4, 2018 8:57 PM
To: Sparks, John
Cc: Bert Gunter; r-help at r-project.org
Subject: Re: [R] Interpret List Label as Date from Quantmod getOptionChain


On 5 March 2018 at 02:46, Sparks, John wrote:
| I agree that they look like dates, I don't know how to determine if they are actually dates.

You know options but you are confused about maturity dates, i.e. expiry?

In information in that list (ie along the date dimension) is the expiry; at
each date you have another list for both puts and calls, and inside each of
those a grid given by the active strikes (ie where bids/asks/trades happen).

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Dirk Eddelbuettel<http://dirk.eddelbuettel.com/>
dirk.eddelbuettel.com
Welcome. I contribute to several open source efforts, mostly Debian and R. Besides looking after a number of Debian packages, I ...




	[[alternative HTML version deleted]]



More information about the R-help mailing list