This is a simple library for interacting with Robinhood's internal API. I wanted to make a simple web client for my personal use, and figured it'd be nice to roll my own library with support for the calls I needed. If you find yourself wanting more, read below to see how to contribute. Sorry that the documentation is pretty anemic, but I would much rather be working on other things :P
This app is written using async/await so you'll need a minimum node/npm version that supports this style of syntax.
You should be able to easily add any missing calls to the file ./api/calls.js. Not sure how the calls work? This was built from reading https://github.com/sanko/Robinhood. If you want to see it added to this package, go ahead and send a pull request.
const RobinHood = require('robinhood-api');
const robinhood = new RobinHood();
console.log(robinhood.listCalls()); //This will print all of the available API calls this library can do.
const RobinHood = require('robinhood-api');
const robinhood = new RobinHood();
(async () => {
try{
let loginResult = await robinhood.login({ username:'[email protected]', password:'mycoolpassword' });
let myUserData = await robinhood.getUserData();
console.log(myUserData);
}catch(e){
console.log('Oh noes! Login probably failed!', e);
}
})();
If you get a "next" token, or account, instrument, etc (URLs in API responses that when requested will resolve assets), you can simply request that location with the getResource() method.
let someCoolResource = await robinhood.getResource(someResourceUrl);
Login to RobinHood with your user credentials.
- username - Required: true
- password - Required: true
Login using a two-step authentication code.
- username - Required: true
- password - Required: true
- mfa_code - Required: true
Get the ACH methods associated with this account.
Get an ACH relationship by ID (retrieved by getACHRelationships())
- relationship_id - Required: true
Add a scheduled ACH transfer to fund this account.
- ach_relationship - Required: true
- amount - Required: true
- frequency - Required: false (Valid Values: weekly,biweekly,monthly,quarterly)
Get scheduled ACH transfers.
Perform a one time ACH transfer to or from your bank account.
- amount - Required: true
- ach_relationship - Required: true
- direction - Required: true (Valid Values: withdraw,deposit)
Get list of one time ACH transfers to or from your bank account.
Get the user's basic account information.
Get the accounts associated with the user credentials.
Get the user's investment profile.
Get the current stock positions being held.
- nonzero - Required: false (Valid Values: true,false)
Get the user's portfolio by account ID
- account_number - Required: true
Get the user's portfolio historicals
- account_number - Required: true
- interval - Required: false (Valid Values: week,day,10minute,5minute)
- span - Required: false (Valid Values: day,week,year,5year,all)
Get historicals for a particular symbol
- symbol - Required: true
- interval - Required: false (Valid Values: week,day,10minute,5minute)
- span - Required: false (Valid Values: day,week,year,5year,all)
Get an order via the order_id parameter.
- order_id - Required: true
Get recently placed orders.
- updated_at - Required: false
- instrument - Required: false
- cursor - Required: false
Buy or sell a security.
- account - Required: true
- instrument - Required: true
- symbol - Required: true
- type - Required: true (Valid Values: market,limit)
- time_in_force - Required: true (Valid Values: gfd,gtc,ioc,fok,opg)
- trigger - Required: true (Valid Values: immediate,stop)
- price - Required: false
- stop_price - Required: false
- quantity - Required: true
- side - Required: true (Valid Values: buy,sell)
- extended_hours - Required: false (Valid Values: true,false)
- override_day_trade_checks - Required: false (Valid Values: true,false)
- override_dtbp_checks - Required: false (Valid Values: true,false)
Cancel an active order
- order_id - Required: true
Get instruments list.
- query - Required: false
Get quote on a security via ticker symbols (comma separated list)
- symbols - Required: true
Get quote on a single security via ticker symbol
- symbol - Required: true
Get market data for the different exchanges
Get fundamental data for ticker symbols (comma separated list)
- symbols - Required: true
Get list of watchlists for a user
Reorder a watchlist. UUIDs is a list of instrument URLs (comma separated list)
- name - Required: true
- uuids - Required: true
Create a new watchlist
- name - Required: true
Retrieve user dividend payouts
Retrieve user documents
Get S&P 500 movers
- direction - Required: true (Valid Values: up,down)
Get companies reporting earnings within X days
- range - Required: true
Get earnings by stock symbol
- symbol - Required: true
Get cards (notification) stack
Dismiss a card by the notification ID
- id - Required: true
Get stock splits by instrument
- instrument - Required: true