Skip to content

Latest commit

 

History

History
executable file
·
1713 lines (1274 loc) · 69.7 KB

ROBINHOOD.md

File metadata and controls

executable file
·
1713 lines (1274 loc) · 69.7 KB

Classes

Fundamentals

Market data for the given equity, such as market cap, dividend yield, P/E ratio, description, and more.

Instrument

Represents a security traded on Robinhood.

Market

Represents an exchange on which securities are traded.

OptionInstrument

Represents an option traded on Robinhood.

OptionOrder

Represents and executes an order for the given option contract.

Order

Represents and executes an order for the given instrument.

Portfolio

Represents all of the user's holdings on Robinhood and allows for various queries.

User

Represents the user that is logged in while accessing the Robinhood API.

Fundamentals

Market data for the given equity, such as market cap, dividend yield, P/E ratio, description, and more.

Kind: global class

new Fundamentals(object)

Creates a new Fundamentals object.

Param Type
object Object

fundamentals.getOpen() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getHigh() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getLow() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getVolume() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getAverageVolume() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.get52WeekHigh() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.get52WeekLow() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getMarketCap() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getDividendYield() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getPERatio() ⇒ Number

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getDescription() ⇒ String

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

fundamentals.getHeadquarters() ⇒ String

Kind: instance method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

Fundamentals.getBySymbol(symbol) ⇒ Promise.<Fundamentals>

Returns a fundamentals object for the given symbol.

Kind: static method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String

Fundamentals.getBySymbolArray(array) ⇒ Promise.<Array>

Returns an array of fundamentals objects for the symbols in the given array.

Kind: static method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

Param Type
array Array

Fundamentals.getByURL(url) ⇒ Promise.<Fundamentals>

Returns a fundamentals object for the given URL.

Kind: static method of Fundamentals
Author: Torrey Leonard https://github.com/Ladinn

Param Type
url String

Instrument

Represents a security traded on Robinhood.

Kind: global class

new Instrument(object)

Creates a new Instrument object.

Param Type
object Object

instrument.populate(user) ⇒ Promise.<Array>

Fills the instrument object with market, fundamental, quote, and split data. Returns an array of Market, Fundamentals, Quote, and Splits objects.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
user User Authenticated user object

instrument.getMarket() ⇒ Promise.<Market>

Returns an object with information on the market that this instrument trades on.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getFundamentals() ⇒ Promise.<Fundamentals>

Returns a new Fundamentals object with information such as open, high, low, close, volume, market cap, and more, on this instrument.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getQuote(user) ⇒ Promise.<Quote>

Returns an object with a real-time quote on this instrument.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn
Author: Colin Gillingham https://github.com/Gillinghammer (Added user authentication after Robinhood API update - issue #11)

Param Type Description
user User Authenticated user object

instrument.getSplits() ⇒ Promise.<Object>

Returns an object containing details on past stock splits.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getEarnings() ⇒ Promise.<Object>

Returns an object containing this company's past and future earnings data.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getPricesPaid() ⇒ Promise.<Object>

Returns the high, low, and average prices paid for the instrument by other Robinhood users.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn
Author: rclai (Discovered API endpoint)

instrument.getPopularity() ⇒ Promise.<Number>

Returns the total amount of open positions on this instrument among all Robinhood users.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn
Author: rclai (Discovered API endpoint)

instrument.getRatings() ⇒ Promise.<Object>

Returns an object containing buy hold, and sell ratings from major financial institutions, along with text describing the rating.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn
Author: rclai (Discovered API endpoint)

instrument.getName() ⇒ String

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getSimpleName() ⇒ String

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getSymbol() ⇒ String

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getListDate() ⇒ Date

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getCountry() ⇒ String

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getType() ⇒ String

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getBloombergID() ⇒ String

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getState() ⇒ String

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getID() ⇒ String

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getMarginInitialRatio() ⇒ Number

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getDayTradeRatio() ⇒ Number

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.getMaintenanceRatio() ⇒ Number

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.isTradeable() ⇒ Boolean

Checks if the instrument is able to be traded.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.isActive() ⇒ boolean

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.isStock() ⇒ Boolean

Checks if the instrument is a stock.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.isETP() ⇒ Boolean

Checks if the instrument is an exchange traded product.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.isADR() ⇒ Boolean

Checks if the instrument is an American Depositary Receipt. Typically applies to foreign companies. https://www.investopedia.com/terms/a/adr.asp

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

instrument.equals(otherInstrument) ⇒ Boolean

Check whether another instance of Instrument equals this instance.

Kind: instance method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
otherInstrument Instrument

Instrument.getAll() ⇒ Promise.<Array>

Returns an array of all available instruments. WARNING: this will take a while!

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Instrument.getBySymbol(symbol) ⇒ Promise.<Instrument>

Returns an instrument object for the specified symbol.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String

Instrument.getByID(id) ⇒ Promise.<Instrument>

Returns an instrument object for the specified Robinhood instrument ID.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
id String

Instrument.getByURL(instrumentURL) ⇒ Promise.<Instrument>

Returns an instrument object for the specified instrument URL.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
instrumentURL String

Instrument.getTopMoving(direction) ⇒ Promise.<Instrument>

Returns an array of Instruments for 10 of the top moving S&P 500 equities.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
direction String Possible options: [up, down]

Instrument.getByIdArray(ids) ⇒ Promise.<Array>

Returns an array of instrument objects for the specified array of IDs.

Note: large arrays will take longer to process and are capped at 50 per request, so multiple requests will be sent as the function iterates through the array.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
ids Array

Instrument.getCategories() ⇒ Array.<String>

Returns an array of known categories that can be used with getByCategory(). This list is non-exhaustive.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Instrument.getByCategory(category) ⇒ Promise.<Array>

Returns an array of Instruments related to the given category.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
category String For possible options see getCategories().

Instrument.getMostPopular() ⇒ Promise.<Array>

Returns an array of Instruments for the top 100 most popular equities on Robinhood.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Instrument.getUpcomingEarnings() ⇒ Promise.<Array>

Returns an array of Instruments that have upcoming earnings.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Instrument.getRecommendations(user) ⇒ Promise.<Array>

Returns an array of instruments for stocks from Robinhood's recommendations for the given user.

Kind: static method of Instrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
user User Authenticated user object

Market

Represents an exchange on which securities are traded.

Kind: global class

new Market(object)

Creates a new Market object.

Param Description
object Created using this class' static methods. For example, use 'getByMIC("XNAS")' to create an instance of the Nasdaq.

market.getNextTradingHours() ⇒ Promise.<Object>

Returns an object with hours on the next trading period.

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getPreviousTradingHours() ⇒ Promise.<Object>

Returns an object with hours on the previous trading period.

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getHoursOn(date) ⇒ Promise.<Object>

Returns an object with hours for the given date.

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

Param Type
date Date

market.isOpenOn(date) ⇒ Promise.<Boolean>

Checks whether the market is open on the given date.

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

Param Type
date Date

market.getNextOpen() ⇒ Promise.<Date>

Returns the next date and time that the market will be open.

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getNextClose() ⇒ Promise.<Date>

Returns the next date and time that the market will close.

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getWebsite() ⇒ String

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getCity() ⇒ String

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getName() ⇒ String

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getCountry() ⇒ String

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getCode() ⇒ String

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getAcronym() ⇒ String

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getHours() ⇒ Object

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getClose() ⇒ Date

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getOpen() ⇒ Date

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getExtendedClose() ⇒ Date

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.getExtendedOpen() ⇒ Date

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.isOpenToday() ⇒ Boolean

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.isOpenNow() ⇒ Boolean

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

market.isExtendedOpenNow() ⇒ Boolean

Kind: instance method of Market
Author: Torrey Leonard https://github.com/Ladinn

Market.getByMIC(code)

Returns a Market object for the given Market Identifier Code (MIC). See ISO 10383: https://www.iso20022.org/10383/iso-10383-market-identifier-codes

Kind: static method of Market
Author: Torrey Leonard https://github.com/Ladinn

Param Type
code String

Market.getByURL(url)

Returns a Market object for the given market URL.

Kind: static method of Market
Author: Torrey Leonard https://github.com/Ladinn

Param Type
url String

OptionInstrument

Represents an option traded on Robinhood.

Kind: global class

new OptionInstrument(object)

Param
object

optionInstrument.getTradability() ⇒ String

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getStrikePrice() ⇒ Number

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getState() ⇒ String

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getType() ⇒ String

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getInstrumentURL() ⇒ String

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getSymbol() ⇒ String

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getMiniumumTicks() ⇒ Object

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getChainID() ⇒ String

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getOptionID() ⇒ String

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.getExpiration() ⇒ Date

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.isPut() ⇒ boolean

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

optionInstrument.isCall() ⇒ boolean

Kind: instance method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

OptionInstrument.getAll(user) ⇒ Promise.<Array>

Returns an array of all option instruments. Note: this may take an eternity - no need to use this.

Kind: static method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
user User

OptionInstrument.getChain(user, instrument, side) ⇒ Promise.<any>

Returns an array of all option instruments for the given expiration date and side. Ordered from lowest to highest strike price.

Kind: static method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn
Author: hbeere (Issue #10)

Param Type Description
user User
instrument Instrument
side String Can be either 'call' or 'put'

OptionInstrument.getPrices(user, instruments) ⇒ Promise.<any>

Returns an array prices arranged by strike price. Make sure to only send a maximum of about 50 instruments.

Kind: static method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
user User
instruments Array.<OptionInstrument>

OptionInstrument.getExpirations(user, instrument) ⇒ Promise.<Array.<Date>>

Returns an array of expiration dates for the given Instrument.

Kind: static method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
user User
instrument Instrument

OptionInstrument.getByURL(user, url) ⇒ Promise.<Instrument>

Returns an options instrument object for the specified instrument URL.

Kind: static method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
user User
url String

OptionInstrument.getPositions(user) ⇒ Promise.<Array>

Returns an array of the user's open option contracts.

Kind: static method of OptionInstrument
Author: Torrey Leonard https://github.com/Ladinn

Param Type
user User

OptionOrder

Represents and executes an order for the given option contract.

Kind: global class

new OptionOrder(user, object)

Creates a new OptionOrder.

Param Type
user User
object Object

optionOrder.submit() ⇒ Promise.<OptionOrder>

Submits the OptionOrder to Robinhood and returns the executed OptionOrder.

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getLegs() ⇒ Array

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getDirection() ⇒ String

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getPremium() ⇒ Number

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getProcessedPremium() ⇒ Number

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getTimeInForce() ⇒ String

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getReferenceID() ⇒ String

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getPrice() ⇒ Number

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getTrigger() ⇒ String

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getType() ⇒ String

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getQuantity() ⇒ Number

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getQuantityPending() ⇒ Number

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getQuantityCanceled() ⇒ Number

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getChainID() ⇒ String

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getSymbol() ⇒ String

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.getDateCreated() ⇒ Date

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.isExecuted() ⇒ Boolean

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.isCredit() ⇒ Boolean

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

optionOrder.isDebit() ⇒ Boolean

Kind: instance method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

OptionOrder.getOrders(user) ⇒ Promise.<Array.<OptionOrder>>

Returns an array of executed OptionOrders. NOTE: See OptionInstrument.getPositions for an array of open positions.

Kind: static method of OptionOrder
Author: Torrey Leonard https://github.com/Ladinn

Param Type
user User

Order

Represents and executes an order for the given instrument.

Kind: global class

new Order(user, object)

Creates a new Order object.

Param Type
user User
object Object

order.submit() ⇒ Promise.<Object>

Submits an order to Robinhood to be executed by the exchange.

Kind: instance method of Order
Author: Torrey Leonard https://github.com/Ladinn

order.cancel() ⇒ Promise.<Object>

Attempts to cancel an order.

Kind: instance method of Order
Author: Torrey Leonard https://github.com/Ladinn

order.getResponse() ⇒ Object | Null

If an order has been executed, this will return the response object.

Kind: instance method of Order
Author: Torrey Leonard https://github.com/Ladinn

Order.getByOrderID(user, orderID) ⇒ Promise.<Order>

Returns a new order object for the specified order ID, if found.

Kind: static method of Order
Author: Torrey Leonard https://github.com/Ladinn

Param Type
user User
orderID String

Order.getRecentOrders(user) ⇒ Promise.<Array>

Returns an array of recent orders for the given user object.

Kind: static method of Order
Author: Torrey Leonard https://github.com/Ladinn

Param Type
user User

Order.cancelOpenOrders(user) ⇒ Promise.<any>

Kind: static method of Order
Author: Torrey Leonard https://github.com/Ladinn

Param
user

Portfolio

Represents all of the user's holdings on Robinhood and allows for various queries.

Kind: global class

new Portfolio(user, array)

Creates a new Portfolio object.

Param Type Description
user User
array Array Created via User.getPortfolio()

portfolio.sellAll() ⇒ Promise.<(Boolean|Error)>

Sells all positions in the user's portfolio at the market price.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

portfolio.setQuantity(symbol, targetQuantity) ⇒ Promise.<Order>

Executes a new order to reduce or increase the user's position in the given symbol by the given amount.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String
targetQuantity Number

portfolio.getStockValue() ⇒ Promise.<Number>

Returns the total market value of all stocks held by the user.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

portfolio.getInstrumentArray() ⇒ Array

Returns an array of all instruments in the user's portfolio.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

portfolio.getSymbols() ⇒ Array

Returns an array of all symbols in the user's portfolio.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

portfolio.getBuyPrice(symbol) ⇒ Number

Returns the average buy price for the given symbol.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String

portfolio.getQuantity(symbol) ⇒ Number

Returns the quantity owned of the given symbol.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String

portfolio.getSharesHeld(symbol) ⇒ Number

Get total shares held for the given symbol.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String

portfolio.getPurchaseDate(symbol) ⇒ Date

Returns the date of original purchase for the given symbol.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String

portfolio.getLastTradeDate(symbol) ⇒ Date

Returns the date of last trade for the given symbol.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String

portfolio.getBySymbol(symbol) ⇒ Object

Returns an object containing the user's position in the given symbol.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
symbol String

portfolio.getBySymbols(array) ⇒ Array.<Object>

Returns an array of objects containing the user's positions in the given symbols.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
array Array

portfolio.getQuantityGreaterThan(size) ⇒ Array.<Object>

Returns an array of all positions greater than the given amount.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
size Number

portfolio.getQuantityLessThan(size) ⇒ Array.<Object>

Returns an array of all positions less than the given amount.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
size Number

portfolio.getQuantityEqualTo(size) ⇒ Array.<Object>

Returns an array of all positions equal to than the given amount.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
size Number

portfolio.getPurchasedAfter(date) ⇒ Array.<Object>

Returns an array of all positions opened after the given date (UTC).

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
date Date Compared with UTC time.

portfolio.getPurchasedBefore(date) ⇒ Array.<Object>

Returns an array of all positions opened before the given date (UTC).

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
date Date Compared with UTC time.

portfolio.getPurchasedOn(date) ⇒ Array.<Object>

Returns an array of all positions opened on the given date (UTC).

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
date Date Compared with UTC time.

portfolio.getPriceGreaterThan(amount) ⇒ Array.<Object>

Returns an array of all positions with an average buy price greater than the given amount.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
amount Number

portfolio.getPriceLessThan(amount) ⇒ Array.<Object>

Returns an array of all positions with an average buy price less than the given amount.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
amount Number

portfolio.getPriceEqualTo(amount) ⇒ Array.<Object>

Returns an array of all positions with an average buy price equal to the given amount.

Kind: instance method of Portfolio
Author: Torrey Leonard https://github.com/Ladinn

Param Type
amount Number

User

Represents the user that is logged in while accessing the Robinhood API.

Kind: global class

new User(username, password)

Creates a new User object.

Param Type Description
username String
password String Optional. If not provided the user will be prompted via CLI.

user.authenticate(password, mfaFunction) ⇒ Promise.<User>

Authenticates a user using the inputted username and password.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
password String | Undefined Optional if not provided in constructor or re-authenticating a saved user.
mfaFunction function | Undefined Optional function that is called when prompted for multi-factor authentication. Must return a promise with a six-character string. If not provided the CLI will be prompted.

user.reauthenticate() ⇒ Promise.<User>

Re-authenticates a user with the the expired authentication token using the refresh token.

Kind: instance method of User
Author: Egor Verbitskiy https://github.com/egorio

user.logout() ⇒ Promise.<Boolean>

Logout the user by expiring the authentication token and removing any saved data.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.serialize() ⇒ string

Converts a user object to a string to be securely stored.

Note that serialized object contains refreshToken and it's subject to strict storage requirements to ensure that they are not leaked

Kind: instance method of User
Author: Egor Verbitskiy https://github.com/egorio

user.save() ⇒ Promise.<Boolean>

Save the user to disk. Prevents having to login and logout each run.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.isAuthenticated() ⇒ boolean

Checks if the current user is authenticated and authentication is not expired.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getAuthToken() ⇒ null | string

Returns an auth token.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getAccountNumber() ⇒ null | string

Returns an account number.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getUsername() ⇒ null | string

Returns a username.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getAccount() ⇒ Promise

Returns vital information about balances and enabled features.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getBalances() ⇒ Promise.<Object>

Returns an object containing details on the user's cash and margin balance.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getBuyingPower() ⇒ Promise

Returns the amount of money available to be spent.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getUserInfo() ⇒ Promise.<Object>

Returns information like username, first / last name, creation date, id, and more.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getUID() ⇒ Promise.<String>

Returns the user's unique ID.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getTaxInfo() ⇒ Promise.<Object>

Returns information like address, citizenship, SSN, date of birth, and more.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getDisclosureInfo() ⇒ Promise.<Object>

Returns information on the user pertaining to SEC rule 405.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getEmployerInfo() ⇒ Promise.<Object>

Returns information on the user's employment.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getInvestmentProfile() ⇒ Promise.<Object>

Returns the user's answers to basic questions regarding investment experiences.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getRecentDayTrades() ⇒ Promise.<Object>

Returns arrays of recent option and equity day trades.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getRecentOrders() ⇒ Promise.<Array.<Order>>

Returns an array of recent orders.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.cancelOpenOrders() ⇒ Promise

Cancels all open orders.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getOptionOrders() ⇒ Promise.<Array>

Returns an array of option orders.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getPortfolio() ⇒ Promise.<Object>

Returns a Portfolio object containing all open positions in a user's portfolio.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getOptionPositions() ⇒ Promise.<any>

Returns an array of options that the user holds.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getHistoricals() ⇒ Promise.<Object>

Returns an object that can be used to create a chart, show total return, etc.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.getLinkedBanks() ⇒ Promise.<Object>

Returns an object representing the user's linked bank account. If the user has linked multiple, this returns an array.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.addDeposit(bankID, amount, frequency) ⇒ Promise.<Object>

Deposits money into the user's account. If frequency is not empty, this becomes an automatic deposit.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

Param Type Description
bankID String This ID can be found from getLinkedBanks().
amount String How much money should be deposited, represented as a string.
frequency String Empty string if one-time deposit, otherwise: 'weekly,' 'biweekly,' 'monthly,' or 'quarterly.'

user.getDocuments() ⇒ Promise.<Array>

Returns an array of account documents (taxes, statements, etc). Use 'downloadDocuments()' to view them.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

user.downloadDocuments(folder) ⇒ Promise

Downloads all account documents to the given folder path. Note that, because of Robinhood's connection throttling, this will take a while for accounts with high activity. Downloads will be attempted every second and will wait for any connection throttling to end before continuing.

Kind: instance method of User
Author: Torrey Leonard https://github.com/Ladinn

Param Type
folder String

User.deserialize(data) ⇒ Promise.<User>

Restores a user from the serialized object.

Kind: static method of User
Author: Egor Verbitskiy https://github.com/egorio

Param Type Description
data String serialized data

User.load() ⇒ Promise.<User>

If a saved user exists, this will load it into system memory. Recommended if using multi-factor authentication.

Kind: static method of User
Author: Torrey Leonard https://github.com/Ladinn

User.isUser(object) ⇒ boolean

Checks if the provided object an instance of User object.

Kind: static method of User
Author: Torrey Leonard https://github.com/Ladinn

Param Type
object Object