Processing and Analyzing Financial Data with R by Marcelo S. Perlin
Author:Marcelo S. Perlin [S. Perlin, Marcelo]
Language: eng
Format: azw3
Published: 2017-05-01T04:00:00+00:00
## ticker src download.status total.obs ## 1 MSFT yahoo OK 21 ## 2 GOOGL yahoo OK 21 ## 3 JPM yahoo OK 21 ## 4 GE yahoo OK 21 ## perc.benchmark.dates threshold.decision ## 1 1 KEEP ## 2 1 KEEP ## 3 1 KEEP ## 4 1 KEEP
Object df.control shows all tickers were valid, and we got 21 observations (rows) for each.
As for the actual financial data, it is contained in element df.tickers of l.out. Let's look:
# print df.tickers print(tail(l.out$df.tickers))
## price.open price.high price.low price.close volume ## 79 29.45 29.60 29.32 29.45 39764600 ## 80 29.52 29.55 29.26 29.26 36606000 ## 81 29.29 29.31 29.02 29.08 32777900 ## 82 29.10 29.16 28.93 28.99 23929100 ## 83 29.01 29.17 28.93 28.94 23695700 ## 84 29.01 29.05 28.91 28.99 31475900 ## price.adjusted ref.date ticker ## 79 29.45 2017-04-25 GE ## 80 29.26 2017-04-26 GE ## 81 29.08 2017-04-27 GE ## 82 28.99 2017-04-28 GE ## 83 28.94 2017-05-01 GE ## 84 28.99 2017-05-02 GE
As expected, the information about prices and volume is there. Notice it also includes a column, called ticker, containing the symbols of the stocks. Later, in chapter 9, we will use this column to make calculations for each stock in our dataset.
Another useful function of BatchGetSymbols is GetSP500Stocks, which imports the current composition of the SP500 index, including the tickers of the stocks. So, by using GetSP500Stocks and BatchGetSymbols together, you can easily download a large amount of stock data for the US market. Consider the following chunk of code, where we performed such operation:
library(BatchGetSymbols) # set tickers my.tickers <- GetSP500Stocks()$ticker # set dates first.date <- Sys.Date()-30 last.date <- Sys.Date() l.out <- BatchGetSymbols(tickers = my.tickers, first.date = first.date, last.date = last.date)
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8300)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6742)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6716)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6594)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6377)
Driving Data Quality with Data Contracts by Andrew Jones(6327)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6093)
Learning SQL by Alan Beaulieu(5995)
Weapons of Math Destruction by Cathy O'Neil(5779)
Big Data Analysis with Python by Ivan Marin(5363)
Data Engineering with dbt by Roberto Zagni(4361)
Solidity Programming Essentials by Ritesh Modi(4009)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3870)
Pandas Cookbook by Theodore Petrou(3578)
Blockchain Basics by Daniel Drescher(3294)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2905)
Feature Store for Machine Learning by Jayanth Kumar M J(2814)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2796)
Mastering Python for Finance by Unknown(2744)
