Closed SteveBronder closed 3 years ago
Thanks for the contribution! Sorry it took so long to merge... Note that I moved the new source to it's own file. I know getSymbols has everything in one file, but I don't like that...
Oh awesome! Yes that's totally fine, I'll take another look at this during the week and add some unit tests as well if you'd like. They have a demo api we should be able to use for the unit tests
Unit tests are always welcome!
Adds orats as a backend for
getOptionChain()
. The orats API has a lot of useful features including greek calculations for each option. Users with an API key provided by orats can now usesrc="orats"
to get access to the orats options dataI'm opening this now but this still needs tests. But before I write those I wanted to discuss the return of the function as some things differ for the orats source.
First, the orats API does returns Near End of Day options data, about 15 minutes before close. So data from yahoo and orats will most likely differ. Discussing this with the orats folks it is because options spreads can get kind of wacky very close to the close so it's more representative of the day to get them a little before close.
They don't provide a last sold price (unless I'm reading the column definitions from here wrong and it's actually there). So this column does not exist. Is that alright? I could also just make a column of NA values here and make a note to users about that in the docs.
On weekends it seems like they actually still return that fridays options that expired as the most recent. Honestly I'm not sure about the intricacies of options execution so it's unclear to me whether we should return what yahoo returns for an API call on a weekend (the options that expire next week) or the friday options orats returns.
Because their API allows for multiple tickers the data in each data.frame of the list I return has a column
Ticker
. imo I like this over a list of list of list approach for multiple dates/tickers but I'm open to whatever here.Their API returns a lot of neat things. I tried making
call
andput
as close as possible to theyahoo
return, and then added acall/put_extra
as well asextra
data frames that are returned containing the extra information like greeks etc. How would you feel about aformat
argument with values like "standard" for the standard format and "raw" for returning back what their API returns?