get_prices: Grab daily prices and price returns for the previous two...

Description Usage Arguments Details Value See Also Examples

Description

get_prices grabs price-related data for a given data frame of companies and returns a matrix-like object containing relevant price data.

Usage

1
get_prices(companies = qmjdata::companies)

Arguments

companies

A data frame of company names and tickers.

Details

get_prices is also able to write .RData files to the user's temporary directory. If canceled partway through, the function is able to find and re-read this data to resume progress. Once complete, the function deletes all used temporary data.

Parameter defaults to provided data set of companies if empty.

Value

A matrix-like object containing relevant price data. The rows of the matrix are dates in the international standard of YYYY-MM-DD. Each column specifies what data it covers in the form of TICKER.DATA, with the exception of price returns, which are stored as pret.#, where # refers to the the i-th company given.

The first company calculated is always the S&P 500, and its price return column is simply 'pret'.

See Also

get_info

clean_downloads

tidy_prices

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Not run: 

## If no data frame is provided,
## the default is the package's
## companies data set.

get_prices()

## If we want to get information
## for a specific data frame of
## companies, called comps

get_prices(comps)

## If we then decide to quit the
## process partway through, and
## then resume downloading,
## the function usage is identical.

get_prices(comps)

## If we quit the process partway
## through, and then decide to clean
## the data to start from scratch.

clean_downloads(comps)
get_prices(comps)

## The raw price data is difficult
## to use, so we'll clean the data
## for future use.

price_data <- get_prices(comps)
prices <- tidy_prices(price_data)


## End(Not run)

anttsou/qmj documentation built on May 10, 2019, 12:28 p.m.