1.0.14 • Published 6 years ago

robinhood-node v1.0.14

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Robinhood node robinhood-node

Trade stocks for FREE with this simple to use NodeJS library.
Yes, it's really free using Robinhood service and their undocumented API.
The motivation behind this tool is to aggregate functions based on logic and not necessary api domain.

Install

yarn add robinhood-node

Use

const RH = require('robinhood-node');
const rh = new RH({ user: 'RH user', password: 'RH password' });
// get account
const account = new rh.Account();
console.log(await account.user);
// get stock quote
const stock = new rh.Stock('AMZN');
console.log(await stock.quote);
const orderResponse = await stock.buy(1);
// check order and cancel
const order = new rh.Order(orderResponse.id);
console.log(order.status());
order.cancel();

Interface

Each class can be initiated from a robinhood-node instance.

Login

In order to login you will need to have a Robinhood account. Use this link to open a free account.
Some of the calls (like stock quotes) can be used in anonymous mode. In order to trade (sell/buy) you will require to login as a Robinhood user. There are 2 ways to login into the library:

user & password &mfa key:

new RH({ user: 'your RH email', password: 'your RH password', mfa: 12345 });

mfa is optional and required only if your settings on Robinhood require it. In order to get the mfa try to leave it empty and then you should get the code on your first attempt.

token:

new RH({ token: 'your RH token' });

Once you login with username&password youu should get a token in reponse. this token can be used to access RH API from now on.

Stock

constructor(symbols) - symbols of stocks seperated by comma.
quote - get latest quote for symbol(s).

Stock actions

You can place orders directly from the stock class. For information about order types click here.
For a list of extra params available click here.
buy(quantity, extraParams = {})
sell(quantity, extraParams = {})
buyLimit(quantity, price, extraParams = {})
sellLimit(quantity, price, extraParams = {})
stopLossSell(quantity, stopPrice, extraParams = {})
stopLossBuy(quantity, stopPrice, extraParams = {})
stopLossSellLimit(quantity, stopPrice, sellPrice, extraParams = {})
stopLossBuyLimit(quantity, stopPrice, buyPrice, extraParams = {})

Order

constructor(id) - optional order id.
status(id) - get order status. order id is optional (can be set up when initiated).
cancel(id) - cancel an order. order id is optional (can be set up when initiated).
recent - get recent orders.
static place(params) - manually place an order. a better use will be to interact with Stock class in order to place an order.

Instrument

static all
static valueById(id)
static valueBySymbol(symbol)

Account

constructor()
positions
accounts
user
basicInfo
investment
watchlists
defaultWatchlist
portfolios

TODO

There are a lot of API calls that are still not implemented here. The important calls are. Any help or PR will be highly appriciated!

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago