Learn R Programming

schwabr (version 0.1.3)

schwab_priceQuote: Get Quotes for specified tickers in List form

Description

Enter tickers for real time or delayed quotes returned as a list

Usage

schwab_priceQuote(
  tickers = c("AAPL", "MSFT"),
  output = "df",
  accessTokenList = NULL
)

Value

a list or data frame with quote details for each valid ticker submitted

Arguments

tickers

One or more tickers

output

indication on whether the data should be returned as a list or df. The default is 'df' for data frame, anything else would be a list.

accessTokenList

A valid Access Token must be set using the output from schwab_auth3_accessToken. The most recent Access Token will be used by default unless one is manually passed into the function.

Details

Quotes may be delayed depending on agreement with Schwab. If the account is set up for real-time quotes then this will return real-time. Otherwise the quotes will be delayed.

Examples

Run this code
if (FALSE) {

# Get stored refresh token
refreshToken = readRDS('/secure/location/')

# generate a new access token
accessToken = schwab_auth_accessToken('consumerKey', refreshToken)

# Pass one or more tickers as a vector
# accessToken is optional once it is set
quoteSPY = schwab_priceQuote('SPY')
quoteList = schwab_priceQuote(c('GOOG','TSLA'), output = 'list', accessToken)

}

Run the code above in your browser using DataLab