Questions tagged [quantmod]

quantmod is a package for R designed to assist quantitative traders in the development, testing, and deployment of statistically based trading models.

quantmod is an package for quantitative financial modelling and trading framework. The package is designed to assist quantitative traders in the development, testing, and deployment of statistically based trading models.

Repositories

Other resources

Related tags

1182 questions
4
votes
4 answers

Access odd-named object returned by getSymbols

I'm downloading data from Yahoo using quantmod: > getSymbols("HNZ-A.TO") [1] "HNZ-A.TO" Warning message: In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : downloaded length 70893 != reported length 200 The file shows up in…
4
votes
4 answers

Calculate cumulatve growth/drawdown from local min/max

I'm learning R (and its application to trading tasks via quantmod lib) and looking through the community pretty regularly to get a lot of new knowledge and tricks from here. My impression about R in general and quantmod lib in particular - it's…
UncleKo
  • 61
  • 2
  • 7
4
votes
1 answer

getSymbols (quantmod) giving wrong dates

I'm using the quantmod package to fetch stock data. The code Data = getSymbols('LON:ADN',src="google",auto.assign=FALSE, from = '2011-08-10') Results in an xts as expected, however on closer examination it shows a volume of trades for 2012-10-21…
N. McA.
  • 4,796
  • 4
  • 35
  • 60
4
votes
1 answer

Calculate Returns of xts object with multiple columns

What is the most straight forward way to calculate the returns of an (n x m) xts object? When I feed an (n x m) xts object mxts into the quantmod function dailyReturn, the return value is an (n x 1) vector, representing the returns of the first…
Julian
  • 1,573
  • 2
  • 22
  • 36
4
votes
3 answers

Merge getSymbols result into one xts object

I have the following code: library(quantmod) tckrs <- c("TLT", "LQD", "HYG", "SPY", "DBC") NumTckrs <- length(tckrs) getSymbols(tckrs, from="1900-01-01", to=Sys.Date()) # merge to allign the start dates MainDF <- merge(Ad(TLT), Ad(LQD), Ad(HYG),…
4
votes
2 answers

R support resistance levels as probability distribution

TTR has some excellent TA indicators. Is there a package or function that calculates and charts different types of Support and resistance levels? Preferably a probability distribution for the likely support and resistance levels
adam.888
  • 7,686
  • 17
  • 70
  • 105
4
votes
1 answer

How to apply rolling quantiles to an xts timeseries in R?

I have the following data which is a timeseries of data points (see dput() output below for reproducible series). data 2012-03-13 0.0099809886 2012-03-14 -0.0011633318 2012-03-15 0.0021057557 2012-03-16 -0.0039516504 2012-03-19…
n.e.w
  • 1,128
  • 10
  • 23
3
votes
2 answers

plotting SPX vs. VIX using quantmod in R

I just got introduced to quantmod, and looked at examples here http://www.r-chart.com/2010/06/stock-analysis-using-r.html I tried the following code, getSymbols(c("^GSPC","^VIX")) head(as.xts(merge(GSPC,VIX))) chartSeries(c(GSPC, VIX), subset='last…
user1155299
  • 877
  • 5
  • 20
  • 29
3
votes
1 answer

write a function that can retrieve only n period of data in R

Working with a set of sample data like below: library(quantmod) ticker<-"AAPL" start_date <- as.Date("2020-01-01") end_date <- as.Date("2021-01-01") getSymbols("AAPL", from=start_date, to=end_date) data<-AAPL$AAPL.Adjusted Say if I only need the…
Bubbles
  • 455
  • 2
  • 8
3
votes
2 answers

Rollapply & xts. Can I output the time of max value in the window?

I'm studying some yahoo finance data via quantmod. How would I determine not only the Max and Min price over a rolling window of data, but also the exact Timestamp of those highs and lows? I have tried which.max() with rollapply but this only…
Minkymorgan
  • 479
  • 4
  • 9
3
votes
2 answers

Aggregating daily data using quantmod 'to.weekly' function creates weekly data ending on Monday not Friday

I am trying to aggregate daily share price data (close only) to weekly share price data using the "to.weekly" function in quantmod. The xts object foo holds daily share price data for a stock starting from Monday 3 January 2011 and ending on Monday…
SlowLearner
  • 7,907
  • 11
  • 49
  • 80
3
votes
1 answer

Cannot display opening price data from yahoo using quantmod

getSymbols("2222.SR") [1] "2222.SR" OPEN1<-Op(2222.SR) Error: unexpected symbol in "OPEN1<-Op(2222.SR" I was expecting R to give me the opening price but for some reason it's giving me this error although it was able to fetch that data from yahoo.…
BubaZeed
  • 31
  • 2
3
votes
1 answer

quantmod 3d graphics

I am trying to use the code on the quantmod website for a 3d graph. I followed the instructions and entered the year as 2010 (since 2008 link was not found). However, when I enter this command at the R prompt: chartSeries3d0(TR) I get the…
itcplpl
  • 780
  • 4
  • 18
  • 29
3
votes
2 answers

Where do I find exact links to SEC XBRL financial data in order to download them into R?

I would love to analyze balance sheets and income statements using R. I have come across package finstr. There is an example of downloading AAPL stock data using this link accessing the XBRL data. I would like to ask, how do I actually find out the…
jnpll
  • 31
  • 2
3
votes
1 answer

Understanding the codes downloaded by quantmod with getOptionChain

I have a difficulty understanding the ouput of quantmod when using the function getOptionChain. For a reproducible example: library(quantmod) AAPL.2015 <- getOptionChain("AAPL", "2019/2021") A truncated part of the output: .... The Options that…
user8270077
  • 4,621
  • 17
  • 75
  • 140