R Tutorial : Getting financial data

Learn to pull free financial data into R using the quantmod package and Yahoo Finance. GetSymbols fetches OHLCV data plus adjusted close prices for stocks and ETFs like SPY and LQD. The tutorial covers what each column means and how to access them with quantmod shortcuts.
Chapters
The first step in designing any trading system is to actually get financial data. While most financial data are priced at an institutional rate, there are some sources of free data of passable quality. The one we will use for this class is Yahoo Finance in R. The quantmod library has the Get Symbols command which will create an object in your working environment with the name of the financial asset you obtained. In this course we will be looking at ETFs Exchange traded funds an exchange traded fund is a basket of securities that aim to reflect a certain behavior. We will be looking at two ETFs in this course, LQD and Spy. LQD, representing a basket of investment grade corporate debt, will be covered in the course videos. Spy, an ETF that tracks the S&P 500, which is a basket of large companies, will be covered in the exercise. The data comes in a format with the following columns Open, High, Low, Close, Volume and Adjusted Prices the quantmod library has the following commands to access each of these OP for open, HI for high, LO for low, CL for close, VO for volume and AD for Adjusted. To understand what these terms mean, know that the US markets open at 9:30am Eastern Standard Time and close at 4:00pm the open is the price at which trading begins, the closing price is the last price that was traded, and the high and low are the maximum and minimum values that the asset reached over the course of the day, respectively. The volume details the number of shares traded and the adjusted close Is the close adjusted for dividends and splits? Dividends are a regular cash payout to the holder of the asset that is not reflected in the raw prices, and splits are when the price of an asset gets cut in half, but the number of shares are increased by 2, for instance. Furthermore, 1 can plot this data with the following code displayed in the following exercise. You will need to follow this process with a different asset.
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







