An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120618/58ca4b76/attachment.pl>
xts objects and speed
13 messages · E D, michael.weylandt at gmail.com (R. Michael Weylandt, Brian G. Peterson +3 more
If I understand you, it might take a little jerry-rigging (sp?) but I think you could use the to.period() functions and pull out the "High"s and "Low"s. Hope this gets you going in the right direction, Michael
On Jun 18, 2012, at 9:40 PM, E D <e065c8515d206cb0e190 at gmail.com> wrote:
Hi everyone, I'm trying to use R to do some analysis of intraday data. Currently I have quotes for one symbol (every 1 min, from 930am to 4pm) and about a month and a half of data, and I'm computing things such as the trailing 1 hour and 3 hour maximums and minimums for that ticker. I'm making use of commands such as max(last(myXTS[1:t],'3 hours')) for every t, and I'm finding it rather slow as it takes about 60s to run for 12500 observations on a modern workstation. Am I making improper or unoptimized use of the xts functions? Could someone give me a few points to speed up that kind of calculation? (If the answer is "I know this great time series library in C"... that's ok.) Thanks in advance. ED [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
On 06/18/2012 09:40 PM, E D wrote:
Hi everyone, I'm trying to use R to do some analysis of intraday data. Currently I have quotes for one symbol (every 1 min, from 930am to 4pm) and about a month and a half of data, and I'm computing things such as the trailing 1 hour and 3 hour maximums and minimums for that ticker. I'm making use of commands such as max(last(myXTS[1:t],'3 hours')) for every t, and I'm finding it rather slow as it takes about 60s to run for 12500 observations on a modern workstation. Am I making improper or unoptimized use of the xts functions? Could someone give me a few points to speed up that kind of calculation? (If the answer is "I know this great time series library in C"... that's ok.) Thanks in advance.
You didn't provide a reproducible example, so you run the risk
Your email suggests that you are doing something like:
for (t in 180:nrow(myXTS)) {
out<-max(last(myXTS[1:t],'3 hours'))
}
which will indeed be painfully slow.
In the hopes of eliciting a little more detail, here's a reproducible
example...
#######################
# on a very slow web browsing desktop at home
# (as opposed to a 'modern workstation'
# on which I do real work):
require(TTR)
#?runMax
# construct a one-minute index
idx<-seq.POSIXt(from=as.POSIXct('2012-05-01'),
to=as.POSIXct('2012-06-18'),by='min')
# construct a fake time series
myXTS<-xts(cumsum(rnorm(length(idx))),order.by=idx)
myXTS<-myXTS['T09:30/T16:00'] #subset by time
outs<-vector(length=nrow(myXTS))
system.time(
for (t in 180:nrow(myXTS)) {
outs[t]<-max(last(myXTS[1:t],'3 hours'))
}
)
# user system elapsed
# 127.092 0.020 127.137
system.time(
outf<-runMax(myXTS,180)
)
# user system elapsed
# 0.032 0.000 0.032
######################
Cheers,
- Brian
Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
1 day later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120620/98ae6741/attachment.pl>
Hi I was looking for PortfolioAnalytics package zip but could not find it on the web. Can you please help on that Thank you
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120621/8bde2510/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120621/2b52ed9a/attachment.pl>
Precisely what do you mean by "the SVN is not working?" When you read the thread that Julien provided, did you follow this link that I provided in that thread? http://stackoverflow.com/questions/11105131/cannot-install-r-forge-package-using-install-packages R-Forge does not build packages for old versions of R. You have to build it yourself. If it really is an SVN problem, then R-sig-finance is not the best place to ask. HTH, Garrett On Thu, Jun 21, 2012 at 7:21 AM, Pierre-Alexandr des Mazis
<p.desmazis at gmail.com> wrote:
The SVN is not working on my side. Do you think I could find any Orr package zip for R 2.12? I am not very familiar with the building process . Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 12:04, julien cuisinier <j_cuisinier at hotmail.com> wrote:
Please do some research before posting: http://r.789695.n4.nabble.com/Where-to-obtain-version-of-PortfolioAnalytics-package-installable-on-R-2-15-td4633724.html Same comment would be valid for Juan's post yesterday asking about the RExcel, half a minute googling would have told him how to extract a tar.gz file, even on Windows seems there have been some issues with the build as Garret mentioned, you might have to build it yourself. If you do please share with the list Rgds, Julien
From: p.desmazis at gmail.com Date: Thu, 21 Jun 2012 11:42:09 +0100 To: r-sig-finance at r-project.org Subject: [R-SIG-Finance] PortfolioAnalytics Hi I was looking for PortfolioAnalytics package zip but could not find it on the web. Can you please help on that Thank you
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Hi I used SVN with Cygwin to checkout the project but host name could not be "reached". Regards Pierre-Alexandre des Mazis + 447 779 171 499
On 21 Jun 2012, at 13:59, G See <gsee000 at gmail.com> wrote:
Precisely what do you mean by "the SVN is not working?" When you read the thread that Julien provided, did you follow this link that I provided in that thread? http://stackoverflow.com/questions/11105131/cannot-install-r-forge-package-using-install-packages R-Forge does not build packages for old versions of R. You have to build it yourself. If it really is an SVN problem, then R-sig-finance is not the best place to ask. HTH, Garrett On Thu, Jun 21, 2012 at 7:21 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
The SVN is not working on my side. Do you think I could find any Orr package zip for R 2.12? I am not very familiar with the building process . Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 12:04, julien cuisinier <j_cuisinier at hotmail.com> wrote:
Please do some research before posting: http://r.789695.n4.nabble.com/Where-to-obtain-version-of-PortfolioAnalytics-package-installable-on-R-2-15-td4633724.html Same comment would be valid for Juan's post yesterday asking about the RExcel, half a minute googling would have told him how to extract a tar.gz file, even on Windows seems there have been some issues with the build as Garret mentioned, you might have to build it yourself. If you do please share with the list Rgds, Julien
From: p.desmazis at gmail.com Date: Thu, 21 Jun 2012 11:42:09 +0100 To: r-sig-finance at r-project.org Subject: [R-SIG-Finance] PortfolioAnalytics Hi I was looking for PortfolioAnalytics package zip but could not find it on the web. Can you please help on that Thank you
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
I suggest that when you take this up on a Cygwin SVN list you show *exactly* what commands you entered, and *exactly* what errors you saw. Or, you could just use TortoiseSVN. On Thu, Jun 21, 2012 at 8:19 AM, Pierre-Alexandr des Mazis
<p.desmazis at gmail.com> wrote:
Hi I used SVN with Cygwin to checkout the project but host name could not be "reached". Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 13:59, G See <gsee000 at gmail.com> wrote:
Precisely what do you mean by "the SVN is not working?" ?When you read the thread that Julien provided, did you follow this link that I provided in that thread? http://stackoverflow.com/questions/11105131/cannot-install-r-forge-package-using-install-packages R-Forge does not build packages for old versions of R. ?You have to build it yourself. If it really is an SVN problem, then R-sig-finance is not the best place to ask. HTH, Garrett On Thu, Jun 21, 2012 at 7:21 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
The SVN is not working on my side. Do you think I could find any Orr package zip for R 2.12? I am not very familiar with the building process . Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 12:04, julien cuisinier <j_cuisinier at hotmail.com> wrote:
Please do some research before posting: http://r.789695.n4.nabble.com/Where-to-obtain-version-of-PortfolioAnalytics-package-installable-on-R-2-15-td4633724.html Same comment would be valid for Juan's post yesterday asking about the RExcel, half a minute googling would have told him how to extract a tar.gz file, even on Windows seems there have been some issues with the build as Garret mentioned, you might have to build it yourself. If you do please share with the list Rgds, Julien
From: p.desmazis at gmail.com Date: Thu, 21 Jun 2012 11:42:09 +0100 To: r-sig-finance at r-project.org Subject: [R-SIG-Finance] PortfolioAnalytics Hi I was looking for PortfolioAnalytics package zip but could not find it on the web. Can you please help on that Thank you
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
G, I was just wondering if there is any alternative solution to the r-forge website. I must admit I am not too sure about how to build a package. I will code my own script to do the job. Thanks anyway Regards, Pierre-Alexandre des Mazis + 447 779 171 499
On 21 Jun 2012, at 15:13, G See <gsee000 at gmail.com> wrote:
I suggest that when you take this up on a Cygwin SVN list you show *exactly* what commands you entered, and *exactly* what errors you saw. Or, you could just use TortoiseSVN. On Thu, Jun 21, 2012 at 8:19 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
Hi I used SVN with Cygwin to checkout the project but host name could not be "reached". Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 13:59, G See <gsee000 at gmail.com> wrote:
Precisely what do you mean by "the SVN is not working?" When you read the thread that Julien provided, did you follow this link that I provided in that thread? http://stackoverflow.com/questions/11105131/cannot-install-r-forge-package-using-install-packages R-Forge does not build packages for old versions of R. You have to build it yourself. If it really is an SVN problem, then R-sig-finance is not the best place to ask. HTH, Garrett On Thu, Jun 21, 2012 at 7:21 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
The SVN is not working on my side. Do you think I could find any Orr package zip for R 2.12? I am not very familiar with the building process . Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 12:04, julien cuisinier <j_cuisinier at hotmail.com> wrote:
Please do some research before posting: http://r.789695.n4.nabble.com/Where-to-obtain-version-of-PortfolioAnalytics-package-installable-on-R-2-15-td4633724.html Same comment would be valid for Juan's post yesterday asking about the RExcel, half a minute googling would have told him how to extract a tar.gz file, even on Windows seems there have been some issues with the build as Garret mentioned, you might have to build it yourself. If you do please share with the list Rgds, Julien
From: p.desmazis at gmail.com Date: Thu, 21 Jun 2012 11:42:09 +0100 To: r-sig-finance at r-project.org Subject: [R-SIG-Finance] PortfolioAnalytics Hi I was looking for PortfolioAnalytics package zip but could not find it on the web. Can you please help on that Thank you
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
The alternative to the r-forge *website* is SVN. If you're going to try to source files instead of building the package, you're on your own. I guess you could browse through the repository here, https://r-forge.r-project.org/scm/viewvc.php/pkg/PortfolioAnalytics/?root=returnanalytics, and click the "download" link for files you're interested in. For example, suppose you want the "charts.DE.R" file. You can browse to it, and click the download link which will bring you here http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/PortfolioAnalytics/R/charts.DE.R?root=returnanalytics You can source that directly source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/PortfolioAnalytics/R/charts.DE.R?root=returnanalytics") (You may have to replace https with http in the link) Gooood luck with that, Garrett On Thu, Jun 21, 2012 at 11:25 AM, Pierre-Alexandr des Mazis
<p.desmazis at gmail.com> wrote:
G, I was just wondering if there is any alternative solution to the r-forge website. I must admit I am not too sure about how to build a package. I will code my own script to do the job. Thanks anyway Regards, Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 15:13, G See <gsee000 at gmail.com> wrote:
I suggest that when you take this up on a Cygwin SVN list you show *exactly* what commands you entered, and *exactly* what errors you saw. Or, you could just use TortoiseSVN. On Thu, Jun 21, 2012 at 8:19 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
Hi I used SVN with Cygwin to checkout the project but host name could not be "reached". Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 13:59, G See <gsee000 at gmail.com> wrote:
Precisely what do you mean by "the SVN is not working?" ?When you read the thread that Julien provided, did you follow this link that I provided in that thread? http://stackoverflow.com/questions/11105131/cannot-install-r-forge-package-using-install-packages R-Forge does not build packages for old versions of R. ?You have to build it yourself. If it really is an SVN problem, then R-sig-finance is not the best place to ask. HTH, Garrett On Thu, Jun 21, 2012 at 7:21 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
The SVN is not working on my side. Do you think I could find any Orr package zip for R 2.12? I am not very familiar with the building process . Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 12:04, julien cuisinier <j_cuisinier at hotmail.com> wrote:
Please do some research before posting: http://r.789695.n4.nabble.com/Where-to-obtain-version-of-PortfolioAnalytics-package-installable-on-R-2-15-td4633724.html Same comment would be valid for Juan's post yesterday asking about the RExcel, half a minute googling would have told him how to extract a tar.gz file, even on Windows seems there have been some issues with the build as Garret mentioned, you might have to build it yourself. If you do please share with the list Rgds, Julien
From: p.desmazis at gmail.com Date: Thu, 21 Jun 2012 11:42:09 +0100 To: r-sig-finance at r-project.org Subject: [R-SIG-Finance] PortfolioAnalytics Hi I was looking for PortfolioAnalytics package zip but could not find it on the web. Can you please help on that Thank you
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Thank you very much G see I will dig into the subject once home and hopefully will be able to find a solution. regards Pierre-Alexandre des Mazis + 447 779 171 499
On 21 Jun 2012, at 17:50, G See <gsee000 at gmail.com> wrote:
The alternative to the r-forge *website* is SVN. If you're going to try to source files instead of building the package, you're on your own. I guess you could browse through the repository here, https://r-forge.r-project.org/scm/viewvc.php/pkg/PortfolioAnalytics/?root=returnanalytics, and click the "download" link for files you're interested in. For example, suppose you want the "charts.DE.R" file. You can browse to it, and click the download link which will bring you here http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/PortfolioAnalytics/R/charts.DE.R?root=returnanalytics You can source that directly source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/PortfolioAnalytics/R/charts.DE.R?root=returnanalytics") (You may have to replace https with http in the link) Gooood luck with that, Garrett On Thu, Jun 21, 2012 at 11:25 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
G, I was just wondering if there is any alternative solution to the r-forge website. I must admit I am not too sure about how to build a package. I will code my own script to do the job. Thanks anyway Regards, Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 15:13, G See <gsee000 at gmail.com> wrote:
I suggest that when you take this up on a Cygwin SVN list you show *exactly* what commands you entered, and *exactly* what errors you saw. Or, you could just use TortoiseSVN. On Thu, Jun 21, 2012 at 8:19 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
Hi I used SVN with Cygwin to checkout the project but host name could not be "reached". Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 13:59, G See <gsee000 at gmail.com> wrote:
Precisely what do you mean by "the SVN is not working?" When you read the thread that Julien provided, did you follow this link that I provided in that thread? http://stackoverflow.com/questions/11105131/cannot-install-r-forge-package-using-install-packages R-Forge does not build packages for old versions of R. You have to build it yourself. If it really is an SVN problem, then R-sig-finance is not the best place to ask. HTH, Garrett On Thu, Jun 21, 2012 at 7:21 AM, Pierre-Alexandr des Mazis <p.desmazis at gmail.com> wrote:
The SVN is not working on my side. Do you think I could find any Orr package zip for R 2.12? I am not very familiar with the building process . Regards Pierre-Alexandre des Mazis + 447 779 171 499 On 21 Jun 2012, at 12:04, julien cuisinier <j_cuisinier at hotmail.com> wrote:
Please do some research before posting: http://r.789695.n4.nabble.com/Where-to-obtain-version-of-PortfolioAnalytics-package-installable-on-R-2-15-td4633724.html Same comment would be valid for Juan's post yesterday asking about the RExcel, half a minute googling would have told him how to extract a tar.gz file, even on Windows seems there have been some issues with the build as Garret mentioned, you might have to build it yourself. If you do please share with the list Rgds, Julien
From: p.desmazis at gmail.com Date: Thu, 21 Jun 2012 11:42:09 +0100 To: r-sig-finance at r-project.org Subject: [R-SIG-Finance] PortfolioAnalytics Hi I was looking for PortfolioAnalytics package zip but could not find it on the web. Can you please help on that Thank you
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.