Socket
Socket
Sign inDemoInstall

robinhood-simple

Package Overview
Dependencies
52
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    robinhood-simple

A simple module to interact with the Robinhood API; incl. promise support, readable code, more


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

A Simple NodeJS Robinhood Api

npm npm

Overview

A simple nodejs module to interact with the private Robinhood API. The API has been reverse engineered; no official nodejs api for robinhood exists. FYI: Robinhood's Terms and Conditions.

Origin

This repository is based off of robinhood-node by aurbano. It was generated as a new repository rather than a fork because of the massive, backwards-incompatible, changes that were created in order to:

  • "promisify" the api
  • support natural object instantiation
  • make errors more understandable
  • make error handling easier
  • make code more readable

and most importantly

  • keep it simple

Installation

$ npm install robinhood-simple --save

Authentication

To access most functionality one must use either the username and password of an active Robinhood account or a token from a previously authenticated Robinhood session. For example:


var credentials = {
    username: STRING,
    password: STRING
}
// -- or --
var credentials = {
    token: STRING
}

var Robinhood = require('robinhood-simple');
var robinhood = new Robinhood(credentials);
// robinhood is now ready to use!

After authenticating, you may now interact with the Robinhood API.

Table of Contents

API

These examples assume that the robinhood object has already been initialized as demonstrated above. Note, the robinhood module will automatically wait until authorization has completed before running any subsequent requests are made. In other words the following usage is supported:

var robinhood = new Robinhood(credentials);
robinhood.instruments("AAPL")
    .then((body)=>{/* magic */})

token()

This resolves with the token after the robinhood instance is authenticated.

robinhood.token()
    .then((token)=>{
        console.log(token) // don't share this! whoever has this can access your account.
    })

accounts()

robinhood.accounts()
    .then((body)=>{
        console.log(body)
    })

expire_token()

expire_token() enables a user to log out and terminate the robinhood session, de-authorizing a specific token.

robinhood.expire_token()
    .then(()=>{
        console.log("logged out of robinhood and expired the token")
    })

historicals()

var ticker = "AAPL";
var interval = "10minute"; // either `10minute` or `5minute`
var period = "day"; // either "day" or "week"
robinhood.historicals(ticker, interval, period)
    .then((body)=>{
        var historicals = body.historicals;
        console.log(historicals);
        /*
        [
          { begins_at: '2018-01-16T14:30:00Z',
            open_price: '245.3500',
            close_price: '245.5400',
            high_price: '246.0800',
            low_price: '245.2100',
            volume: 12701,
            session: 'reg',
            interpolated: false },
          { begins_at: '2018-01-16T14:40:00Z',
            open_price: '245.6096',
            close_price: '245.8100',
            high_price: '245.8400',
            low_price: '245.2400',
            volume: 8133,
            session: 'reg',
            interpolated: false },
          { begins_at: '2018-01-16T14:50:00Z',
            open_price: '245.7502',
            close_price: '245.9100',
            high_price: '246.0548',
            low_price: '245.5861',
            volume: 4569,
            session: 'reg',
            interpolated: false },
            ...
        ]
        */
    })

instruments(symbol)

instruments(...) is used to retreive detailed information about specific instruments (e.g., companies).

var ticker_symbol = "AAPL"; // use apple symbol for demo
robinhood.instruments(ticker_symbol)
    .then((body)=>{
        console.log(body);
        //    { previous: null,
        //      results:
        //       [ { min_tick_size: null,
        //           splits: 'https://api.robinhood.com/instruments/450dfc6d-5510-4d40-abfb-f633b7d9be3e/splits/',
        //           margin_initial_ratio: '0.5000',
        //           url: 'https://api.robinhood.com/instruments/450dfc6d-5510-4d40-abfb-f633b7d9be3e/',
        //           quote: 'https://api.robinhood.com/quotes/AAPL/',
        //           symbol: 'AAPL',
        //           bloomberg_unique: 'EQ0010169500001000',
        //           list_date: '1990-01-02',
        //           fundamentals: 'https://api.robinhood.com/fundamentals/AAPL/',
        //           state: 'active',
        //           day_trade_ratio: '0.2500',
        //           tradeable: true,
        //           maintenance_ratio: '0.2500',
        //           id: '450dfc6d-5510-4d40-abfb-f633b7d9be3e',
        //           market: 'https://api.robinhood.com/markets/XNAS/',
        //           name: 'Apple Inc. - Common Stock' } ],
        //      next: null }
    })

Contributors

From github.com/aurbano/robinhood-node:


Even though this should be obvious: I am not affiliated in any way with Robinhood Financial LLC. I don't mean any harm or disruption in their service by providing this. Furthermore, I believe they are working on an amazing product, and hope that by publishing this NodeJS framework their users can benefit in even more ways from working with them.

Keywords

FAQs

Last updated on 01 Mar 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc