Re: [R-SIG-Finance] xtsExtra

2012-11-17 Thread Michael Weylandt
On Nov 17, 2012, at 11:53 PM, Eric Thungstom wrote: > Getting this message when I try to install xtsExtra. > >> install.packages('xtsExtra', source = "http://r-forge.r-project.org";) > Installing package(s) into ‘C:/PROGRA~1/R/R-212~1.0/library’ > (as ‘lib’ is unspecified) > Warning in install

Re: [R-SIG-Finance] Fundamental question about backtesting in quantstrat

2012-12-27 Thread Michael Weylandt
On Dec 28, 2012, at 5:17 AM, "Robert A'gata" wrote: > Hi, > > I would like to confirm my intuition about backtesting. My strategy is a > simple moving average crossing over (something similar). I open a long > position of 1 unit if fast line crosses above the slow one and vice versa. > After s

Re: [R-SIG-Finance] high frequency italian market data

2013-01-11 Thread Michael Weylandt
Intraday data usually requires a paid data subscription. Do you have any particular source in mind? MW On Jan 11, 2013, at 8:34 PM, "Simone Gogna" wrote: > Dear R users, > I hope this is not an already discussed topic. I tried with RSiteSearch(“high > frequency italian market data”) but I was

Re: [R-SIG-Finance] Return.portfolio() behaves differently in PerformanceAnalytics 1.0.5.2 vs 1.0.4.4?

2013-02-14 Thread Michael Weylandt
Moved to r-sig-fin. On Feb 15, 2013, at 6:43 AM, Aleksi Mattila wrote: > Dear R experts, > > After updating PerformanceAnalytics from 1.0.4.4. to 1.0.5.2 I have > encountered a following issue (reproducible example below). I am not quite > sure whether this is due to my sloppy coding (any hi

Re: [R-SIG-Finance] intraday historical data

2013-03-11 Thread Michael Weylandt
What exactly do you mean by end of day intraday? Regardless, I assume the answer is 'yes, many by subscription: some cheap: few free.' MW On Mar 11, 2013, at 22:26, Bill Blount wrote: > is there a source for end of day intraday data (i am assuming that yahoo is > daily only)? > > Thanks. Bi

Re: [R-SIG-Finance] quantStrat/blotter for R-3.0.0?

2013-04-25 Thread Michael Weylandt
On Apr 25, 2013, at 20:00, Mark Knecht wrote: > Hi, > Is there a good home page or Wiki for how folks are approaching > trading within R using quantStrat, TradeAnalytics, or something else? > > I'm working in RStudio/R-3.0-64-bit and am pretty much a putz when > it comes to R programming.

Re: [R-SIG-Finance] ts object

2013-05-30 Thread Michael Weylandt
To echo what Deo is saying, if the question is 'how to do X with ts objects' the answer is almost always going to be 'Use xts instead'. It's not quite a drop in for one or two things, but its basically always going to be better for whatever you may wish. M On May 30, 2013, at 15:34, Deo Jaisw

Re: [R-SIG-Finance] TTR package feature suggestion

2013-07-27 Thread Michael Weylandt
Take a look at runquantile from caTools. http://svitsrv25.epfl.ch/R-doc/library/caTools/html/runquantile.html Though I agree this would make sense in TTR as well... Michael On Jul 27, 2013, at 5:03, Andreas Voellenklee wrote: > Hi, > > first I would like to say thanks to the developer(s) of

Re: [R-SIG-Finance] Parma Package QP optimization Failing and Ignoring Leverage Constraint

2013-09-30 Thread Michael Weylandt
On Sep 30, 2013, at 17:52, Preston Li wrote: > if (!is.loaded('etfdata')) data(etfdata) Totally off topic: that doesn't do what you think it does. You're looking for exists() M ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mail

Re: [R-SIG-Finance] xts Correl on subset

2013-10-29 Thread Michael Weylandt
Something like: cor(tail(merge(ret.SPY, lag(ret.MDY)), 10)) would work. Merge your series into a single object, take the last ten obs (tail(x, 10)) and get the correlation matrix thereof. MW On Oct 29, 2013, at 7:49, "Martin Bauer" wrote: > hi, > > How can I calculate the correlation on

Re: [R-SIG-Finance] ploting time series

2013-11-26 Thread Michael Weylandt
If you are using my xtsExtra::plot.xts or Jeff's xts::plot.xts, the plot engine uses POSIXct (unix epoch seconds) to align the x-axis; that sometimes throws folks off. Take a look at xtsExtra::lines.xts for an example. Michael On Nov 24, 2013, at 18:05, fernando wrote: > Please, > I am ploti

Re: [R-SIG-Finance] Formely known Rbloomberg package

2014-01-27 Thread Michael Weylandt
On Jan 27, 2014, at 8:01, arnaud gaboury wrote: > On Mon, Jan 27, 2014 at 1:52 PM, Anil Bishnoie wrote: >> Hi All, >> As Blopen API,emul and rblapi etc. are very useful ,It will be gr8 >> if a VM be formed and stacked in pub domain for download for future >> testing/use. >> > Sorr

Re: [R-SIG-Finance] plz

2014-04-10 Thread Michael Weylandt
Not about finance. Please don't cross post. Michael On Apr 10, 2014, at 13:56, 장승욱 wrote: > > My data as follows. > group Y1 Y2...Y100 X1 X2 > A > A > > ... > A > B > B > > ... > > B > C > > ... > > Z > > > I want to run regression analysis. The model as follow > Y1A=a+b1*X1+b2*X

Re: [R-SIG-Finance] A question on Forward Price

2014-06-29 Thread Michael Weylandt
> On Jun 29, 2014, at 4:07 PM, Christofer Bogaso > wrote: > > Hi again, > > I would like ask a small question however not really related to R. > > We all know that non-arbitrage Forward price of any underlying (except > perhaps Interest Rate) is just the spot price plus the cost of carry. >

Re: [R-SIG-Finance] A question on Forward Price

2014-06-29 Thread Michael Weylandt
ort themselves out. > On Jun 29, 2014, at 5:09 PM, Christofer Bogaso > wrote: > > Ofcourse Electricity can not be stored or storage cost would be > extraordinarily high. Therefore it would have zero CY. I feel Power > prices should always be in contango > > On Mon, Jun 30, 2014 a

Re: [R-SIG-Finance] A question on Forward Price

2014-06-29 Thread Michael Weylandt
> On Jun 29, 2014, at 18:32, Christofer Bogaso > wrote: > > I defined backwardination as forward curve is downward sloping as > compared to spot. So you may term it as you said 'forward prices > increasing/decreasing'. I felt this is bit different than what you > said as 'difference between expe

Re: [R-SIG-Finance] Is there a general solution (package) for a portfolio optimization ?

2014-07-14 Thread Michael Weylandt
> On Jul 14, 2014, at 6:38, u0...@wolke7.net wrote: > > Dear R-SIGs, > > Is there anybody out there working with parma ? > It's a great package. > I can use parts of it, > but don't understand everything. > > Does anybody know the function of parameter "targetType" > in method "parmaspec()" ? >

Re: [R-SIG-Finance] Gold

2015-02-15 Thread Michael Weylandt
> On Feb 15, 2015, at 7:32 PM, Robert Sherry wrote: > > Thank you for your response. The symbol GLD is not really going to work > for me because it is my understanding how much gold GLF represents > varies over time. Therefore, > I thought I would use IKTrading. However, when I try installing

Re: [R-SIG-Finance] Problem in output of "countMonthlyRecords" in Package "timeSeries"

2015-03-28 Thread Michael Weylandt
If you have data from each trading day, something like quantmod::apply.monthly(x, NROW) might work. If your data is spotty, you need to tell us more about your data provider. As always, http://sscce.org is your friend. Michael > On Mar 27, 2015, at 1:39 PM, Pankaj K Agarwal via R-SIG-Financ

Re: [R-SIG-Finance] I know I should be able to figure this out...

2015-04-06 Thread Michael Weylandt
I think you're overthinking. Look at the auto.assign arg to getSymbols. for(x in tickers){ data <- getSymbols(x, auto.assign=FALSE) # Process `data` ... } Michael > On Apr 6, 2015, at 12:59 PM, Samuel Wilson wrote: > > As an experienced R Programmer, I should be able to figure this out

Re: [R-SIG-Finance] Monte Carlo Convergence test

2015-10-26 Thread Michael Weylandt
> On Oct 26, 2015, at 2:47, Amelia Marsh via R-SIG-Finance > wrote: > > Dear Forum, > > I have series of say 100 (say equity) instrument prices. From these prices, > for each of these 100 instruments, I generate returns using ln(current price > / previous price). > > Assuming originally I

Re: [R-SIG-Finance] Calculating trailing returns

2015-10-26 Thread Michael Weylandt
> On Oct 26, 2015, at 9:21, Am Gut wrote: > > Dear R Users, > > I am trying to calculate trailing month and annual returns with daily data. > The data is already in returns, and not in price. I have been looking for a > handy function to calculate trailing returns where I can specify the look >

Re: [R-SIG-Finance] Calculating trailing returns

2015-10-26 Thread Michael Weylandt
On Mon, Oct 26, 2015 at 9:53 AM, Am Gut wrote: > Good Morning Michael, > > I have simple return data, in a daily periodicity. I am essentially trying > to calculate the trailing returns for say 252 periods, assuming I am trying > to look at trailing 12 month returns. So I have been trying to use

Re: [R-SIG-Finance] Computing stop probability

2015-11-24 Thread Michael Weylandt
On Tue, Nov 24, 2015 at 6:31 PM, Nick White wrote: > You might want to check out the derivation of the Thorp / > Black-Scholes-Merton formula as it deals with essentially the same > concepts... > > On Wed, Nov 25, 2015 at 11:27 AM, Ernest Stokely > wrote: > >> Maybe a naive question but given the

Re: [R-SIG-Finance] Computing stop probability

2015-11-24 Thread Michael Weylandt
?rq=1 (though note there's a mistake in the latter) Hope this helps, Michael On Tue, Nov 24, 2015 at 7:23 PM, Michael Weylandt wrote: > On Tue, Nov 24, 2015 at 6:31 PM, Nick White wrote: >> You might want to check out the derivation of the Thorp / >> Black-Scholes-Merton

Re: [R-SIG-Finance] solnp Problem Inverting Hessian

2015-12-14 Thread Michael Weylandt
The Hessian is the matrix of second derivatives (https://en.wikipedia.org/wiki/Hessian_matrix) -- in scalar terms, you're finding a point where the second derivative is zero and then trying to divide by the second derivative to calculate the step size. I haven't gone through your code in any detai

Re: [R-SIG-Finance] solnp Problem Inverting Hessian

2015-12-14 Thread Michael Weylandt
the meaning of "comfortably," but I can create a > Cholesky decomposition without it blowing up, which is usually how I can tell > if I have done something stupid. Well, stupider than normal. > > -Original Message- > From: Michael Weylandt [mailto:michael.weyla...

Re: [R-SIG-Finance] solnp Problem Inverting Hessian

2015-12-14 Thread Michael Weylandt
14, 2015 at 10:10 PM, Michael Ashton wrote: > Well, not sure whether this makes any sense but kappa(cov.mat) gives me > 11148245007. > > That seems large. But I am not sure what it is supposed to be. > > -----Original Message- > From: Michael Weylandt [mailto:michae

Re: [R-SIG-Finance] How to suppress getSymbols error message

2015-12-29 Thread Michael Weylandt
You can use a sink(NULL) (R equivalent of >/dev/null) to suppress all output temporarily. As far as I know, there's no simple way to just catch this one cat(). On Tue, Dec 29, 2015 at 12:34 AM, George Kumar wrote: > Hi all, > > I am using getSymbols to with the following options: > > setDefaults

Re: [R-SIG-Finance] Forecasting with nnetar

2016-01-01 Thread Michael Weylandt
On Fri, Jan 1, 2016 at 2:41 AM, Evelyn Nyamadi via R-SIG-Finance wrote: > > Dear All, > Please, I would like to use the nnetar in the forecast package to do both in > sample and out of sample forecasting. > > But what is package does is not very clear to me. It gives you rather an > extrapolate

Re: [R-SIG-Finance] Formula used for EGARCH in "rugarch" package

2016-01-04 Thread Michael Weylandt
Take a look at Section 2.2.3 of the package vignette [1, 2]. Michael [1] https://cran.r-project.org/web/packages/rugarch/vignettes/Introduction_to_the_rugarch_package.pdf [2] https://bitbucket.org/alexiosg/rugarch/src/1bf0f673286b22124fe3a55dfd79d94b3169fb6b/vignettes/rugarch.tex?at=master&file

Re: [R-SIG-Finance] CVaR and Penalty Augmented objective function

2016-10-11 Thread Michael Weylandt
Hi Marco, Can you put together a minimal reproducible example [1,2] so that it's easier for others to answer your question? For this problem, I'd recommend using the edhec data distributed with PerformanceAnalytics. Thanks, Michael [1] http://stackoverflow.com/questions/5963269/how-to-make-a-g

Re: [R-SIG-Finance] CVaR and Penalty Augmented objective function

2016-10-13 Thread Michael Weylandt
>> >> #The value of the objective function is: >> *constrained_objective(w=rep(1/4,4), R=indexes, portfolio=myCVaRObjSpec) >> #* ES *0.1217594* >> >> #This should be the CVaR of the equal-weight portfolio as computed by the >> function ES in the P

Re: [R-SIG-Finance] How to add new data to be predicted with fGarch?

2016-11-01 Thread Michael Weylandt
I'm not sure what you're trying to do. What should the `newdata` argument be used for here? (The shocks/innovations, external regressors, etc.?) On Tue, Nov 1, 2016 at 4:57 AM, Be Water wrote: > ## R version 3.3.1 (2016-06-21) > ## Platform: x86_64-w64-mingw32/x64 (64-bit) > ## Running under: Win

Re: [R-SIG-Finance] fPortfolio minimum variance optimisation under constraints

2016-11-01 Thread Michael Weylandt
Hi Pierre, I'm willing to take a look, but could you format the data in a way that would make it a bit easier to use? The dput() function can produce a representation which is safe for emailing and can be read directly back into R. Cheers, Michael On Tue, Nov 1, 2016 at 4:19 AM, wrote: > > I

Re: [R-SIG-Finance] How to add new data to be predicted with fGarch?

2016-11-02 Thread Michael Weylandt
The fGARCH predict() method will do that with the n.ahead argument; no need to supply newdata. Try running > example('predict-methods', package="fGARCH") to see an example (with plots!). The standard ARMA and GARCH models don't need external data to make predictions: their predictions are made b

Re: [R-SIG-Finance] Continuous Wavelet tranform in Biwavelet Package

2016-11-04 Thread Michael Weylandt
Hi FMH, Perhaps you could set up a minimal reproducible example [1,2] to help us answer your question. Note that the biwavelet [sic] package has lots of examples that you can access. The most useful ones are probably found by running example(wt) and example(biwavelet) Cheers, Michael [1] ht

Re: [R-SIG-Finance] Continuous Wavelet tranform in Biwavelet Package

2016-11-08 Thread Michael Weylandt
ach(data) > > library(biwavelet) > dat <- cbind(1:length(data$Temp),data$Temp) > wt.dat <- wt(dat) > > par(mfrow=c(2,1)) > plot.ts(dat[,2]) > plot(wt.dat, plot.cb=TRUE, plot.phase=FALSE) > > Thank you very much for your guideline. > > Fir > >

Re: [R-SIG-Finance] Why does the curve() doesn't work for negative binomial distribution?

2011-07-13 Thread R. Michael Weylandt
ng too many inferences. Since this is a somewhat thorny issue, my > recommendation is that you handle the plot call yourself so you know exactly > what you are getting. > > Hope this helps and good luck getting started with R, > > Michael Weylandt > > > > > > > On

Re: [R-SIG-Finance] Moving averages etcetera over time periods on ragged data

2011-08-28 Thread R. Michael Weylandt
na.locf() will handle the second part of your question. I've not been super successful with the maxlag optional argument, however, so do be wary if you use that one. Michael On Sun, Aug 28, 2011 at 9:42 PM, Worik Stanton wrote: > Forgive me if this has been asked/answered. > > I have some data t

Re: [R-SIG-Finance] RBLOOMBERG

2011-09-12 Thread R. Michael Weylandt
You might try resending this message while actually including the error message if you want a more substantial reply... Michael Weylandt On Mon, Sep 12, 2011 at 4:18 AM, krisan haria wrote: > Hi > > Basic Question > > I havev R .2.13.1. Im trying to use RBLOOMBERG for

Re: [R-SIG-Finance] Help needed for accessing factor data,

2011-09-16 Thread R. Michael Weylandt
of 2 variables: > $ V1: Factor w/ 1 level "spy,20110815": 1 1 1 1 1 1 1 1 1 1 ... > $ V2: Factor w/ 23399 levels > "01:00:00,119.92,119.92,119.92,119.92,0,0,0.0 , ... > > I need to access the individual elements of each row of V2. > > Please let me know, > It

Re: [R-SIG-Finance] Open to Close to Open data transformation (quantmod, xts and possibly zoo)

2011-09-23 Thread R. Michael Weylandt
There's no automatic function for this sort of request that I know of, but it shouldn't be hard to write one: require(quantmod) getSymbols('^GSPC',from='1990-01-01') CollapseOpCl <- function(P){ stopifnot(all(has.Op(P),has.Cl(P))) O <- Op(P); time(O) <- as.POSIXlt(time(O)); time(O)$hour <

Re: [R-SIG-Finance] Weird problem with latest RQuantLib not working with QuantMod on R 2.13.1

2011-09-27 Thread R. Michael Weylandt
No idea why, but just chiming in to say same problem on my (mac) machine: > sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] C/en_US.UTF-8/C/C/C/C attached base packages: [1] stats graphics grDevices utils datasets methods bas

Re: [R-SIG-Finance] Weird problem with latest RQuantLib not working with QuantMod on R 2.13.1

2011-09-27 Thread R. Michael Weylandt
at 11:27 PM, chandra bajpai wrote: > HI Michael...thanks for the quick reply, I'm to to R, how does one > report such a bug? > I wonder if it's the bug exists in 2.12 at all. > > Thanks, > Chandra > > On Tue, Sep 27, 2011 at 11:21 PM, R. Michael Weylandt >

Re: [R-SIG-Finance] PerformanceAnalytics package

2011-10-24 Thread R. Michael Weylandt
I don't know if Josh/Brian/Jeff got you an answer on this, but on my version of PerformanceAnalytics (1.0.3.2), these different VaR methods seem to have been collapsed into VaR with different methods available. Perhaps your reference is for an older version of the package in which these have been d

Re: [R-SIG-Finance] VaR and ES in PerformanceAnalytics

2011-10-24 Thread R. Michael Weylandt
I don't have the OP's data, but, just for the record, the same phenomenon can be seen with SPY returns. library(quantmod) getSymbols("SPY") R = na.omit(ROC(Ad(SPY))) identical((ES(R, p = 0.99)-VaR(R, p = 0.99))[1,1],0) TRUE And thanks for the insightful explanation. Do you happen to have the Jor

Re: [R-SIG-Finance] getSymbols {quantmod}: load data from world markets

2011-10-25 Thread R. Michael Weylandt
library(quantmod) getSymbols("CBA.AX") Hope that helps, Michael On Tue, Oct 25, 2011 at 6:13 AM, Fan wrote: > Hi there, > I am trying to load data using getSymbols {quantmod}, however, it looks to > me this function can only load data from US exchange, since I trade stocks > in ASX, so I tried

Re: [R-SIG-Finance] 3d implied volatility surface

2011-10-26 Thread R. Michael Weylandt
This isn't specifically financial so any follow up is perhaps better done on the general R-help list, but try demo(persp) to see some example code that's built in. If I remember correctly, demo(lattice) also has at least one 3d example. Michael On Wed, Oct 26, 2011 at 1:43 PM, financial engineer

Re: [R-SIG-Finance] 3d implied volatility surface

2011-10-26 Thread R. Michael Weylandt
Perhaps you should load the lattice package first with library(lattice)I just confirmed it has 2 3d examples in it. As to specific formatting advice, I'd usually prefer delta/moneyness than straight strike if you were preparing the graph for me. Otherwise there's one very large source of varia

Re: [R-SIG-Finance] 3d implied volatility surface

2011-10-26 Thread R. Michael Weylandt
Another thought, you might want to look at the rgl package: it allows for interactive 3d graphics (though with a little bit of work) which can add a potentially useful level of exploratory power. I haven't used it much but would also be interested in learning more: if you'd be interested, I'd love

Re: [R-SIG-Finance] expanding xts object - adding a day

2011-11-06 Thread R. Michael Weylandt
I think you mean to put get(ticker) in the rbind() to get the xts object, not the name. Michael On Nov 6, 2011, at 12:37 PM, Hans Grapenthin wrote: > Hello > > this does it for one stock. I am struggling when I insert this expression in > a > loop that worked before: > > tickers <- c("MS

Re: [R-SIG-Finance] Output of vars package impulse response function

2011-11-08 Thread R. Michael Weylandt
If no one here knows, it may be worth it to contact the package maintainer directly. See maintainer("vars") Michael On Tue, Nov 8, 2011 at 9:44 AM, Richard Saba wrote: > Does anyone know if the  bootstrap  CI intervals generated by the irf() > function in the " vars"  package are bias corrected?

Re: [R-SIG-Finance] repeating regression

2011-11-21 Thread R. Michael Weylandt
You can probably specify the problem with model.matrix and use lm.fit directly, but what's probably even better is to remember that the slope can be calculated as correlation * std_y / std_x for this simple case of one independent variable and implement directly . E.g., something like apply(Data,

Re: [R-SIG-Finance] [R] nice time series viewer?

2011-12-07 Thread R. Michael Weylandt
plot.xts() chartSeries() if you are using financial data? It's going to depend on your (unstated) form of time series, but generally R isn't set up for interactive graphics. (chartSeries being the only time-series specific exception I know; you can also do Rgl and Rggobi stuff with a little bit o

Re: [R-SIG-Finance] msts command in the forecast package?

2011-12-12 Thread R. Michael Weylandt
What version of forecast do you have loaded (use sessionInfo() after library(forecast) to check)? If it was only uploaded very very recently, it might not have propagated to your mirror. It should be 3.14. If your mirrors don't have it built, you might have to download a source package and do a co

Re: [R-SIG-Finance] Happy holidays and trading strategies in R?

2011-12-24 Thread R. Michael Weylandt
Have you looked at the quantstrat demos? (If you don't know what I mean, google quanstrat and download the required packages from R-forge) Michael On Sat, Dec 24, 2011 at 4:09 PM, Michael wrote: > Hi all, > > Happy holidays! > > I would like to ask a question about using R to backtest strategies

Re: [R-SIG-Finance] Where is my hedge ratio when testing for cointegration with Phillips-Ouliaris test?

2012-01-06 Thread R. Michael Weylandt
Slightly beyond the scope of your question, but this might be of interest: http://quanttrader.info/public/betterHedgeRatios.pdf Michael On Fri, Jan 6, 2012 at 2:08 PM, Mark Breman wrote: > Hello List, > > I'm testing multivariate timeseries for cointegration using the > Phillips-Ouliaris test fr

Re: [R-SIG-Finance] data manipulation to for quantmod function

2012-01-11 Thread R. Michael Weylandt
If you have tick/high(-ish) frequency data, you'll have to transform it to OHLC; there's no way to keep the frequency you have and to make an OHLC object out of it, since those metrics are by definition aggregates. The easiest way to do so is to read it in as an xts object then use one of the to

Re: [R-SIG-Finance] data manipulation to for quantmod function

2012-01-11 Thread R. Michael Weylandt
uantmod easily handles tick data. Michael On Jan 11, 2012, at 10:10 AM, "Brian G. Peterson" wrote: > On Wed, 2012-01-11 at 09:49 -0500, R. Michael Weylandt wrote: >> If you have tick/high(-ish) frequency data, you'll have to >> transform it to OHLC; there's

Re: [R-SIG-Finance] price channel

2012-01-13 Thread R. Michael Weylandt
Perhaps runMax() and runMin() in TTR would let you code this up easily. Michael On Fri, Jan 13, 2012 at 2:30 PM, Michael wrote: > Hi all, > > I am looking for the command/functions for defining price channel: > > A price channel is defined by the highest high and lowest low over some > past numb

Re: [R-SIG-Finance] How do I bin data into 5 min bins and compute the medians in the bins?

2012-01-19 Thread R. Michael Weylandt
Use something like: period.apply(X, endpoints(X, "minutes", 5), median) Michael Weylandt On Thu, Jan 19, 2012 at 1:54 PM, Michael wrote: > I have also searched "crazily"... and read into both "xts" and "zoo"... but > couldn't find a solutio

Re: [R-SIG-Finance] question about time-stamp comparison?

2012-01-20 Thread R. Michael Weylandt
storage.mode(as.POSIXct(123757, origin = "1970-01-01")) # POSIXct sapply(strptime("1970-01-01 03:43:32.345", format = "%Y-%m-%d %H:%M:%OS"), storage.mode) #POSIXlt They are numeric, not character. Michael Weylandt On Fri, Jan 20, 2012 at 10:49 AM, Michael wrote:

Re: [R-SIG-Finance] question about time-stamp comparison?

2012-01-20 Thread R. Michael Weylandt
n? Or (if you actually read the xts documentation!) there's a (much) better trick: ? `[.xts` tmp1["::20110920 12:01:33.386168"] Michael Weylandt On Fri, Jan 20, 2012 at 11:32 AM, Michael wrote: > These are char strings: > "2011-09-20 12:01:33.386168" > In fa

Re: [R-SIG-Finance] How do I bin data into 5 min bins and compute the medians in the bins?

2012-01-20 Thread R. Michael Weylandt
It's remarkable how often people's R problems are actually Excel problems. :-) Michael Weylandt On Fri, Jan 20, 2012 at 11:35 AM, Michael wrote: > I followed the "period.apply" advice given previously and it worked... > > And the write.zoo problem is just an

Re: [R-SIG-Finance] question about time-stamp comparison?

2012-01-20 Thread R. Michael Weylandt
gt; (in the previously discussed formatting)... I found the tt$DateTimeStamps is > actually "factor" ... > > So my question is: ordering them like the one I did above, > > is it correct? > > Thanks a lot! > > > > > On Fri, Jan 20, 2012 at 10:44 AM, R.

Re: [R-SIG-Finance] Removing a row in an xts object in place?

2012-01-21 Thread R. Michael Weylandt
Short answer: I'm pretty sure it's impossible to remove elements "in place". Medium answer: If you are worried about memory usage, I might suggest using the data.table() package. It's pretty efficient for most things, though you'll loose xts specific time-functionality. You might be able to wedge

Re: [R-SIG-Finance] How do I intersecttwo time series?

2012-01-24 Thread R. Michael Weylandt
The OP's confusion might also stem from the fact that ?merge doesn't actually lead to ?merge.xts which would have been much more helpful here. I think it's a suboptimal consequence of method dispatch that there are no pointers to documented methods...I'll try to work up a small patch to `?` a

Re: [R-SIG-Finance] troubles with apply.daily

2012-01-29 Thread R. Michael Weylandt
I'm not sure time() is very good for what you want to do. It's tied to R's builtin ts class, which, and it pains me to say this about R, really isn't very good (at least for finance-y things). I think all your problems come from that... Perhaps construct your new index sequence as: seq(start(alph

Re: [R-SIG-Finance] troubles with apply.daily

2012-01-29 Thread R. Michael Weylandt
ULL > Error in coredata.xts(x) : currently unsupported data type >> > > As you can see, all of the data from the last day for which there was data > in the file was processed (in this case by str()), but then it looks like > apply.data() tries to apply myfun on data for the day afte

Re: [R-SIG-Finance] Blotter package not available for 2.14.0?

2012-01-31 Thread R. Michael Weylandt
R-Forge doesn't build for outdated versions of R. You'll need to upgrade your R or simply build it from source. I believe it has no compiled code so it shouldn't be hard. Michael On Tue, Jan 31, 2012 at 11:09 AM, Michael wrote: >  Hi all, good morning and good evening! > > Could you please help

Re: [R-SIG-Finance] using findPeaks in designing railing-stops?

2012-02-09 Thread R. Michael Weylandt
It looks like you need to wrap coredata() because some funny arithmetic is happening when the xts-ness is preserved. e.g. findPeaks(coredata(Ad(SPY)), 5) But this is perhaps a less-than-desirable feature. I'll patch it and send it to Josh. Michael On Thu, Feb 9, 2012 at 9:56 PM, Michael wrote

Re: [R-SIG-Finance] using findPeaks in designing railing-stops?

2012-02-09 Thread R. Michael Weylandt
Happy to follow procedure. Thanks for jumping on it so quickly. Michael Weylandt On Thu, Feb 9, 2012 at 10:40 PM, Jeffrey Ryan wrote: > On Thu, Feb 9, 2012 at 9:00 PM, R. Michael Weylandt > wrote: >> It looks like you need to wrap coredata() because some funny >> arithmetic

Re: [R-SIG-Finance] using findPeaks in designing railing-stops?

2012-02-16 Thread R. Michael Weylandt
Peaks(cc, 5) > points(p, cc[p]) > points(p, cc[p]) > >> > > p > > [1] 3 22 41 > > > > It only picks up 3 peaks, which is obviously wrong, am I correct? > > Thanks a lot! > > On Thu, Feb 9, 2012 at 9:55 PM, R. Michael Weylandt > wrote: >>

Re: [R-SIG-Finance] using findPeaks in designing railing-stops?

2012-02-16 Thread R. Michael Weylandt
r 5? Michael On Thu, Feb 16, 2012 at 10:18 AM, Luna wrote: > But using my eye from the plot it should have more local peaks even with > tolerance 5... no? > > I cannot change the number 5 > > On Thu, Feb 16, 2012 at 9:17 AM, R. Michael Weylandt > wrote: >&g

Re: [R-SIG-Finance] Stock Total Returns?

2012-02-18 Thread R. Michael Weylandt
I think you're over-thinking this: if you have adjusted prices, they already incorporate splits+dividends --- so the return in adjusted price *is* the total return. (Up to some fuzziness in how that adjustment should be done) Michael On Sat, Feb 18, 2012 at 5:20 PM, SW wrote: > Hello All, > > >

Re: [R-SIG-Finance] really puzzled by this R script

2012-02-25 Thread R. Michael Weylandt
This isn't really a finance question... Your problem is that you use names() instead of just getting the row numbers from outlierTest but then, when you convert the names to an integer, your attempts to remove the row by that number and so doesn't actually get the right row, then an outlier remain

Re: [R-SIG-Finance] Splitting time series into blocks/regimes?

2012-02-29 Thread R. Michael Weylandt
t there quite a few? iii) What does this mean: "the 3 big blocks/regimes need to be contiguous within each block/regime itself..." Perhaps you should look into reformulating your idea in terms of regime switching models. Michael Weylandt On Tue, Feb 28, 2012 at 12:55 PM, Michael

Re: [R-SIG-Finance] using getQuote with subscription to yahoo real-time data?

2012-03-02 Thread R. Michael Weylandt
You can write your own getQuote "method" and use the Defaults package to change from src="yahoo" to "yahoopaid" or whatever you decide to call it. I don't have a paid subscription so I can't really help with writing it. Michael On Mar 2, 2012, at 3:01 PM, Andre Zege wrote: > Sorry, my bad. I

Re: [R-SIG-Finance] hourly time series

2012-03-14 Thread R. Michael Weylandt
I think you are interpreting your frequency argument incorrectly and thus R is giving you an error message because you are asking for seasonal trends but giving only one observation per "season" -- it's rather subtle: as the help page says, frequency -- the number of observations per unit of time.

Re: [R-SIG-Finance] hourly time series

2012-03-22 Thread R. Michael Weylandt
>> start.on.monday=TRUE) > Error in as.numeric(test) : >   cannot coerce type 'S4' to vector of type 'double' > > I havent yet been able to identify the cause of this issue. > > It will also be good to know if the same extraction can be performed on the

Re: [R-SIG-Finance] xts to timeSeries conversion

2012-03-24 Thread R. Michael Weylandt
I'm not sure I understand. PerformanceAnalytics is part of the "xts-family" (as opposed to the Rmetrics family) of finance packages. Your problem may be that it requires returns, but consider this (somewhat opaque) one liner. charts.PerformanceSummary(ROC(Cl(to.weekly(Ad(getSymbols("IBM",auto.assi

Re: [R-SIG-Finance] xts to timeSeries conversion

2012-03-24 Thread R. Michael Weylandt
e data.frame conversion in > between. > > Thank you in advance. > > Golam > > Sent from my iPhone > > On 24 Mar 2012, at 13:13, "R. Michael Weylandt" > wrote: > >> I'm not sure I understand. PerformanceAnalytics is part of the >> "

Re: [R-SIG-Finance] Links to trading models in R

2012-03-29 Thread R. Michael Weylandt
You might google around for anything involving the term quantstrat. Michael On Thu, Mar 29, 2012 at 6:03 AM, John Hardy wrote: > Hi, Everyone > > I am getting going with R - mostly only for programming trading systems with > RBloomberg data. I have figured out how to download daily and intraday

Re: [R-SIG-Finance] How to automatically extract test result from Johansen test?

2012-03-30 Thread R. Michael Weylandt
olute pass/fail (like most other statistical tests) so you have to pick your desired significance threshold, but that's not hard. As Brian said though, it makes most sense to do this inside your loop construction. Hope this helps, Michael Weylandt On Fri, Mar 30, 2012 at 12:00 PM, Brian G. P

Re: [R-SIG-Finance] How to automatically extract test result from Johansen test?

2012-03-30 Thread R. Michael Weylandt
procedure is, it seems that one needs to be careful of unpenalized model selection here, but that might be already taken care of in Johansen's method: I simply don't know. If you get Pfaff's book I'm sure this is explained: I don't have a copy handy and it's far too cold

Re: [R-SIG-Finance] xts and sapply

2012-04-01 Thread R. Michael Weylandt
Just a guess, but you are missing a comma in the GSPC part of the "y <- " line. Your bigger problem is that you don't need sapply() in the first place here (best I remember): I think this works: y <- merge(Ad(FNMIX), Ad(DBLTX), Ad(AGG), Ad(GSPC)) ROC(y) # Note that you don't need sapply() because

Re: [R-SIG-Finance] Quick question: the parameter K in the Johansen Procedure for VAR?

2012-04-02 Thread R. Michael Weylandt
As I said to you before, ca.jo is in the urca package. It's defined in arguments: to wit, K: The lag order of the series (levels) in the VAR. It's also used in that manner throughout the details section. Michael Weylandt On Mon, Apr 2, 2012 at 5:33 PM, Michael wrote: > Hi all,

Re: [R-SIG-Finance] Data to start with?

2012-04-04 Thread R. Michael Weylandt
I know IBrokers is reasonable and it has top-notch R integration thanks to Jeff Ryan (http://cran.r-project.org/web/packages/IBrokers/index.html) -- here's some of their pricing data: http://individuals.interactivebrokers.com/en/p.php?f=marketData Michael On Wed, Apr 4, 2012 at 3:52 AM, Sebastian

Re: [R-SIG-Finance] timeSeries 2 zoo convert

2012-04-17 Thread R. Michael Weylandt
Following up on what Josh said, does it work with the built-in data set MSFT provided by timeSeries? library(xts) library(timeSeries) data(MSFT) head(MSFT) head(as.xts(MSFT)) head(as.zoo(MSFT)) all give the same dates for me. Michael On Tue, Apr 17, 2012 at 1:39 PM, Joshua Ulrich wrote: > On

Re: [R-SIG-Finance] about an error of xts

2012-04-23 Thread R. Michael Weylandt
In addition to what's been said, you could much more easily write: GSPC <- getSymbols("^GSPC", from = "2000-01-01", auto.assign = F) which will give names that are (directly) compatible with other quantmod functions and would seem to avoid your problem in the first place. Michael On Mon, Apr 2

Re: [R-SIG-Finance] Information

2012-04-24 Thread R. Michael Weylandt
I'm no Jeff Ryan, but I'd be willing to put money on him wanting to ask what you've tried and what error message(s) you got? (As well as system config details you get from sessionInfo() ) I just installed it with no problems (well, none that I can check since i don't have Berkeley DB) straight fro

Re: [R-SIG-Finance] to make the finance package running

2012-04-25 Thread R. Michael Weylandt
This isn't really a finance question, but do you have the source code? If you do, just use install.packages() with type = "source" and point to the appropriate tarball. The only somewhat difficult step might be if you need to add a namespace. Michael On Apr 25, 2012, at 10:00 PM, Wei-han Li

Re: [R-SIG-Finance] Information

2012-04-25 Thread R. Michael Weylandt
sion 2.14.1) > > I've installed Berkeley DB11gR2 > > Thank you to tell me how to install RBerkeley if you have some information. > > > > -Message d'origine- > De : R. Michael Weylandt [mailto:michael.weyla...@gmail.com] > Envoyé : mercredi 25 avril

Re: [R-SIG-Finance] Time indexation after selection in an xts object

2012-05-01 Thread R. Michael Weylandt
Your xts is a little out of date, I doubt that that's relevant but it might not hurt to just go ahead and update. But yes, sending the file (just a small sample thereof) would help -- the easiest way to do so would be to type dput(head(x, 30)) # x is name of your object and send us the textual o

Re: [R-SIG-Finance] Can't addMACD(). Is it a bug?

2012-05-22 Thread R. Michael Weylandt
Not runnable exactly as is where does the for loop have its close brace? This works fine for me: getSymbols("SPY", from = "1990-01-01") y <- to.weekly(SPY) chartSeries(y, type = "candlesticks", multi.col = TRUE, theme = "white", subset = 'last 54 months', name = "SPY") addMACD(fast = 12, slow

Re: [R-SIG-Finance] 2 time/date columns to one

2012-05-25 Thread R. Michael Weylandt
Use xts (always use xts!) and do something like this: Suppose your data is in three columns called "dat" xts(dat[,3], as.POSIXct(paste(dat[,1], dat[,2], format = "%m/%d/%Y %H%M")) This will make an xts of your data taking the third column as the data-bit and using the first two to make a POSIXct

Re: [R-SIG-Finance] 2 time/date columns to one

2012-05-25 Thread R. Michael Weylandt
; > I am getting: > > Error in as.POSIXlt.character(x, tz, ...) : >  character string is not in a standard unambiguous format > > I am also using: > > Sys.setenv(TZ="GMT") > > just in case. > > Any thoughts? > > On 25 May 2012 19:49, R. Michael Weyl

Re: [R-SIG-Finance] RBLOOMBERG--conn=blpConnect(iface="COM") PROBLEMS

2012-05-28 Thread R. Michael Weylandt
Note also that you're probably using a somewhat outdated version -- as of a few days ago the package is no longer called "RBloomberg" (see John's posting here: https://stat.ethz.ch/pipermail/r-sig-finance/2012q2/010275.html) -- you might try updating to Rbbg and seeing what happens. [In addition t

Re: [R-SIG-Finance] RQuantLib possible bug in yearFraction and dayCount

2012-06-07 Thread R. Michael Weylandt
H... looking at the source code, you see the return value is wrapped in invisible() so it won't auto-print but it is returned --it's not a bug, but I don't know exactly why Dirk would have done that. There are other functions that return invisibly (e.g., most plot functions) but those are usual

  1   2   >