- Initialization
api = require('robinhood-yolo')({ newLogin: true, configIndex: 0, configData: null, print: true })
- Optional args
- newLogin (boolean)
- if true does new login request, else uses stored auth token for quicker login
- configIndex (int)
- user index in config file (for multi-user use, does not apply if configData is defined)
- configData (object)
- By default CLI stores account data with no dependencies, allowing users to login with no credentials after adding the account details
- If configData arg is null or undefined, credentials will need to be added before using API with
yolo -c add_account
- Else, configData expects object for login data as follows
- d_t: Device token (Base64 encoded)
- u_n: Username (Base64 encoded)
- p_w: Password (Base64 encoded)
- a_t: Robinhood access token
- r_t: Robinhood refresh token
- a_b: Robinhood bearer token
- t_s: Login timestamp
- a_u: Account URL
- a_i: Account ID
- print (boolean)
- If false, will skip optional print statements in functions, else will print all info
- Returns true if configData is null/undefined, else returns configData object with updated values
- login()
await api.login({ newLogin: true, configIndex: 0 })
- Logs user into Robinhood
- Optional args
- newLogin (boolean)
- if true does new login request, else uses stored auth token for quicker login
- configIndex (int)
- user index in config file (for multi-user use)
- Must be called before using login-only methods, overrides initialization args
- getAccount()
await api.getAccount()
- Gets account info
- Returns dict
- Optional args
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- getPortfolioInfo()
await api.getPortfolioInfo()
- Gets portfolio Info
- Returns dict
- getAccountEquity()
await api.getAccountEquity()
- Gets account Equity
- Returns number
- getCashBalance()
await api.getCashBalance()
- Gets Robinhood Cash Balance
- Returns number
- getTransfers()
await api.getTransfers()
- Gets account bank transfers
- Returns list
- Optional args
* consume (boolean)
* if true returns all pages of data, else returns first page of data
- getMarketHours()
await api.getMarketHours('2019-07-19')
- Gets Market Hours info for date
- Required args
- getWatchList()
await api.getWatchList({ watchList: 'Default', instrumentData: false, quoteData: false })
- Gets Watch List items
- Optional args
- watchList (string)
- instrumentData (boolean)
- if true includes instrument data
- quoteData (boolean)
- if true includes quote data
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- quotes()
await api.quotes('TSLA')
await api.quotes('TSLA', { chainData: false })
- Gets quotes for single ticker or list of tickers
- Returns dict for single ticker, list for list of tickers
- Required args
- ticker(s) (string || array)
- Optional args
- chainData (boolean)
- If false does not include chain data, else includes chain data
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- historicals()
await api.historicals('TSLA')
await api.historicals('TSLA', { span: 'year', bounds: 'regular' })
- Gets historical quotes for single ticker or list of tickers
- Returns dict for single ticker, list for list of tickers
- Required args
- ticker(s) (string || array)
- Optional args
- span (string)
- time span (see src/endpoints.coffee for allowed interval/span combinations)
- bounds (string)
- getOptions()
await api.getOptions('TSLA', '2019-07-19')
await api.getOptions('TSLA', '2019-07-19', { optionType: 'call', marketData: false, expired: false })
- Gets list of available options for ticker
- Returns list
- Required args
- symbol (string)
- expirationDate (string)
- Optional args
- optionType (string)
- marketData (boolean)
- If false does not include market data, otherwise includes market data
- expired (boolean)
- if true includes expired options in search, else excludes expired options
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- findOptions()
await api.findOptions('TSLA', '2019-07-19')
await api.findOptions('TSLA', '2019-07-19', { optionType: 'call', strikeType: 'itm', strikeDepth: 0, marketData: false, range: null, strike: null, expired: false })
- Finds options by args
- Either returns a list of a range of options, or a single option dict
- Required args
- symbol (string)
- expirationDate (string)
- Optional args
- optionType (string)
- marketData (boolean)
- If false does not include market data, otherwise includes market data
- strikeType (string)
- strikeDepth (int)
- strike price depth, 0-based
- range (int)
- if not null, will return list of range. For example, if range equals 3, 3 otm and 3 itm options will be returned
- strike (Number)
- if not null, will return option at exact strike price
- expired (boolean)
- if true includes expired options in search, else excludes expired options
- findOptionsHistoricals()
await api.findOptionsHistoricals('TSLA', '2019-07-19')
await api.findOptionsHistoricals('TSLA', '2019-07-19', { optionType: 'call', strikeType: 'itm', strikeDepth: 0, strike: null, expired: true, span: 'month' })
- Finds option historical data
- Returns list of data
- Required args
- symbol (string)
- expirationDate (string)
- Optional args
- optionType (string)
- strikeType (string)
- strikeDepth (int)
- strike price depth, 0-based
- strike (Number)
- if not null, will return option at exact strike price
- expired (boolean)
- if true includes expired options in search, else excludes expired options
- span (string)
- time span (see src/endpoints.coffee for allowed interval/span combinations)
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- optionsPositions()
await api.optionsPositions()
await api.optionsPositions({ marketData: false, orderData: false, openOnly: true, notFilled: false })
- Gets list of options positions
- Returns list
- Optional args
- marketData (boolean)
- If false does not include market data, otherwise includes market data
- orderData (boolean)
- If false does not include order data, otherwise includes order data
- openOnly (boolean)
- If true includes open positions only, if false includes all positions
- notFilled (boolean)
- If true includes unfilled positions, if false excludes unfilled positions
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- optionsOrders()
await api.optionsOrders()
await api.optionsOrders({ urls: null, id: null, notFilled: false, buyOnly: false })
- Returns list of options orders
- Optional args
- urls (list)
- If not null, gets orders from list of option order urls
- id (string)
- If not null, gets order by id
- notFilled (boolean)
- If true includes unfilled orders, if false excludes unfilled orders
- buyOnly (boolean)
- Only include buy orders if true, else include all
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- stockOrders()
await api.stockOrders()
- Returns list of stock orders
- Optional args
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- getHistory()
await api.getHistory({ options: true, stocks: true, banking: true, consume: true })
- Returns formatted list of transactions, including options, stocks, and bank transactions
- Optional args
- options (boolean)
- if true gets options data
- stocks (boolean)
- banking (boolean)
- if true gets bank transactions data
- consume (boolean)
- if true returns all pages of data, else returns first page of data
- placeOptionOrder()
await api.placeOptionOrder('OPTION_URL_HERE', 1.0, 0.53)
await api.placeOptionOrder('OPTION_URL_HERE', 1.0, 0.53, { direction: 'debit', side: 'buy', positionEffect: 'open', legs: null })
- Places option order, returns order confirmation
- Required args
- option (string)
- quantity (int)
- price (Number)
- Optional args
- direction (string)
- side (string)
- positionEffect (string)
- legs (array)
- order legs, if not null, other args will be ignored and legs will be used instead
- cancelOptionOrder()
await api.cancelOptionOrder('CANCEL_URL_HERE')
- Cancels option order
- Required args
- replaceOptionOrder()
await api.replaceOptionOrder(1.0, 0.53, { orderId: 'ORDER_ID_HERE' })
- Replaces option order
- Required args
- quantity (int)
- price (Number)
- Optional args (must use order || orderId)
- order (dict)
- order object, information will be extracted from order object to replace order
- orderId (string)
- will get data from order id to replace order