Get startedGet started for free

Finding data from internet sources

1. Finding data from internet sources

Now that you've learned the basics of importing data using getSymbols(), a wealth of historical time-series data are just a few keystrokes away! You just need to know the symbol for the data series you want to import. This video will show you how to search for symbols for the most common data sources: Yahoo Finance, Google Finance, FRED, and Oanda.

2. Yahoo Finance

Let's start by looking for the Dow Jones Industrial Average index on Yahoo Finance. From the Yahoo Finance homepage, enter your search terms and then click the search button. In this case, you're taken directly to the quote page, and you can see that the symbol is "^DJI". Yahoo Finance uses the circumflex prefix to indicate a symbol is for an index. This is the symbol you pass to getSymbols(). Don't worry that R object names can't start with a circumflex. getSymbols() will take care of that for you. Before going back to your R prompt, you should take a moment to verify whether Yahoo Finance actually provides historical data for this symbol. Click the historical data link, and make sure there's a download data link on the historical data page. Sometimes providers may display data but not provide a download link, in which case getSymbols() will not be able to import the data.

3. Google Finance

Now let's look for the same data on Google Finance. As with Yahoo Finance, you enter your search terms and click the search button. Again, you're taken directly to the quote page, where you can see the symbol is ".DJI". But when you click the link for historical data, you'll notice there's no link to download the data. That's because Google Finance doesn't make these data available for download, which means getSymbols() will not import it.

4. Oanda

Let's try to find some exchange rate data. Oanda.com makes this easy. You just navigate to their currency converter and select the base currency and the quote currency. For example, if your base currency is the US Dollar, and you want to know how many Japanese Yen you can get with one dollar, you would use the symbol "USD/JPY". Like with "^DJI", "USD/JPY" isn't a valid R name, so getSymbols() removes the forward slash.

5. FRED

Now let's try to find the US Dollar to Japanese Yen exchange rate on FRED. From the FRED homepage, enter your search terms in the search box and click the search button. Note that FRED provides a different series ID for the different frequencies of the same series. For example, the series ID for daily dollar-yen data is "DEXJPUS", while the series ID for the monthly frequency is "EXJPUS", and the series ID for the yearly frequency is "AEXJPUS".

6. Let's practice!

Now that you've seen a few examples of how to find instrument symbols, it's your turn to find some and import their data in the exercises.