R Tutorial: Importing and Managing Financial Data in R | Intro

Joshua Ulrich, creator of R finance packages including quantmod, introduces getSymbols, a function that imports financial data from Yahoo Finance, FRED, OANDA, and other sources into XTS objects. The function takes a ticker symbol and data source as arguments, then returns or loads the data directly into your workspace.
Chapters
Hi and welcome to the DataCamp course on importing and managing financial data in R. My name is Joshua Ulrich and I'll be your guide throughout the course. A bit About Me I'm the creator or co author of several R packages including ttr, xts, quantmod, Blotter, and Quantstrap. I'm also on the R Finance Conference Organizing Committee and I founded the St. Louis User Group. This course will teach you how to import financial and economic data and manipulate it into a form suitable for analysis and modeling. Let's get started the first function I'd like to introduce you to is Git symbols from the quantmod package. Git Symbols provides a consistent interface to multiple data sources. Git Symbols is also extensible, so it's straightforward to add new data sources. By default, Git Symbols stores data in an XTS object, but it can use other classes as well. Get Symbols can also import data two ways. It can either return the data like a normal function, or you can create an object for you similar to what the load function in Base R does. Let's take a look at an example. The first argument to get symbols is symbols, which is how you specify the instrument you want to import. This may be a stock ticker symbol, an exchange rate, an economic data series, or some other identifier. Since you always specify a symbol, it's customary to omit the symbols argument from your call to git symbols. Another important argument is src or source, which tells getsymbols which data source to import the data from. The default data source is Yahoo, so you do not need to specify that argument if you want to import data from Yahoo Finance. In this course, we will only cover some of the data sources Gitsymbol supports, namely Yahoo Finance, Google Finance, the Federal Reserve Economic Data or FRED database provided by the St. Louis Federal Reserve bank and foreign exchange from OANDA.com and CSV files. Other git Symbols data sources include Yahoo Finance, Japan, mysql, SQLITE databases, RDATA files, and RDS files. As I mentioned earlier, Git symbols can import data two ways. The auto assign argument controls whether the data is returned or loaded. If auto assign is true, data will be loaded into your workspace. If autoassign is false, Git symbols will return the data and you will need to assign it to an object. Now that you've been formally introduced, it's time to practice using Git symbols.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







