RMetrics fBasics market data retrieval and timeSeries functionality still being maintained at all?
David-Michael Lincke wrote:
Is the functionality in the RMetrics fBasics package for market data retrieval and timeSeries object functionality still being maintained at all? A quick test of mine
What is your test ? --- useless if you don't tell us what you have done
showed that the Yahoo import functions don't work at all as they expect a different date format from what's being delivered.
This is wrong what you tell us. Have you read the help pages ? --- I think definitely not. yahooImport() is a function which delivers a web object of the download with many information which is helpful for downloading data on a regular time schedule and to store them in a database. Nota bene, there is a data slot which keeps the timeSeries object. For simply downloading a time series, you should use the function yahooSeries(). This delivers a 'timeSeries' object. Note, the download depends on the time format used by Yahoo. This has changed a few months ago, noticed on this mailing list. --- Therefore you should use a recent version of Rmetrics and you should also update your software on a regular base.
Specifically the following changes are necessary in lines 24 to 28 of
yahooImport:
x2 = strsplit(x1[regexpr("-..-..,", x1) > 0], ",")
x1 = matrix(unlist(x2), byrow = TRUE, nrow = length(x2))
z = matrix(as.numeric(x1[, -1]), ncol = dim(x1)[2] -
1)
rowNames = as.character(as.Date(x1[, 1]))
Once that hurdle is taken, however, it seems that all plotting functionality
on timeSeries objects is broken as well:
No, definitely not ...
Try ...
IBM = yahooSeries("IBM")
colnames(IBM)
par(mfrow = c(1,1))
plot(IBM[, "IBM.Open"], type = "l")
lines(IBM[, "IBM.Close"],col = "red")
Rmetrics has also many tailored plotting functions, plot is only
used for univariate timeSeries objects, multivariate timeSeries
objects can be displayed using the additional functions lines()
and points()!
plot.timeSeries(asyt.ts)
Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ
lines.timeSeries(asyt.ts)
Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ
ohlcDailyPlot(asyt.ts)
What is asyt.ts ? --- We can only help if you tell us what you have done ...
Error in plotOHLC(X, origin = "1970-01-01", xlab = xlab[1], ylab = ylab[1]) : x is not a open/high/low/close time series If this first experience is representative of the state of things with RMetrics then I'm not sure this is worth pursuing any further and I'm probably better off sticking with Matlab.
I wan't comment this ....
ohlcDailyPlot() expects a timeSeries object with column names c("Open",
"High", "Low", "Close", "Volume")
They can be in any order, but the names must be exactly the column names
mentioned.
Try:
colnames(IBM) <- c("Open", "High", "Low", "Close", "Volume")
par(mfrow = c(2, 1))
ohlcDailyPlot(IBM)
... it works fine!
Diethelm
David [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.