Add orats source for getOptionChain() #325
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?