Aan de slagGa gratis aan de slag

Find stock ticker from Yahoo Finance

You need the instrument identifier to import data from an internet data source. They can often be found on the data source website. In this exercise, you will search Yahoo Finance for the ticker symbol for Pfizer stock.

Note that some sources may not provide data for certain symbols, even if you can see the data displayed on their website in tables and/or charts. getSymbols() will error if the data is not available for download.

Deze oefening maakt deel uit van de cursus

Importing and Managing Financial Data in R

Cursus bekijken

Oefeninstructies

  • Create an object called symbol from the three-letter Yahoo Finance ticker symbol for Pfizer stock. To find the symbol, go to Yahoo Finance and search for "Pfizer". Note that there are two parts to this ticker. We only need what comes before the period (the period and suffix specify other exchanges).
  • Use getSymbols() to import the data.
  • Use the head() function to view the first few rows of the object created by getSymbols().

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Create an object containing the Pfizer ticker symbol
symbol <- "___"

# Use getSymbols to import the data for 'symbol'


# Look at the data in the object getSymbols created
Code bewerken en uitvoeren