Skip to content

Latest commit

 

History

History
205 lines (141 loc) · 6.94 KB

README.md

File metadata and controls

205 lines (141 loc) · 6.94 KB

Travis npm David

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 this blog post for more information on the API.

I have read Robinhood's Terms and Conditions and, without being a lawyer and/or this being valid in any way, it doesn't seem like interacting with their servers using the API is against them.

This framework was inspired by a deprecated Python framework originally developed by @Rohanpai.

Features

  • Placing buy orders Robinhood.place_buy_order
  • Placing sell order Robinhood.place_sell_order
  • Quote Information Robinhood.quote_data
  • Get Dividend information Robinhood.dividends (v0.2+)
  • Get User information Robinhood.user (v0.2+)
  • Get Orders Robinhood.orders (v0.2+)
  • More coming soon...

Installation

$ npm install --save robinhood

Usage

var Robinhood = require('robinhood');

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

    console.log(body);
});

API

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

Feel free to send a pull request expanding this with examples or info about the return objects

investment_profile(callback)

Get the current user's investment profile.

instruments(stock, callback)

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.

Return message: (passed to the callback)

{
    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. 'GOOG'
            trading_halted: Boolean, 
            updated_at: String, // YYYY-MM-DDTHH:MM:SS e.g. '2016-01-07T21:00:00Z'
        }
    ]
}

accounts(callback)

Get the user's accounts.

user(callback)

Get the user information.

dividends(callback)

Get the user's dividends information.

orders(callback)

Get the user's orders information.

place_buy_order(options, callback)

Place a buy order on a specified stock.

Options must contain:

{
    bid_price: Number,
    quantity: Number,
    instrument: {
        url: String,
        symbol: String
    },
    // Optional:
    trigger: String, // Defaults to "gfd" (Good For Day)
    time: String,    // Defaults to "immediate"
    type: String     // Defaults to "market"
}

For the Optional ones, the values can be:

[Disclaimer: This is an unofficial API based on reverse engineering, and the following option values have not been confirmed]

trigger

A trade trigger is usually a market condition, such as a rise or fall in the price of an index or security.

Values can be:

  • gfd: Good For Day
  • gtc: Good Till Cancelled
  • oco: Order Cancels Other

time

The time in force for an order defines the length of time over which an order will continue working before it is canceled.

Values can be:

  • immediate : The order will be cancelled unless it is fulfilled immediately.
  • day : The order will be cancelled at the end of the trading day.

place_sell_order(options, callback)

Place a sell order on a specified stock.

Options must contain:

{
    bid_price: Number,
    quantity: Number,
    instrument: {
        url: String,
        symbol: String
    },
    // Optional:
    trigger: String, // Defaults to "gfd" (Good For Day)
    time: String,    // Defaults to "immediate"
    type: String     // Defaults to "market"
}

For the Optional ones, the values can be:

[Disclaimer: This is an unofficial API based on reverse engineering, and the following option values have not been confirmed]

trigger

A trade trigger is usually a market condition, such as a rise or fall in the price of an index or security.

Values can be:

  • gfd: Good For Day
  • gtc: Good Till Cancelled
  • oco: Order Cancels Other

time

The time in force for an order defines the length of time over which an order will continue working before it is canceled.

Values can be:

  • immediate : The order will be cancelled unless it is fulfilled immediately.
  • day : The order will be cancelled at the end of the trading day.

Contributors


This framework is still in a very alpha version and will likely change, so production usage is completely discouraged.

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.

Analytics