Learn R Programming

fastquant (version 0.1.2)

get_stock_data: Returns pricing data for a specified stock

Description

Returns pricing data for a specified stock

Usage

get_stock_data(symbol, start_date, end_date)

Arguments

symbol

A string indicating the symbol of the stock in the PSE and Yahoo Finance. For more details, you can refer to this link.

start_date

A string indicating a date in the YYYY-mm-dd format, serves as the start date of the period to get stock data

end_date

A string indicating a date in the YYYY-mm-dd format, serves as the end date of the period to get stock data

Value

A tibble, with the following columns:

  • symbol: The ticker symbol of the stock

  • dt: The date for the closing price of the stock

  • name: The name of the company represented by the stock ticker

  • currency: The currency of the closing price of the stock

  • close: The closing price of the stock at the given date, dt

  • percent_change: The percentage day change of the stock

  • volume: The total value of shares traded of the stock at dt

Examples

Run this code
# NOT RUN {
  get_stock_data("JFC", "2019-01-03", "2019-02-01") # PSE data
  get_stock_data("MSFT", "2019-01-03", "2019-02-01") # US data
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab