Comments (6)
Version 2.0.0 has been released with new options methods and features. Thanks so much for your help!
from algotrader.
Thanks for incorporating this! I would've tried to contribute the code myself, but frankly, I'm learning Node JS from scratch, which makes my code messy and poorly structured. But I'm very happy I could help in some way, and I'm excited to these features have been included now.
from algotrader.
Holy... 16 hours? I'm shocked that you made it that far, I would've stopped after a few minutes 😂
I'm guessing that, at least since I last tried this, Robinhood has added support for a ton more options products. Unfortunately, I haven't found any alternatives to this current system- there isn't much documentation on it anywhere.
Unless you or someone else can find a different endpoint (which, if you do please let me know!), I could have this download to my server, compress it, and make it publicly available for download if that helps. I would obviously prefer the former option, but this could work as well.
If you (or anyone else) have time to tinker with the endpoints like you said, feel free to make a pull request or update this issue with your findings and I'll push it out in the next release.
from algotrader.
Found this on Reddit quickly, I'll look into it later when I get a chance. Feel free to take a stab at it.
From Jamonek's GitHub repo:
https://api.robinhood.com/options/instruments/?chain_id={_chainid}&expiration_dates={_dates}&state=active&tradability=tradable&type={_type}
Edit: FYI it is in python string format so you need to replace "{....}" with the corresponding data for the option you want to query.
from algotrader.
Hahaha, yeah, 16 hours was excessive. I was at a loss, though, so I let it run and walked away!
Thanks for the Reddit tip, which helped me get halfway. And then inspecting the Network while navigating the Robinhood website, I was able to tease out another endpoint to get option quotes.
In short, here is what I found:
(1) I need a symbol, an expiration date, and an option type. I want to get the entire list of option prices for every strike on that chain.
(2) I can get an array of the individual option instruments below. Note, no prices returned here.
request({
qs: {
chain_symbol: "SPY",
expiration_date: "2019-01-18",
type: "call",
tradability: "tradable",
state: "active"
},
uri: "https://api.robinhood.com/options/instruments/",
headers: {
'Authorization': 'Bearer ' + user.getAuthToken()
}
}, ...callback…)
(3) With the array of option instruments, I can get price data like so:
request({
qs: {
instruments: url
},
uri: "https://api.robinhood.com/marketdata/options/",
headers: {
'Authorization': 'Bearer ' + user.getAuthToken()
}
}, (error, response, body) => { })
.... where above, "url" could be a single option instrument. (Get this "url" by querying the "url" property of an option instrument object found in step 2). However, "url" can be a whole bunch of instruments, each separated by a comma. Like — "https://URL,https://URL,https://URL" ... chaining instruments together for the "instruments" parameter will return the bid/ask price data for every instrument included.
Couple of notes.
In step 3, you might have 100 option instruments for all the SPY Call strikes (for example). Adding all 100 urls in step 3 will result in an error, the final URL will be too long. So you have to split that up into manageable chunks. I can add 40 instruments and not have a problem.
Lastly, I can programmatically find all possible strike prices if I have a "chain_url". I'm not sure how to find a chain_url out of the blue (say, from a ticker symbol only), but if I have a single option instrument, I can get its chain_url by querying the "chain" property of that instrument. ... Once I have the chain url, a simple get request returns some JSON with chain.expiration_dates[], chain.underlying_instruments[], among other data.
from algotrader.
This is awesome. Thanks for working on this and finding a great solution- this will really benefit everyone using Robinhood's API.
I'll start incorporating this into the next release, but you can feel free to make a pull request if you have time.
from algotrader.
Related Issues (20)
- Open to a TypeScript conversion? HOT 1
- "request" package deprecation as of February 2020
- This version of Robinhood is no longer supported? HOT 1
- Is it possible to collect Metatrader data? HOT 1
- support for alphavantage too many requests error message HOT 1
- Issue with getHistoricals HOT 2
- Missing Auth in the Instrument.getFundamentals
- Support for fractional shares
- 3.0 release milestone HOT 1
- Robinhood Auth Issues HOT 1
- How are you connecting to rh? HOT 1
- IEX token HOT 1
- Portfoilo#getStockValue does not supply a user.
- binance exchange support
- XTB Broker
- Support for indian brokers
- Unable to complete downloading from Robinhood HOT 2
- Can't seem to sign in properly.
- Robinhood responded with code 401: unauthorized. { "detail": "Incorrect authentication credentials." }
- An alternative to this library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from algotrader.