Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add orats source for getOptionChain() #325

Merged

Conversation

SteveBronder
Copy link
Contributor

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 use src="orats" to get access to the orats options data

I'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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Their API returns a lot of neat things. I tried making call and put as close as possible to the yahoo return, and then added a call/put_extra as well as extra data frames that are returned containing the extra information like greeks etc. How would you feel about a format argument with values like "standard" for the standard format and "raw" for returning back what their API returns?

 Changes to be committed:
	modified:   R/getOptionChain.R
	modified:   man/getOptionChain.Rd
	new file:   man/getOptionChain.orats.Rd

Adds orats as a backend for getOptionChain(). The orats API a lot of
 useful features including greek calculations for each option.
 Users with an API key provided by orats can now use src "orats"
 standard bid, ask, oi, volume information on a stock as well as
 the additional information provided by their API at the link found
 in the getOptionChain.orats documentation.
@joshuaulrich joshuaulrich merged commit dec3991 into joshuaulrich:master Jun 13, 2021
joshuaulrich added a commit that referenced this pull request Jun 13, 2021
@joshuaulrich
Copy link
Owner

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...

@SteveBronder
Copy link
Contributor Author

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

@joshuaulrich
Copy link
Owner

Unit tests are always welcome!

@joshuaulrich joshuaulrich added this to the Release 0.4.20 milestone Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants