Re: [R-SIG-Finance] CUSIP Numbers

2015-01-21 Thread Amos B. Elberg
I've always gotten CUSIPs from the finra website. I haven't tried to scrape 
them, but it shouldn't be terribly difficult with Hadley's rvest package.


> On Jan 21, 2015, at 10:45 AM, Anshul Pandey  wrote:
> 
> Hi All,
> 
> I am moving some of my backtesting logics to CUSIP from tickers.
> How do I download the CUSIP number of US stocks?
> 
> I know S&P has a paid subscription, but I read that CUSIP is publicly
> available at a few resources.
> 
> Any suggestions are highly welcome.
> 
> Thanks
> Anshul
> 
>[[alternative HTML version deleted]]
> 
> ___
> R-SIG-Finance@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.

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] CUSIP Numbers

2015-01-21 Thread Anshul Pandey
Thank you all for the reply.
This is very helpful.

I am going through the Bloomberg Open Symbology. Looks like CUSIP and SEDOL
are becoming popular (the last 3 hedge funds I talked to mentioned one of
these two), so it would be nice to see what Bloomberg has to offer.

James, you raised a very valid concern. I will keep that in mind while
setting up my production system.

Best Regards
Anshul

On Thu, Jan 22, 2015 at 3:55 AM, G See  wrote:

> Since this is an R mailing list, I'll try to bring this thread back on
> topic.  Unless you are willing to pay, the only free source that I am
> aware of to get CUSIPs via R is TradeKing.
> https://developers.tradeking.com/documentation/market-ext-quotes-get-post
>
> You must have an account, but you can create an account for free and
> you don't have to fund it in order to do this.
>
>
> library(ROAuth) #importFrom(ROAuth, OAuthFactory)
> library(RJSONIO) #importFrom(RJSONIO, fromJSON)
>
> #' ## This part could go in your .Rprofile
> #' # Set your application keys #
> https://developers.tradeking.com/applications
> #' cKey <- ''
> #' cSecret <- '#'
> #' oKey <- ''
> #' oSecret <- ''
>
> # Set the API endpoint
> tkURL <- "https://api.tradeking.com/v1/market/ext/quotes.json";
>
> # Create the OAuth connection - this is straight from the ROAuth
> documentation on CRAN
> credentials <- OAuthFactory$new(consumerKey=cKey,
> consumerSecret=cSecret,
> oauthKey = oKey,
> oauthSecret = oSecret,
> needsVerifier=FALSE,
> signMethod='HMAC')
> # Update the connection so the handshake is TRUE
> credentials$handshakeComplete <- TRUE
>
> Symbols <- tolower(c("AAPL", "MSFT")) ## Whatever symbols you want
> symbols <- paste(Symbols, collapse=",")
>
> #what <- "datetime,bidsz,bid,ask,asksz,last,chg,pchg,opn,hi,lo,vl"
> what <- "cusip"
> what <- gsub(" ", "", tolower(paste(unlist(strsplit(what, ",")),
>   collapse=",")))
> tkURL <- "https://api.tradeking.com/v1/market/ext/quotes.json";
> query <- list(symbols=symbols, fids=what)
> response <- credentials$OAuthRequest(tkURL, query)
> res <- fromJSON(response)
> qt <- res$response$quotes$quote
> qt
>
> #[[1]]
> # cusip   exch symbol
> #"59491810" "NASD" "MSFT"
> #
> #[[2]]
> # cusip   exch symbol
> #"03783310" "NASD" "AAPL"
>
> HTH,
> Garrett
>



-- 
Anshul Vikram Pandey
+1-929-231-6784
home: www.anshulvp.com
thoughts: www.anshulvp.com/blog
contact: anshul.b...@gmail.com, he...@anshulvp.com

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?

2015-01-21 Thread ce

I use stable version. I tried latest beta too, didn't help.
Indeed downgrade fixed clientid problem but my main problem 
(https://groups.yahoo.com/neo/groups/TWSAPI/conversations/messages/33071 ) ,  
event handler returns garbled data persists, instead of correct 2100 error I 
still get :

paraml[[1]]= -1 
paraml[[2]]= NA 
paraml[[3]]= PF1 
paraml[[4]]= API client has been unsubscribed from account data..NA 

I guess I need to contact IBrokers maintainer , I can't think of what else to 
do .
best
ce

-Original Message-
From: "cen six" [cens...@gmail.com]
Date: 01/21/2015 11:24 AM
To: "ce" 
CC: "r-sig-finance@r-project.org" 
Subject: Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?

Well, for sure a downgrade of the TWS would fix it, but its obviously not a 
long term solution. Are you using a beta TWS version or a stable release ?


On Wed, Jan 21, 2015 at 4:07 AM, ce  wrote:

I downgraded IBrokers version to 0.9-10, while keeping TWS Build 948.3c, Jan 5, 
2015 5:12:23 PM ,
still I got the wrong clientid from TWS.

Then I downgraded TWS to  Build 945.2b, Jun 3, 2014 11:11:57 AM and it worked 
correctly with IBrokers 0.9-10

I see my clientid 96 is returned from TWS :

TWS OpenOrder: orderId=2 clientId=96 conId=14321015 symbol=GBP status=Filled


-Original Message-
From: "ce" [zadi...@excite.com]
Date: 01/20/2015 07:52 PM
To: cens...@gmail.com
CC: r-sig-finance@r-project.org
Subject: Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?


Hi Cen six,

I am using IBrokers 0.9.12 from cran r web site.
In fact I was testing the demo program from you emailed me. It was working fine 
but one or two weeks ago event handler started to fail ( maybe after IBrokers 
update )  as I explained in : 
https://groups.yahoo.com/neo/groups/TWSAPI/conversations/messages/33071

then I upgraded TWS but now clientid returned by event handler is wrong.
Maybe I should downgrade IBrokers or TWS ?

ce


-Original Message-
From: "cen six" [cens...@gmail.com]
Date: 01/20/2015 03:04 PM
To: "ce" 
CC: "r-sig-finance@r-project.org" 
Subject: Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?

Are you using the IBrokers package version 0.9-10  or higher ? (from 
code.google.com)


cheers


On Tue, Jan 20, 2015 at 2:38 AM, ce  wrote:

Dear all,

I just upgraded TWS to Build 948.3c, Jan 5, 2015 5:12:23 PM
My program that worked fine before started to return wrong clientid . I set 
client ID to 96. but after sending the order, In order status , or order 
execution events I get clientid 6  !!  Even I tried to set Master API Client ID 
to 96 in TWS -> Configuration -> API.  didnt work.
If I set Clientid to 6,  TWS returns 0 as Clientid.

Here is some piece of code :

> ibClientId <- 96
>
>
> #global: create the connection to IB  (this can probably not be stored 
> anywhere, so
> #we have to recreate it within "IBexecuteStrategy.r"
> ibConnection<-NULL
> if (!is.twsConnection(ibConnection)) {
+    ibConnection<- twsConnect(clientId=ibClientId, host="localhost",
+                                       port=7496, verbose=TRUE,
+                                       timeout=15, filename=NULL)
+ }
> print(ibConnection)


TWS OpenOrder: orderId=3 clientId=6 conId=12087807 symbol=EUR status=Submitted

___
R-SIG-Finance@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.

___
R-SIG-Finance@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 g

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] CUSIP Numbers

2015-01-21 Thread G See
Since this is an R mailing list, I'll try to bring this thread back on
topic.  Unless you are willing to pay, the only free source that I am
aware of to get CUSIPs via R is TradeKing.
https://developers.tradeking.com/documentation/market-ext-quotes-get-post

You must have an account, but you can create an account for free and
you don't have to fund it in order to do this.


library(ROAuth) #importFrom(ROAuth, OAuthFactory)
library(RJSONIO) #importFrom(RJSONIO, fromJSON)

#' ## This part could go in your .Rprofile
#' # Set your application keys # https://developers.tradeking.com/applications
#' cKey <- ''
#' cSecret <- '#'
#' oKey <- ''
#' oSecret <- ''

# Set the API endpoint
tkURL <- "https://api.tradeking.com/v1/market/ext/quotes.json";

# Create the OAuth connection - this is straight from the ROAuth
documentation on CRAN
credentials <- OAuthFactory$new(consumerKey=cKey,
consumerSecret=cSecret,
oauthKey = oKey,
oauthSecret = oSecret,
needsVerifier=FALSE,
signMethod='HMAC')
# Update the connection so the handshake is TRUE
credentials$handshakeComplete <- TRUE

Symbols <- tolower(c("AAPL", "MSFT")) ## Whatever symbols you want
symbols <- paste(Symbols, collapse=",")

#what <- "datetime,bidsz,bid,ask,asksz,last,chg,pchg,opn,hi,lo,vl"
what <- "cusip"
what <- gsub(" ", "", tolower(paste(unlist(strsplit(what, ",")),
  collapse=",")))
tkURL <- "https://api.tradeking.com/v1/market/ext/quotes.json";
query <- list(symbols=symbols, fids=what)
response <- credentials$OAuthRequest(tkURL, query)
res <- fromJSON(response)
qt <- res$response$quotes$quote
qt

#[[1]]
# cusip   exch symbol
#"59491810" "NASD" "MSFT"
#
#[[2]]
# cusip   exch symbol
#"03783310" "NASD" "AAPL"

HTH,
Garrett

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] CUSIP Numbers

2015-01-21 Thread Daniel Cegiełka
2015-01-21 16:45 GMT+01:00 Anshul Pandey :
> Hi All,
>
> I am moving some of my backtesting logics to CUSIP from tickers.
> How do I download the CUSIP number of US stocks?
>
> I know S&P has a paid subscription, but I read that CUSIP is publicly
> available at a few resources.
>
> Any suggestions are highly welcome.

You may be interested in Bloomberg Open Symbology, as an alternative to CUSIP.

http://bsym.bloomberg.com/sym/

Best regards,
Daniel

>
> Thanks
> Anshul
>

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] CUSIP Numbers

2015-01-21 Thread aschmid1

Fidelity customers can find CUSIPs (one at a time):
 http://activequote.fidelity.com/mmnet/SymLookup.phtml

On 01/21/2015 1:03 PM, James Ho wrote:

Hi Anshul,

CUSIP's are owned by S&P so they aren't really public. Anyhow, you wont
want to use those to backtest as they are driven by the underlying
company's name (imagine what happens to a CUSIP when there is any M&A
activity). MSCI Barra & S&P's Compustat's Point-In-Time ID's are built 
for

this type of backtesting. If you have access to BBID's that would be a
decent alternative but looking for an open source identifier system is
going to be tough. Good luck sir.

~James

On Wed, Jan 21, 2015 at 7:45 AM, Anshul Pandey 
wrote:


Hi All,

I am moving some of my backtesting logics to CUSIP from tickers.
How do I download the CUSIP number of US stocks?

I know S&P has a paid subscription, but I read that CUSIP is publicly
available at a few resources.

Any suggestions are highly welcome.

Thanks
Anshul

[[alternative HTML version deleted]]

___
R-SIG-Finance@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@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.


___
R-SIG-Finance@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.


Re: [R-SIG-Finance] CUSIP Numbers

2015-01-21 Thread James Ho
Hi Anshul,

CUSIP's are owned by S&P so they aren't really public. Anyhow, you wont
want to use those to backtest as they are driven by the underlying
company's name (imagine what happens to a CUSIP when there is any M&A
activity). MSCI Barra & S&P's Compustat's Point-In-Time ID's are built for
this type of backtesting. If you have access to BBID's that would be a
decent alternative but looking for an open source identifier system is
going to be tough. Good luck sir.

~James

On Wed, Jan 21, 2015 at 7:45 AM, Anshul Pandey 
wrote:

> Hi All,
>
> I am moving some of my backtesting logics to CUSIP from tickers.
> How do I download the CUSIP number of US stocks?
>
> I know S&P has a paid subscription, but I read that CUSIP is publicly
> available at a few resources.
>
> Any suggestions are highly welcome.
>
> Thanks
> Anshul
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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@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.


Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?

2015-01-21 Thread cen six
Well, for sure a downgrade of the TWS would fix it, but it's obviously not
a long term solution. Are you using a beta TWS version or a stable release ?

On Wed, Jan 21, 2015 at 4:07 AM, ce  wrote:

>
> I downgraded IBrokers version to 0.9-10, while keeping TWS Build 948.3c,
> Jan 5, 2015 5:12:23 PM ,
> still I got the wrong clientid from TWS.
>
> Then I downgraded TWS to  Build 945.2b, Jun 3, 2014 11:11:57 AM and it
> worked correctly with IBrokers 0.9-10
>
> I see my clientid 96 is returned from TWS :
>
> TWS OpenOrder: orderId=2 clientId=96 conId=14321015 symbol=GBP
> status=Filled
>
>
> -Original Message-
> From: "ce" [zadi...@excite.com]
> Date: 01/20/2015 07:52 PM
> To: cens...@gmail.com
> CC: r-sig-finance@r-project.org
> Subject: Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?
>
>
> Hi Cen six,
>
> I am using IBrokers 0.9.12 from cran r web site.
> In fact I was testing the demo program from you emailed me. It was working
> fine but one or two weeks ago event handler started to fail ( maybe after
> IBrokers update )  as I explained in :
> https://groups.yahoo.com/neo/groups/TWSAPI/conversations/messages/33071
>
> then I upgraded TWS but now clientid returned by event handler is wrong.
> Maybe I should downgrade IBrokers or TWS ?
>
> ce
>
>
> -Original Message-
> From: "cen six" [cens...@gmail.com]
> Date: 01/20/2015 03:04 PM
> To: "ce" 
> CC: "r-sig-finance@r-project.org" 
> Subject: Re: [R-SIG-Finance] IBrokers Package: wrong Clientid returns ?
>
> Are you using the IBrokers package version 0.9-10  or higher ? (from
> code.google.com)
>
>
> cheers
>
>
> On Tue, Jan 20, 2015 at 2:38 AM, ce  wrote:
>
> Dear all,
>
> I just upgraded TWS to Build 948.3c, Jan 5, 2015 5:12:23 PM
> My program that worked fine before started to return wrong clientid . I
> set client ID to 96. but after sending the order, In order status , or
> order execution events I get clientid 6  !!  Even I tried to set Master API
> Client ID to 96 in TWS -> Configuration -> API.  didnt work.
> If I set Clientid to 6,  TWS returns 0 as Clientid.
>
> Here is some piece of code :
>
> > ibClientId <- 96
> >
> >
> > #global: create the connection to IB  (this can probably not be stored
> anywhere, so
> > #we have to recreate it within "IBexecuteStrategy.r"
> > ibConnection<-NULL
> > if (!is.twsConnection(ibConnection)) {
> +ibConnection<- twsConnect(clientId=ibClientId, host="localhost",
> +   port=7496, verbose=TRUE,
> +   timeout=15, filename=NULL)
> + }
> > print(ibConnection)
> 
>
> TWS OpenOrder: orderId=3 clientId=6 conId=12087807 symbol=EUR
> status=Submitted
>
> ___
> R-SIG-Finance@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.
>
> ___
> R-SIG-Finance@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 g
>

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Portfolio Optimisation as a function of targeted Risk rather than return.

2015-01-21 Thread Pierre Org
Thank you Ilya, much appreciated

 

 

 

From: Ilya Kipnis [mailto:ilya.kip...@gmail.com] 
Sent: 21 January 2015 15:50
To: Pierre Org
Cc: r-sig-finance@r-project.org
Subject: Re: [R-SIG-Finance] Portfolio Optimisation as a function of targeted 
Risk rather than return.

 

Check out the PortfolioAnalytics package.

 

On Wed, Jan 21, 2015 at 6:13 AM, Pierre Org  wrote:

I am currently working on a portfolio optimisation strategy that would
involves optimising  a portfolio so that it maximises the returns for a user
defined level of risk.   E.g. keeping the volatility of the portfolio at 10%
annualised whilst maximising the return for this level. For that purpose I
was hoping to use the function maxreturnPortfolio  in fPortfolio that should
return the portfolio with the maximal return for a fixed target risk.
Clearly  though showing in this great package the function has been/is  in
development by the authors of the package and currently does not work as
intended. This is confirmed  by various posts and answer to those by the
authors.   I wonder if anyone knows of another more up to date  package or
way of doing this in R ?



Any help would be really appreciated.








[[alternative HTML version deleted]]

___
R-SIG-Finance@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@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.


Re: [R-SIG-Finance] Portfolio Optimisation as a function of targeted Risk rather than return.

2015-01-21 Thread Ilya Kipnis
Check out the PortfolioAnalytics package.

On Wed, Jan 21, 2015 at 6:13 AM, Pierre Org  wrote:

> I am currently working on a portfolio optimisation strategy that would
> involves optimising  a portfolio so that it maximises the returns for a
> user
> defined level of risk.   E.g. keeping the volatility of the portfolio at
> 10%
> annualised whilst maximising the return for this level. For that purpose I
> was hoping to use the function maxreturnPortfolio  in fPortfolio that
> should
> return the portfolio with the maximal return for a fixed target risk.
> Clearly  though showing in this great package the function has been/is  in
> development by the authors of the package and currently does not work as
> intended. This is confirmed  by various posts and answer to those by the
> authors.   I wonder if anyone knows of another more up to date  package or
> way of doing this in R ?
>
>
>
> Any help would be really appreciated.
>
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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@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.


[R-SIG-Finance] CUSIP Numbers

2015-01-21 Thread Anshul Pandey
Hi All,

I am moving some of my backtesting logics to CUSIP from tickers.
How do I download the CUSIP number of US stocks?

I know S&P has a paid subscription, but I read that CUSIP is publicly
available at a few resources.

Any suggestions are highly welcome.

Thanks
Anshul

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Passing optim.control arima arguments to ugarchfit in rugarch

2015-01-21 Thread Andreas Keller Leth Laursen
Ah, a misunderstanding on my part. Of course it makes perfect sense that
they are jointly estimated.

Thanks for the suggestions and the swift response.

Best regards,

Andreas

--
Andreas Keller
M.Sc. student in Economics and Management

On Wed, Jan 21, 2015 at 12:19 PM, alexios  wrote:

> Hi,
>
> arima is only used to obtain mean equation starting values for the joint
> recursion which is then ML based. Your best bet is to try using
> solver="gosolnp" which searches the parameter space for good starting
> values.
> Also, try setting variance.targeting=TRUE (in variance.model), and
> fit.control=list(scale=1).
>
> Ofcourse, this is all dependent on using a reasonable amount of data for
> the estimation (already discussed numerous times over the years).
>
> Regards,
>
> Alexios
>
>
> On 21/01/2015 10:38, Andreas Keller Leth Laursen wrote:
>
>> Dear all
>>
>> I am currently estimating a number of GARCH models using the excellent
>> rugarch package.
>>
>> I am however having a small problem, as the mean equation has convergence
>> problems. It is a simple ARMA(6,5) model, that is being used as mean
>> equation.
>>
>> When estimating the mean equation, I understand that ugarchfit() use the
>> standard arima() function. Is there a way to pass optim.control arguments
>> to the arima solver? A simple increase in the default maxit should solve
>> the problem, but I cannot figure out if there is a way to pass this
>> argument.
>>
>> As a small hack I have tried to simply give the arma(6,5) estimates as
>> stating values to ugarchspec() using arima() with a higher maxit.
>> However, ugarchfit() still reports convergence problems in the mean
>> equation, when I attempt this.
>>
>> Any help will be much appreciated.
>>
>> Current code:
>>
>> arima_start_val <- arima(input_series, order = c(6, 0, 5), optim.control =
>> list(maxit = 2000)) %>%
>>  coef %>%
>>  as.list
>>
>> names(arima_start_val) <- c("ar1", "ar2", "ar3", "ar4", "ar5", "ar6",
>> "ma1", "ma2", "ma3", "ma4", "ma5", "mu")
>>
>> model <- ugarchspec(
>>  variance.model = list(model = "sGARCH",  garchOrder = c(1, 1)),
>>  mean.model = list(armaOrder = c(6, 5)),
>>  start.pars = arima_start_val,
>>  distribution = "norm")
>>
>> ugarchfit(spec = model, data = input_series)
>>
>> Best regards,
>> Andreas Keller
>>
>> --
>> Andreas Keller
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-SIG-Finance@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@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.


Re: [R-SIG-Finance] Passing optim.control arima arguments to ugarchfit in rugarch

2015-01-21 Thread alexios

Hi,

arima is only used to obtain mean equation starting values for the joint 
recursion which is then ML based. Your best bet is to try using 
solver="gosolnp" which searches the parameter space for good starting 
values.
Also, try setting variance.targeting=TRUE (in variance.model), and 
fit.control=list(scale=1).


Ofcourse, this is all dependent on using a reasonable amount of data for 
the estimation (already discussed numerous times over the years).


Regards,

Alexios

On 21/01/2015 10:38, Andreas Keller Leth Laursen wrote:

Dear all

I am currently estimating a number of GARCH models using the excellent
rugarch package.

I am however having a small problem, as the mean equation has convergence
problems. It is a simple ARMA(6,5) model, that is being used as mean
equation.

When estimating the mean equation, I understand that ugarchfit() use the
standard arima() function. Is there a way to pass optim.control arguments
to the arima solver? A simple increase in the default maxit should solve
the problem, but I cannot figure out if there is a way to pass this
argument.

As a small hack I have tried to simply give the arma(6,5) estimates as
stating values to ugarchspec() using arima() with a higher maxit.
However, ugarchfit() still reports convergence problems in the mean
equation, when I attempt this.

Any help will be much appreciated.

Current code:

arima_start_val <- arima(input_series, order = c(6, 0, 5), optim.control =
list(maxit = 2000)) %>%
 coef %>%
 as.list

names(arima_start_val) <- c("ar1", "ar2", "ar3", "ar4", "ar5", "ar6",
"ma1", "ma2", "ma3", "ma4", "ma5", "mu")

model <- ugarchspec(
 variance.model = list(model = "sGARCH",  garchOrder = c(1, 1)),
 mean.model = list(armaOrder = c(6, 5)),
 start.pars = arima_start_val,
 distribution = "norm")

ugarchfit(spec = model, data = input_series)

Best regards,
Andreas Keller

--
Andreas Keller

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.




___
R-SIG-Finance@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.


[R-SIG-Finance] Portfolio Optimisation as a function of targeted Risk rather than return.

2015-01-21 Thread Pierre Org
I am currently working on a portfolio optimisation strategy that would
involves optimising  a portfolio so that it maximises the returns for a user
defined level of risk.   E.g. keeping the volatility of the portfolio at 10%
annualised whilst maximising the return for this level. For that purpose I
was hoping to use the function maxreturnPortfolio  in fPortfolio that should
return the portfolio with the maximal return for a fixed target risk.
Clearly  though showing in this great package the function has been/is  in
development by the authors of the package and currently does not work as
intended. This is confirmed  by various posts and answer to those by the
authors.   I wonder if anyone knows of another more up to date  package or
way of doing this in R ? 

 

Any help would be really appreciated.

 

 

 


[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


[R-SIG-Finance] Passing optim.control arima arguments to ugarchfit in rugarch

2015-01-21 Thread Andreas Keller Leth Laursen
Dear all

I am currently estimating a number of GARCH models using the excellent
rugarch package.

I am however having a small problem, as the mean equation has convergence
problems. It is a simple ARMA(6,5) model, that is being used as mean
equation.

When estimating the mean equation, I understand that ugarchfit() use the
standard arima() function. Is there a way to pass optim.control arguments
to the arima solver? A simple increase in the default maxit should solve
the problem, but I cannot figure out if there is a way to pass this
argument.

As a small hack I have tried to simply give the arma(6,5) estimates as
stating values to ugarchspec() using arima() with a higher maxit.
However, ugarchfit() still reports convergence problems in the mean
equation, when I attempt this.

Any help will be much appreciated.

Current code:

arima_start_val <- arima(input_series, order = c(6, 0, 5), optim.control =
list(maxit = 2000)) %>%
coef %>%
as.list

names(arima_start_val) <- c("ar1", "ar2", "ar3", "ar4", "ar5", "ar6",
"ma1", "ma2", "ma3", "ma4", "ma5", "mu")

model <- ugarchspec(
variance.model = list(model = "sGARCH",  garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(6, 5)),
start.pars = arima_start_val,
distribution = "norm")

ugarchfit(spec = model, data = input_series)

Best regards,
Andreas Keller

--
Andreas Keller

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


[R-SIG-Finance] Help with quantstrat

2015-01-21 Thread Olivier MARTIN

Hi all,

I am beginner with quantstrat. I would like to try a simple strategy but 
I have some
difficulties to program it. The strategy is based on two signals : the 
CCI and the RSI.
First, I compute RSI and CCI for period n=21. Let's denote them rsi21 
and cci21.

Secondly, I compute two moving average for rsi21 and cci21 with two
periodes : 8 and 14. I obtain four signals. Let's denote i3 and i4 for
rsi21, and i5 and i6 for cci21.
Finally, I  enter for a long position if (i3>i4)&(i5>i6)
I enter for a short position if (i3i4)&(i5>i6)
dn=(i3add.indicator(strategy =mystrategy, name = "SMA",arguments = list(x = 
quote(RSI(Cl(mktdata),n=8)), n=20), label="i3")
add.indicator(strategy =mystrategy, name = "SMA",arguments = list(x = 
quote(RSI(Cl(mktdata),n=14)), n=20), label="i4")
add.indicator(strategy =mystrategy, name = "SMA",arguments = list(x = 
quote(CCI(Cl(mktdata),n=8)), n=20), label="i5")
add.indicator(strategy =mystrategy, name = "SMA",arguments = list(x = 
quote(CCI(Cl(mktdata),n=14)), n=20), label="i6")


#signals
add.signal(mystrategy,name="sigCrossover",arguments = 
list(columns=c("i3","i4"),relationship="gt"),  label="i3.gt.i4")
add.signal(mystrategy,name="sigCrossover",  arguments = 
list(columns=c("i5","i6"),relationship="gt"),  label="i5.gt.i6")
add.signal(mystrategy,name="sigCrossover",  arguments = 
list(columns=c("i3","i4"),relationship="lt"),  label="i3.lt.i4")
add.signal(mystrategy,name="sigCrossover",  arguments = 
list(columns=c("i5","i6"),relationship="lt"),  label="i5.lt.i6")


#rules
 ???




Could someone help me ?
Best regards,
Olivier.

___
R-SIG-Finance@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.