5

Your prayers were heard ;-) The following article gives you all you need, especially the function getOptionQuote() which lets you download option chains for any ticker symbol with one line of code! You find the article here (with full R code): https://mktstk.wordpress.com/2014/12/29/start-trading-like-a-quant-download-option-chains-from-google-finance-in-r/...


3

Have you checked the performance of the particular stocks? library("quantmod") library("PMwR") cmp <- "AAPL" aapl <- getSymbols(Symbols = cmp, auto.assign = FALSE)$AAPL.Adjusted cmp <- "FB" fb <- getSymbols(Symbols = cmp, auto.assign = FALSE)$FB.Adjusted returns(window(merge(aapl, fb), start = as.Date("2015-1-1")), period = "itd") ## ...


3

Well, it wasn't easy because you didn't mentioned how your data is formatted. I create my own data.frame() basing on data you provided. You can skip this part if your data.frame is ready. Here's code I used to create a dataframe: > #given dates > dates=c("2000-1-3","2000-1-4","2000-1-5","2000-1-6","2000-1-7","2000-1-10","2000-1-11") > #formating ...


3

There is no such thing as "free" option data. This is free -->http://www.nasdaq.com/symbol/aapl/option-chain You could crawl that. But to get the actual ticks or intraday data, you will unfortunately have to pay. I strongly suggest you find a college business program that has option data ticks and reach out to them. Best of luck, JL


2

You cannot add a date column to an object returned by getSymbols or get.hist.quote. These function return matrices. Matrices can only store data of the same type, in this case the matrices contain double values (real numbers). You can add a column of class Date to the objects if you transform them into a data frame: For getSymbols: library(quantmod) ...


2

periodicity calls: p <- median(diff(.index(x))) if (is.na(p)) stop("can not calculate periodicity of 1 observation") p can be NA if x has 1 observation, or if you have missing values in your index (because there's no na.rm=TRUE in the median call. > xx <- xts(1:10, as.POSIXct(c(1:5,NA,7:10),origin='1970-01-01')) > periodicity(xx) Error in ...


2

Speaking about portfolio optimization in general, historical data is required to estimate the variance-covariance matrix that gives you the volatilities of the stock returns and the covariances thereof. The estimation depends on the periodicity of your returns, i.e. whether you are using intraday, daily, weekly, or monthly returns. (For intraday/daily ...


2

I don't have perfect solution for above problem, I but can help you out with the alternative. As far as my information you can't download the data country wise. I was also looking for the same. You should have all the symbols first in place. I have prepared a small code which loop through the all available symbols and get historical data from Yahoo. library(...


2

Please check whether this has what you are looking for: https://fred.stlouisfed.org/categories Each category is available for bulk download.


2

When writing getSymbols(ticker) the function is creating an xts object in the global env named by the ticker. In the first iteration, when i = 1, ticker is a character, "AAMC". Next, when you are trying to get the monthly returns for that newly created xts object, monthlyReturn(ticker, subset='2017-11-10') you are referencing the character, not the newly ...


1

It turns out the answer is quite simple! I just needed to adjust the "lapply" function correctly such that: QuarterlyReturns <- lapply(Prices, quarterlyReturn, USE.NAMES = TRUE) Now the calculation works perfectly fine.


1

I'll be using tidyquant version 0.3.0 to answer this question, which changes from x_fun to ohlc_fun in tq_mutate and tq_transform and adds the new col_rename argument to solve situations like yours with non-intuitive column names. Part 1: How do I transform the Closing stock prices to weekly? You are using the periodReturns function from quantmod, and you ...


1

I agree with everything dnl said. This time period choice can get very involved. You are explicitly choosing an historical period that you think will be repeated in the future. Unfortunately, history does not repeat exactly. There is an old saying, all models are wrong, but some are useful. There is no right answer for the period. Should you include just a ...


1

Your premise that there should be no data is incorrect. The foreign exchange market is an over-the-counter market, so there is no official definition of a trading day and the market never officially closes. The fact that you see some data on weekends is because OANDA never stops collecting data. There is nothing to prevent any of the parties who report ...


1

The following answers the initial question: To get a comprehensive list of all data series on FRED you can leverage the FRED API, and in particular the following calls: /category /category/children /category/series You can start with the root category (id = 0) and traverse the category tree for the metadata including the series symbols.


1

I do not know any free sources. One of the cheapest commercial is http://eoddata.com/products/default.aspx


Only top voted, non community-wiki answers of a minimum length are eligible