pyrh.Robinhood

class pyrh.Robinhood(username, password, mfa='', challenge_type='sms', headers=None, proxies=None, **kwargs)

Wrapper class for fetching/parsing Robinhood endpoints.

Please see pyrh.models.sessionmanager.SessionManager for login functionality.

Provides a global convenience wrapper for the following manager objects:

  • InstrumentManager

  • TODO: Add to this list

__init__(username, password, mfa='', challenge_type='sms', headers=None, proxies=None, **kwargs)

Methods

__init__(username, password[, mfa, ...])

adjusted_previous_close([stock])

Get adjusted previous closing price for a stock.

ask_price([stock])

Get asking price for a stock.

ask_size([stock])

Get ask size for a stock.

bid_price([stock])

Get bid price for a stock.

bid_size([stock])

Get bid size for a stock.

cancel_order(order_id)

Cancels specified order and returns the response.

dividends()

Wrapper for portfolios

fundamentals([stock])

Wrapper for get_fundamentlals function

get(url[, params, headers, raise_errors, ...])

Run a wrapped session HTTP GET request.

get_account()

Fetch account information.

get_fundamentals([stock])

Find stock fundamentals data

get_historical_quotes(stock, interval, span)

get_news(stock)

Fetch news endpoint.

get_open_orders()

Returns all currently open (cancellable) orders.

get_option_chainid(symbol)

get_option_marketdata(option_id)

get_option_quote(symbol, strike, expiry, otype)

get_options(stock, expiration_dates, option_type)

Get a list (chain) of options contracts belonging to a particular stock

get_popularity([stock])

Get the number of robinhood users who own the given stock

get_quote([stock])

Wrapper for quote_data.

get_quote_list([stock, key])

Returns multiple stock info and keys from quote_data (prompt if blank)

get_stock_marketdata(instruments)

get_tickers_by_tag([tag])

Get a list of instruments belonging to a tag

get_url(url)

Flat wrapper for fetching URL directly/

get_watchlists()

Fetch watchlists endpoint and queries for each instrumented result aka stock details returned from the watchlist

instrument([symbol, id_])

Get a single instrument using a provided query parameter.

instruments([query])

Get a generator of instruments.

investment_profile()

Fetch investment_profile.

last_trade_price([stock])

Get last trade price for a stock

last_updated_at([stock])

Get last update datetime.

last_updated_at_datetime([stock])

Get last updated datetime.

login([force_refresh])

Login to the session.

logout()

Logout from the session.

options_owned()

order_history([orderId])

Wrapper for portfolios

place_buy_order(instrument, quantity[, ...])

Wrapper for placing buy orders

place_limit_buy_order([instrument_URL, ...])

Wrapper for placing limit buy orders

place_limit_sell_order([instrument_URL, ...])

Wrapper for placing limit sell orders

place_market_buy_order([instrument_URL, ...])

Wrapper for placing market buy orders

place_market_sell_order([instrument_URL, ...])

Wrapper for placing market sell orders

place_order(instrument[, quantity, price, ...])

Place an order with Robinhood

place_sell_order(instrument, quantity[, ...])

Wrapper for placing sell orders

place_stop_limit_buy_order([instrument_URL, ...])

Wrapper for placing stop limit buy orders

place_stop_limit_sell_order([...])

Wrapper for placing stop limit sell orders

place_stop_loss_buy_order([instrument_URL, ...])

Wrapper for placing stop loss buy orders

place_stop_loss_sell_order([instrument_URL, ...])

Wrapper for placing stop loss sell orders

portfolio()

Returns the user's portfolio data

positions()

Returns the user's positions data

post(url[, data, headers, raise_errors, ...])

Run a wrapped session HTTP POST request.

previous_close([stock])

Get previous closing price for a stock.

previous_close_date([stock])

Get previous closing date for a stock.

print_quote([stock])

Print quote information.

print_quotes(stocks)

Print a collection of stocks.

quote_data([stock])

Fetch stock quote.

quotes_data(stocks)

Fetch quote for multiple stocks, in one single Robinhood API call.

securities_owned()

Returns list of securities' symbols that the user has shares in

submit_buy_order([instrument_URL, symbol, ...])

Submits buy order to Robinhood

submit_sell_order([instrument_URL, symbol, ...])

Submits order to Robinhood

symbol([stock])

Get symbol for a stock.

user()

Attributes

authenticated

Check if the session is authenticated.

login_set

Check if login info is properly configured.

token_expired

Check if the issued auth token has expired.