SkillAgentSearch skills...

Robinhood Node

:chart_with_upwards_trend: NodeJS client for Robinhood Trading :fire:

Install / Use

npx skills add aurbano/robinhood-node

Installs into whichever agent you are using.

About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<h1><img src="https://raw.githubusercontent.com/aurbano/robinhood-node/master/.github/robinhood-node.png"/></h1>

NodeJS Framework to make trades with the private Robinhood API. Using this API is not encouraged, since it's not officially available and it has been reverse engineered. See @Sanko's Unofficial Documentation for more information.

FYI Robinhood's Terms and Conditions

<!-- toc --> <!-- toc stop -->

Features

  • Quote Data
  • Buy, Sell Orders
  • Daily Fundamentals
  • Daily, Weekly, Monthly Historicals

Tested on the latest versions of Node 6, 7 & 8.

Installation

$ npm install robinhood --save

Usage

To authenticate, you can either use your username and password to the Robinhood app or a previously authenticated Robinhood api token:

Robinhood API Auth Token

//A previously authenticated Robinhood API auth token

var credentials = {
    token: ''
};
var Robinhood = require('robinhood')(credentials, function(err, data){

    //Robinhood is connected and you may begin sending commands to the api.

    Robinhood.quote_data('GOOG', function(error, response, body) {
        if (error) {
            console.error(error);
            process.exit(1);
        }
        console.log(body);
    });

});

Username & Password

This type of login may have been deprecated in favor of the API Token above.

//The username and password you use to sign into the robinhood app.

var credentials = {
    username: '',
    password: ''
};

MFA code


var Robinhood = robinhood({
        username : '',
        password : ''
    }, (err, data) => {
        if(err) {
            console.log(err);
        } else {
            if (data && data.mfa_required) {
            var mfa_code = '123456'; // set mfa_code here

            Robinhood.set_mfa_code(mfa_code, () => {
                console.log(Robinhood.auth_token());
            });
            }
            else {
                console.log(Robinhood.auth_token());
            }
        }
    });

API

Before using these methods, make sure you have initialized Robinhood using the snippet above.

auth_token()

Get the current authenticated Robinhood api authentication token

var credentials = require("../credentials.js")();
var Robinhood = require('robinhood')(credentials, function(err, data){
    console.log(Robinhood.auth_token());
        //      <authenticated alphanumeric token>
}

expire_token()

Expire the current authenticated Robinhood api token (logout).

NOTE: After expiring a token you will need to reinstantiate the package with username & password in order to get a new token!

var credentials = require("../credentials.js")();
var Robinhood = require('robinhood')(credentials, function(err, data){
    Robinhood.expire_token(function(err, response, body){
        if(err){
            console.error(err);
        }else{
            console.log("Successfully logged out of Robinhood and expired token.");
            // NOTE: body is undefined on the callback
        }
    })
});

investment_profile(callback)

Get the current user's investment profile.

var credentials = require("../credentials.js")();
var Robinhood = require('robinhood')(credentials, function(err, data){
    Robinhood.investment_profile(function(err, response, body){
        if(err){
            console.error(err);
        }else{
            console.log("investment_profile");
            console.log(body);
                //    { annual_income: '25000_39999',
                //      investment_experience: 'no_investment_exp',
                //      updated_at: '2015-06-24T17:14:53.593009Z',
                //      risk_tolerance: 'low_risk_tolerance',
                //      total_net_worth: '0_24999',
                //      liquidity_needs: 'very_important_liq_need',
                //      investment_objective: 'income_invest_obj',
                //      source_of_funds: 'savings_personal_income',
                //      user: 'https://api.robinhood.com/user/',
                //      suitability_verified: true,
                //      tax_bracket: '',
                //      time_horizon: 'short_time_horizon',
                //      liquid_net_worth: '0_24999' }

        }
    })
});

instruments(symbol, callback)

var credentials = require("../credentials.js")();
var Robinhood = require('robinhood')(credentials, function(err, data){
    Robinhood.instruments('AAPL',function(err, response, body){
        if(err){
            console.error(err);
        }else{
            console.log("instruments");
            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 }
        }
    })
});

Get the user's instruments for a specified stock.

quote_data(stock, callback) // Not authenticated

Get the user's quote data for a specified stock.

var Robinhood = require('robinhood')(credentials, function(err, data){
    Robinhood.quote_data('AAPL', function(err, response, body){
        if(err){
            console.error(err);
        }else{
            console.log("quote_data");
            console.log(body);
            //{
            //    results: [
            //        {
            //            ask_price: String, // Float number in a String, e.g. '735.7800'
            //            ask_size: Number, // Integer
            //            bid_price: String, // Float number in a String, e.g. '731.5000'
            //            bid_size: Number, // Integer
            //            last_trade_price: String, // Float number in a String, e.g. '726.3900'
            //            last_extended_hours_trade_price: String, // Float number in a String, e.g. '735.7500'
            //            previous_close: String, // Float number in a String, e.g. '743.6200'
            //            adjusted_previous_close: String, // Float number in a String, e.g. '743.6200'
            //            previous_close_date: String, // YYYY-MM-DD e.g. '2016-01-06'
            //            symbol: String, // e.g. 'AAPL'
            //            trading_halted: Boolean,
            //            updated_at: String, // YYYY-MM-DDTHH:MM:SS e.g. '2016-01-07T21:00:00Z'
            //        }
            //    ]
            //}
        }
    })
});

accounts(callback)

var Robinhood = require('robinhood')(credentials, function(err, data){
    Robinhood.accounts(function(err, response, body){
        if(err){
            console.error(err);
        }else{
            console.log("accounts");
            console.log(body);
            //{ p

Related Skills

View on GitHub
GitHub Stars698
CategoryDevelopment
Updated1mo ago
Forks178

Languages

JavaScript

Security Score

100/100

Audited on Jun 23, 2026

No findings