Re: [R-SIG-Finance] Error with getSymbols('SP500', from = "2020-01-01", to = "2021-06-30", src='FRED') SP500<-na.locf(SP500, na.rm = TRUE)

2022-11-07 Thread Daniel Cegiełka
Hi Josh,

schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE
(0x80090326) - This error usually occurs when a fatal SSL/TLS alert is
received (e.g. handshake failed).

This looks like a problem (not a bug in getSymbols) with the TLS
cipher suites. Try direct curl/libcurl. I think you will get the same
error.

Best,
Daniel

pon., 7 lis 2022 o 17:33 Joshua Ulrich  napisał(a):
>
> Hi Frank,
>
> These both work for me in R-4.2.1 and quantmod 0.4.20. It looks like
> you're using quantmod <= 0.4.18.
>
> What R version are you using? At minimum, you should reinstall the
> packages that were built in R-3.5.3 in March-2019.
>
> Best,
> Josh
>
> On Mon, Nov 7, 2022 at 10:26 AM Frank  wrote:
> >
> > In running:
> >
> >
> > ##
> > ## Get S_500  from FRED
> > ##
> >
> > getSymbols('SP500', from = "2020-01-01", to = "2021-06-30",src='FRED')
> > SP500<-na.locf(SP500,na.rm = TRUE)
> > tail(SP500)
> > file_name <- "SP500.csv"
> > write.zoo(SP500, file = file_name, append = FALSE, quote = TRUE, sep = ",")
> > quit()
> >
> > I get:
> >
> > > library(quantmod)
> > Loading required package: xts
> > Loading required package: zoo
> >
> > Attaching package: 'zoo'
> >
> > The following objects are masked from 'package:base':
> >
> > as.Date, as.Date.numeric
> >
> > Loading required package: TTR
> > Warning messages:
> > 1: package 'xts' was built under R version 3.5.3
> > 2: package 'zoo' was built under R version 3.5.3
> > 3: package 'TTR' was built under R version 3.5.3
> > > library(chron)
> > NOTE: The default cutoff when expanding a 2-digit year to a 4-digit year
> > will change from 30 to 69 by Aug 2020 (as for Date and POSIXct in base R.)
> > Warning message:
> > package 'chron' was built under R version 3.5.3
> > >
> > >
> > > ##
> > > ## Get S_500  from FRED
> > > ##
> > >
> > > getSymbols('SP500', from = "2020-01-01", to = "2021-06-30",src='FRED')
> > 'getSymbols' currently uses auto.assign=TRUE by default, but will use
> > auto.assign=FALSE in 0.5-0. You will still be able to use 'loadSymbols' to
> > automatically load data. getOption("getSymbols.env") and
> > getOption("getSymbols.auto.assign") will still be checked for alternate
> > defaults.
> >
> > This message is shown once per session and may be disabled by setting
> > options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
> >
> > Error in getSymbols.FRED(Symbols = "SP500", env = , verbose =
> > FALSE,  :
> >   Unable to import "SP500".
> > schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE
> > (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is
> > received (e.g. handshake failed).
> > Calls: getSymbols -> do.call -> getSymbols.FRED Execution halted
> >
> > I got correct data as recently as
> >
> > 11/2/2022   44867   3759.69 3759.69 3759.69 3759.69 3759.69 3759.69
> >
> > Similar thing with getSymbols('DGS3MO',src='FRED').
> >
> > They both download correctly directly from FRED.
> >
> > Thanks,
> >
> > Frank
> > Chicago
> >
> > ___
> > 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.
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
>
> ___
> 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] PairTrading package

2020-09-21 Thread Daniel Cegiełka
Hi Alec,

$ R --version
R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

$ git clone https://github.com/cran/PairTrading
Cloning into 'PairTrading'...
remote: Enumerating objects: 39, done.
remote: Counting objects: 100% (39/39), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 39 (delta 11), reused 39 (delta 11), pack-reused 0
Unpacking objects: 100% (39/39), done.

$ ls
PairTrading

$ R CMD INSTALL PairTrading/
* installing to library 
‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’
* installing *source* package ‘PairTrading’ ...

(…)

** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (PairTrading)


Best regards,
Daniel


> On 21 Sep 2020, at 22:38, Alec Schmidt  wrote:
> 
> I used to have R version 3.6.0 and tried to install PairTrading but got a 
> message that the package is not available for that version.
> Now I've updated R to 4.0.2. but still have the message:
> 
> package �PairTrading� is not available (for R version 4.0.2)
> 
> I wonder if anything can be done about it or there may be other packages with 
> similar functionality.
> 
> Thanks! Alec
> 
>   [[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] Empty indicator / plot.window: need finite 'ylim' values

2020-08-17 Thread Daniel Cegiełka



> On 17 Aug 2020, at 22:42, Mike  wrote:

> Like Joshua wrote, indeed, I use chart_Series within a function.
> 
>> But your problem is here:
>> 
>> sample.xts[subset, 2]
> 
> Yes, not the main window is the issue, but the indicator is. So I
> have to ask more specific:
> 
> Can I plot a subset of chart and indicator where the indicator's
> subset is completely NA resulting in the indicator's plot region
> being left blank?
> 

you can try to force a value for ylim in the quantmod’s chart object:

x <- chart_Series (sample.xts[,1], subset=subset, TA=ta)

> x$Env$ylim
[[1]]
[1] 0 1
attr(,"fixed")
[1] FALSE

[[2]]
[1] 49.88096 50.67835
attr(,"fixed")
[1] FALSE

[[3]]
[1] 0 1
attr(,"fixed")
[1] FALSE

[[4]]
[1] -Inf  Inf
attr(,"fixed")
[1] FALSE


e.g.: 

> x$Env$ylim[[4]] <- structure(c(0, 1), 'fixed' = FALSE)
> 
> x$Env$ylim[[4]]
[1] 0 1
attr(,"fixed")
[1] FALSE

however, it is still overwritten:

> x  # or plot(x)
Error in plot.window(c(1, 21), c(NaN, NaN)) : need finite 'ylim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
> x$Env$ylim[[4]]
[1] -Inf  Inf
attr(,"fixed")
[1] FALSE



> Mike
> 
> 
> The new minimal reproducible:
> 
> library(quantmod)
> 
> my_plot_function <- function () {
>  data (sample_matrix)
>  sample.xts <- as.xts (sample_matrix[1:50,'Close'], dateFormat="POSIXct")
>  sample.xts <- cbind (sample.xts, NA)
>  sample.xts[50,2] <- 0
>  colnames (sample.xts) <- c('Close', 'Stops')
> 
>  ta <- list ("add_TA(sample.xts[,2])")
> 
>  # In the range to be plotted ta is completely NA 
>  subset <- '2007-01-10::2007-01-30'
> 
>  plot (chart_Series (sample.xts[,1], subset=subset, TA=ta))
> }
> 
> my_plot_function ()
> 
> ___
> 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] Empty indicator / plot.window: need finite 'ylim' values

2020-08-17 Thread Daniel Cegiełka



> On 17 Aug 2020, at 19:37, Joshua Ulrich  wrote:
> 
> On Mon, Aug 17, 2020 at 12:33 PM Daniel Cegiełka
> mailto:daniel.cegie...@gmail.com>> wrote:
>> 
>> 
>> 
>>> On 17 Aug 2020, at 04:55, Rasmus Liland  wrote:
>>> 
>>> Dear Mike,
>>> 
>>> if I change this line
>>> 
>>>  plot (chart_Series (sample.xts[,1], subset=subset, TA=ta))
>>> 
>>> to
>>> 
>>>  plot(chart_Series(sample.xts[subset,1], TA=ta))
>>> 
>>> A plot appears.  No errors.  Was this
>>> what you were looking for?
>>> 
>> 
>> 
>> Guys :)
>> 
>> chart_Series() is a plot env/func, so plot(chart_Series()) make no sense :)
>> 
> Except that it is necessary to wrap chart_Series() in a call to plot()
> if you call it from within a function, for loop, or any other
> situation where R's auto-printing is disabled.
> 

I agree, but in this example earlier it was pointless.

https://github.com/joshuaulrich/quantmod/blob/master/R/replot.R#L202

> c <- quantmod::current.chob()
> str(c)
Classes 'replot', 'environment'  

So print.replot() will call plot.replot() automatically.




> Cheers,
> Josh
> 
> 
>> 
>> Try:
>> 
>> chart_Series(sample.xts[subset,1], TA=ta)
>> 
>> ?chart_Series
>> 
>> But your problem is here:
>> 
>> sample.xts[subset, 2]
>> 
>> 
>> Best,
>> Daniel
>> 
>> 
>> 
>> 
>>> /Rasmus
>>> ___
>>> 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 <mailto:R-SIG-Finance@r-project.org> mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance 
>> <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.
> 
> 
> 
> --
> Joshua Ulrich  |  about.me/joshuaulrich <http://about.me/joshuaulrich>
> FOSS Trading  |  www.fosstrading.com <http://www.fosstrading.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] Empty indicator / plot.window: need finite 'ylim' values

2020-08-17 Thread Daniel Cegiełka



> On 17 Aug 2020, at 04:55, Rasmus Liland  wrote:
> 
> Dear Mike,
> 
> if I change this line
> 
>   plot (chart_Series (sample.xts[,1], subset=subset, TA=ta))
> 
> to 
> 
>   plot(chart_Series(sample.xts[subset,1], TA=ta))
> 
> A plot appears.  No errors.  Was this 
> what you were looking for?
> 


Guys :)

chart_Series() is a plot env/func, so plot(chart_Series()) make no sense :)


Try:

chart_Series(sample.xts[subset,1], TA=ta)

?chart_Series

But your problem is here:

sample.xts[subset, 2]


Best,
Daniel




> /Rasmus
> ___
> 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] periodReturn at the acutual day

2020-08-10 Thread Daniel Cegiełka



> On 10 Aug 2020, at 20:22, Pedro páramo  wrote:
> 
> Hi all,
> 
> I am using to make some statistical analysis this functions:
> 
> library(quantmod)
> getSymbols("^IBEX",src="yahoo",from="1998-01-01")
> MensualR = periodReturn(IBEX,period="monthly")
> AnualR = periodReturn(IBEX,period="yearly")
> 
> The thing is that if I print MensualR or AnualR they "show" data to the
> previous friday 07/08/2020
> 
> There is some way to obtain data to the actual date (not previous friday
> close).
> 


have you checked your data?

> last(IBEX, 3)
   IBEX.Open IBEX.High IBEX.Low IBEX.Close IBEX.Volume IBEX.Adjusted
2020-08-057073.27123.5   7027.7 7039.7   2087959007039.7
2020-08-067022.17046.1   6917.0 6957.9   2058473006957.9
2020-08-076929.16961.8   6876.7 6950.5   1841510006950.5

so what result do you expect?


>   [[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] Yahoo Finance Stock data (FTSEMIB.MI) Issue

2020-06-18 Thread Daniel Cegiełka



> On 18 Jun 2020, at 19:48, Rasmus Liland  wrote:
> 
> On 2020-06-18 18:48 +0200, Daniel Cegiełka wrote:
>> On 18 Jun 2020, at 16:58, Christopher Kromm wrote:
>>> 
>>> If I cannot get the data from Yahoo 
>>> Finance, are there alternative suggested 
>>> sources for an R user to get this data?
>> 
>> curl 
>> 'https://charts.borsaitaliana.it/charts/services/ChartWService.asmx/GetPrices'
>>  -H 'Connection: keep-alive' -H 'Accept: application/json, text/javascript, 
>> */*; q=0.01' -H 'DNT: 1' -H 'X-Requested-With: XMLHttpRequest' -H 
>> 'Content-Type: application/json; charset=UTF-8' -H 'Origin: 
>> https://charts.borsaitaliana.it' -H 'Sec-Fetch-Site: same-origin' -H 
>> 'Sec-Fetch-Mode: cors' -H 'Referer: 
>> https://charts.borsaitaliana.it/charts/Bit/SummaryChart.aspx?code=CB.FTSEMIB=en'
>>  -H 'Accept-Encoding: gzip, deflate, br' --data-binary 
>> '{"request":{"SampleTime":"1d","TimeFrame":"5y","RequestedDataSetType":"ohlc","ChartPriceType":"price","Key":"FTSEMIB.IDX","OffSet":0,"FromDate":null,"ToDate":null,"UseDelay":true,"KeyType":"Topic","KeyType2":"Topic","Language":"en-US"}}'
>>  --compressed > FTSEMIB.json
> 
> Dear Daniel Cegiełka,

Daniel :)

> that's a great answer!  Are you (or others) 
> able to elaborate more on how you determined 
> the headers to send?
> 

Let's start that web scraping is probably legal now (in US):

https://towardsdatascience.com/web-scraping-is-now-legal-6bf0e5730a78 
<https://towardsdatascience.com/web-scraping-is-now-legal-6bf0e5730a78>

Scraping requires some experience and intuition. There is no other way than web 
debugging - and each one is different. However, current web browsers are very 
powerful and have many useful add-ons. Sometimes it takes a minute, and 
sometimes it requires a lot of work. A good source for learning is getSymbols:

https://github.com/joshuaulrich/quantmod/blob/master/R/getSymbols.R 
<https://github.com/joshuaulrich/quantmod/blob/master/R/getSymbols.R>

And

https://stackoverflow.com/questions/44030983/yahoo-finance-url-not-working 
<https://stackoverflow.com/questions/44030983/yahoo-finance-url-not-working>

Best


> Best,
> Rasmus


[[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] Yahoo Finance Stock data (FTSEMIB.MI) Issue

2020-06-18 Thread Daniel Cegiełka


I did it quickly, but you can write some script in R.

curl and json (5 years):

curl 
'https://charts.borsaitaliana.it/charts/services/ChartWService.asmx/GetPrices' 
-H 'Connection: keep-alive' -H 'Accept: application/json, text/javascript, */*; 
q=0.01' -H 'DNT: 1' -H 'X-Requested-With: XMLHttpRequest' -H 'Content-Type: 
application/json; charset=UTF-8' -H 'Origin: https://charts.borsaitaliana.it' 
-H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-Mode: cors' -H 'Referer: 
https://charts.borsaitaliana.it/charts/Bit/SummaryChart.aspx?code=CB.FTSEMIB=en'
 -H 'Accept-Encoding: gzip, deflate, br' --data-binary 
'{"request":{"SampleTime":"1d","TimeFrame":"5y","RequestedDataSetType":"ohlc","ChartPriceType":"price","Key":"FTSEMIB.IDX","OffSet":0,"FromDate":null,"ToDate":null,"UseDelay":true,"KeyType":"Topic","KeyType2":"Topic","Language":"en-US"}}'
 --compressed > FTSEMIB.json


And try fromJSON() etc.

btw:

[159235200,19585.89,19625.63,19876.12,19487.39,19585.89]

159235200 <--- it looks like POSIX time in milliseconds :)

so you need an extra trick:

> x <- 159235200
> z <- x/1000
> z
[1] 1592352000
> class(z) <- 'POSIXct'
> z
[1] "2020-06-17 02:00:00 CEST"


Best regards,
Daniel



> On 18 Jun 2020, at 16:58, Christopher Kromm via R-SIG-Finance 
>  wrote:
> 
> To whom it may concern,
> 
> I am interested in the FTSE MIB (or Milano Indice di Borsa) index. I am
> trying to download the data up to the present date (18 June 2020). I am
> using the get.hist.quote command in R from the tseries package.
> 
> I noticed the FTSE MIB  from yahoo has no pricing of any kind (open,
> closed, adjusted, etc.) from 12 February 2018 to present. It appears from
> the Yahoo site that the prices exist to the present day based on the
> summary charts, but the other charts don't seem to show data. I am assuming
> this stock is still used, which is why I am a bit confused by all the
> missing data.
> 
> Is it possible to obtain this FTSE MIB data without all the missing data
> from Yahoo Finance?
> 
> If this is possible, how?
> 
> If I cannot get the data from Yahoo Finance, are there alternative
> suggested sources for an R user to get this data?
> 
> Thank you.
> 
> Here is the url and the Yahoo Finance data symbol.
> 
> https://finance.yahoo.com/quote/FTSEMIB.MI?p=FTSEMIB.MI
> 
> Symbol: FTSEMIB.MI
> 
>   [[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] Back testing Expected Shortfall

2020-06-10 Thread Daniel Cegiełka
śr., 10 cze 2020 o 21:14 alexios galanos  napisał(a):
>
>
>
> On 6/10/20 11:08 AM, Daniel Cegiełka wrote:
> > śr., 10 cze 2020 o 19:23 Brian G. Peterson  napisał(a):
> >>
> >> On Wed, 2020-06-10 at 15:08 +0530, Christofer Bogaso wrote:
> >>> I was looking for an idea how banks backtest their models for
> >>> Expected
> >>> Shortfall. Backtesting VaR is well documented but I failed to get any
> >>> practical idea about backtesting ES.
> >>>
> >>> Any pointer towards the best practice will be really helpful.
> >>
> >> If you are using Normal VaR, then you know the Expected Shortfall
> >> estimate too.
> >>
> >> If you are using a different mechanism, then of course the mean loss
> >> when the loss exceeds the VaR may be significantly different than the
> >> Normal ES.
> >>
> >> So, to backetesting...  the newest Basel standard replaces VaR with ES,
> >> and requires that banks justify their use of a particular ES model that
> >> they are using to calculate required regulatory capital.
> >
> > In my opinion, there is one aspect that introduces some confusion. ES
> > (CVaR) is now common, but many people, perhaps out of habit, maybe for
> > historical reasons, still use the term VaR instead of the correct name
> > (ES).
>
> Not sure I follow. VaR and ES are different measures. VaR is a
> quantile while ES is the average loss conditional on that quantile
> (i.e. the expected loss conditional that the loss is greater than
> the quantile of the loss distribution).

I agree that these names should not be confused. However, I
encountered that the _name_ "VaR" is used for ES. In my opinion, this
is due to a mental shortcut, or it's a historical habit. Such
imprecise use of the names often leads to misunderstanding.

Daniel

> Regards,
>
> Alexios
>
> >
> > Best regards,
> > Daniel
> >
> >
> >> Regards,
> >>
> >> Brian
> >>
> >>
> >> --
> >> Brian G. Peterson
> >> ph: +1.773.459.4973
> >> im: bgpbraverock
> >>
> >> ___
> >> 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@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] Back testing Expected Shortfall

2020-06-10 Thread Daniel Cegiełka
śr., 10 cze 2020 o 19:23 Brian G. Peterson  napisał(a):
>
> On Wed, 2020-06-10 at 15:08 +0530, Christofer Bogaso wrote:
> > I was looking for an idea how banks backtest their models for
> > Expected
> > Shortfall. Backtesting VaR is well documented but I failed to get any
> > practical idea about backtesting ES.
> >
> > Any pointer towards the best practice will be really helpful.
>
> If you are using Normal VaR, then you know the Expected Shortfall
> estimate too.
>
> If you are using a different mechanism, then of course the mean loss
> when the loss exceeds the VaR may be significantly different than the
> Normal ES.
>
> So, to backetesting...  the newest Basel standard replaces VaR with ES,
> and requires that banks justify their use of a particular ES model that
> they are using to calculate required regulatory capital.

In my opinion, there is one aspect that introduces some confusion. ES
(CVaR) is now common, but many people, perhaps out of habit, maybe for
historical reasons, still use the term VaR instead of the correct name
(ES).

Best regards,
Daniel


> Regards,
>
> Brian
>
>
> --
> Brian G. Peterson
> ph: +1.773.459.4973
> im: bgpbraverock
>
> ___
> 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] how to grow XTS series in R dynamically ? And Quickly!

2019-09-06 Thread Daniel Cegiełka


> Wiadomość napisana przez Vladimir Morozov  w dniu 
> 06.09.2019, o godz. 20:04:
> 
> Hi Daniel
> Thanks a lot.
> Those are very helpful ideas.
> 
> rbind_append --> it still has to allocate memory for the resulting series... 
> so if memory allocation was the main reason for slow performance, maybe 
> rbind_append doesn't change much? what do you think?
> 
> preallocating regular-interval time-series is a good idea.
> however financial data are irregularly spaced (sometimes there may not be any 
> price updates for a few secs, even more).
> even if we postulate that prices are allowed to change no more than once per 
> second, there's a lot of uses for the frequency of price updates, not only 
> the values of the prices (the simplest assumption is the poisson arrival 
> process for the updates, but there are many fancier, more powerful models...)
> so, pre-allocating a regularly spaced 1-sec interval xts series dumbs down 
> many things!
> 

let's start with what exactly do you want to do? Do you want to collect market 
data and save it to disk? Or maybe you want to have a real-time strategy? These 
are two different problems and require distinct solutions.

1) market data storage - why do you want to use R here? Isn't it better to dump 
the memory using mmap syscall and then import it into the database or R?

2) real-time market strategy in R - in this case your lookback is limited. So 
if you add new data point, you can also discard/drop the oldest. In this way, 
your memory usage will remain at the same low level. If this solution suits 
you, then you can write a fast function in C here that would operate on the xts 
object.

There is no such thing as matrix in R - this is a multidimensional vector. 
Let's say we have classic OHLC data for xts object:

O H L C
O H L C
O H L C
O H L C
O H L C


In the memory of the data looks like one long vector.

x: OHLC

You can be clever here and use memcpy():

memcpy( + 1, , (nrows(x) - 1)) * sizeof(double));  // or int - use: 
switch((TYPEOF(x))

memcpy(_p + 1, _p, (nrows(x) - 1)) * sizeof(double)); // or int for 
Date() type

This will move the memory so that the oldest value will be overwritten:

1 2 3 4 5   1 2 3 4 5   1 2 3 4 5   1 2 3 4 5
x: H   L  C   N

Then you can add a new index and value.

You will have preallocated memory at all times and you will use memory copy as 
little as possible. And the most important: you'll be operating on the xts 
object all time, so your code in R will be very fast :)

It is advanced solutions - you need to understand not only how R's internals 
works, but also have a good C skills. If you want to use R for real-time 
trading, it's worth learn these things.

Daniel





> i wish i could pre-allocate the vector for the values and maybe indices, but 
> then do the assignment of the sort:
> (say, in C++ i would have a method)
> price.set_next_point(time, value);
> 
> thanks!
> 
> On Sat, Sep 7, 2019 at 12:08 AM Daniel Cegiełka  <mailto:daniel.cegie...@gmail.com>> wrote:
> 
> 
> > Wiadomość napisana przez Daniel Cegiełka  > <mailto:daniel.cegie...@gmail.com>> w dniu 06.09.2019, o godz. 16:10:
> >
> 
> >
> > 2) preallocation
> >
> > preallocate_matrix <- function(n)
> > {
> > x <- matrix()
> > length(x) <- 4 * n  # bid, ask, bid_size, ask_size
> > dim(x) <- c(n, 4)   # see: ?dim
> > return(x)
> > }
> >
> > > x <- preallocate_matrix(5)
> > > x
> >  [,1] [,2] [,3] [,4]
> > [1,]   NA   NA   NA   NA
> > [2,]   NA   NA   NA   NA
> > [3,]   NA   NA   NA   NA
> > [4,]   NA   NA   NA   NA
> > [5,]   NA   NA   NA   NA
> 
> ?matrix
> 
> Usage
> matrix(data = NA, nrow = 1, ncol = 1, byrow = FALSE,
>dimnames = NULL)
> 
> so we don't even need preallocate_matrix() function
> 
> > x <- .xts(matrix(nrow = 5, ncol = 4), index = Sys.time() + 1:5)
> > x
> [,1] [,2] [,3] [,4]
> 2019-09-06 17:07:27   NA   NA   NA   NA
> 2019-09-06 17:07:28   NA   NA   NA   NA
> 2019-09-06 17:07:29   NA   NA   NA   NA
> 2019-09-06 17:07:30   NA   NA   NA   NA
> 2019-09-06 17:07:31   NA   NA   NA   NA
> 
> 
> 



signature.asc
Description: Message signed with OpenPGP
___
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] how to grow XTS series in R dynamically ? And Quickly!

2019-09-06 Thread Daniel Cegiełka


> Wiadomość napisana przez Daniel Cegiełka  w dniu 
> 06.09.2019, o godz. 16:10:
> 

> 
> 2) preallocation
> 
> preallocate_matrix <- function(n)
> {
> x <- matrix()
> length(x) <- 4 * n  # bid, ask, bid_size, ask_size
> dim(x) <- c(n, 4)   # see: ?dim
> return(x)
> }
> 
> > x <- preallocate_matrix(5)
> > x
>  [,1] [,2] [,3] [,4]
> [1,]   NA   NA   NA   NA
> [2,]   NA   NA   NA   NA
> [3,]   NA   NA   NA   NA
> [4,]   NA   NA   NA   NA
> [5,]   NA   NA   NA   NA

?matrix

Usage
matrix(data = NA, nrow = 1, ncol = 1, byrow = FALSE,
   dimnames = NULL)

so we don't even need preallocate_matrix() function

> x <- .xts(matrix(nrow = 5, ncol = 4), index = Sys.time() + 1:5)
> x
[,1] [,2] [,3] [,4]
2019-09-06 17:07:27   NA   NA   NA   NA
2019-09-06 17:07:28   NA   NA   NA   NA
2019-09-06 17:07:29   NA   NA   NA   NA
2019-09-06 17:07:30   NA   NA   NA   NA
2019-09-06 17:07:31   NA   NA   NA   NA





signature.asc
Description: Message signed with OpenPGP
___
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] how to grow XTS series in R dynamically ? And Quickly!

2019-09-06 Thread Daniel Cegiełka


> Wiadomość napisana przez Vladimir Morozov  w dniu 
> 06.09.2019, o godz. 04:51:
> 
> Dear xts experts
> 
> I use R and XTS to store dynamically growing price time-series for currency
> pair rates (e.g. time series of EUR/USD, EUR/JPY, etc growing with each new
> incoming market price - say, one per second).
> 
> 

(…)

> it all happens quite slowly in R. How do I accelerate it?


1) forgotten xts acceleration:

https://github.com/joshuaulrich/xts/blob/master/src/rbind.c#L540 


to activate it add the -DRBIND_APPEND flag to Makevars (linux/unix/macos) or 
Makevars.win (Windows), and recompile xts sources.



2) preallocation

preallocate_matrix <- function(n)
{
x <- matrix()
length(x) <- 4 * n  # bid, ask, bid_size, ask_size
dim(x) <- c(n, 4)   # see: ?dim
return(x)
}

> x <- preallocate_matrix(5)
> x
 [,1] [,2] [,3] [,4]
[1,]   NA   NA   NA   NA
[2,]   NA   NA   NA   NA
[3,]   NA   NA   NA   NA
[4,]   NA   NA   NA   NA
[5,]   NA   NA   NA   NA

Now you need xts index, eg:

i <- Sys.time() + 1:5
> i
[1] "2019-09-06 15:47:48 CEST" "2019-09-06 15:47:49 CEST" "2019-09-06 15:47:50 
CEST" "2019-09-06 15:47:51 CEST"
[5] "2019-09-06 15:47:52 CEST”


Our xts object:

> x <- .xts(x, index = i)
[,1] [,2] [,3] [,4]
2019-09-06 15:47:48   NA   NA   NA   NA
2019-09-06 15:47:49   NA   NA   NA   NA
2019-09-06 15:47:50   NA   NA   NA   NA
2019-09-06 15:47:51   NA   NA   NA   NA
2019-09-06 15:47:52   NA   NA   NA   NA


And now you can use this xts object without memory copying:


> x[1,] <- c(1, 2, 3, 4)
> x
[,1] [,2] [,3] [,4]
2019-09-06 15:47:481234
2019-09-06 15:47:49   NA   NA   NA   NA
2019-09-06 15:47:50   NA   NA   NA   NA
2019-09-06 15:47:51   NA   NA   NA   NA
2019-09-06 15:47:52   NA   NA   NA   NA

> x[2,] <- c(11, 22, 33, 44)
> x
[,1] [,2] [,3] [,4]
2019-09-06 15:47:481234
2019-09-06 15:47:49   11   22   33   44
2019-09-06 15:47:50   NA   NA   NA   NA
2019-09-06 15:47:51   NA   NA   NA   NA
2019-09-06 15:47:52   NA   NA   NA   NA


etc.

That's what you meant.

Best,
Daniel



signature.asc
Description: Message signed with OpenPGP
___
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] RobinHood R API

2019-04-08 Thread Daniel Cegiełka
Hi Steve,

I have never worked with RobinHood, but I have analyzed the code of
this package. Maybe my insights will be useful for you.

RobinHood, as well as Alpaca Markets, operate in the PFOF model
(payment for order flow). Your order does not go public, but is sold
to market makers. Is it good or bad? Currently, the PFOF model is
regulated by Regulation NMS[1] - your order must be filled at a price
equal to or better than the NBBO (National Best Bid and Offer) or best
price rule in short. In fact, most brokers work in the PFOF model too
- you pay a commission, but they sell your orders anyway. So RH and
Alpaca are fair here - if we make money from selling your order, you
do not pay commissions anymore. I explain this because I have noticed
that many people don't understand the RH and Alpaca's business model.

[1] https://www.investopedia.com/terms/r/regulation-nms.asp

As for this R package, it works in the request-response model. It's
not the best pattern for algo trading. Your application will have to
work in the so-called batch model:

repeat {
get_mktdata()
get_positions()
calc_model_and_risk()
place_orders()
sleep(x_min_or_even_more)
}

This is inefficient, so this solution is only suitable for very slow
models. It's difficult to manage the execution, so you should place
orders type of market.

The best pattern for algo trading is event-driven. Here you subscribe
to data stream (events) and your application responds to every new
message. IBrokers is written in this model:

https://github.com/joshuaulrich/IBrokers/blob/master/vignettes/RealTime.pdf

Your minimal strategy should look like this:

subscribe(c('AAPL', 'MSFT', 'GS'))

on_tick <- function()
{
(...)
place_order(...)
}

on_order <- function()
{
# accepted, rejected etc.
}

on_exec <- function()
{
}

on_system_event <- function()
{
}

# main event loop
run_strategy(host = 'api_server', port = 123, daemon = TRUE)


place_order() means submit  and subscribe orders events.

>From what I see, RobinHood R package wasn't designed to work in such
an event-driven model.

I hope that will be helpful for you.

Best regards,
Daniel






czw., 4 kwi 2019 o 19:28 Steve Hun via R-SIG-Finance
 napisał(a):


>
> hi,
> Has anyone used the RobinHood package for order management? For example, 
> dynamic stop level setting (in other words, not use standard trailing stop) 
> and filled order tracking?
> Thanks
> [[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] Free financial data - equities, equity options and ETFs - for quantmod package (or other packages)

2019-04-05 Thread Daniel Cegiełka
pt., 5 kwi 2019 o 05:34 James Hirschorn
 napisał(a):
>
> I looked into IQFeed for intraday stock data, and unfortunately they only
> provide historical 1-minute data for stocks that are currently traded. This
> is not good enough for one of the strategies I'm working on.
>
> I am looking into other alternatives and will post my findings in this
> thread.
>
> Please let me know if you have other suggestions for historical intraday
> stock data covering the S 500.

polygon.io - 6Y tick by tick history. $399/m if you are a pro (it's
rather cheap)
https://polygon.io/stocks

TradingPhysics - milliseconds resolution. You pay per symbol, but it
is often cheaper than buying the whole market data. They offer a lot
of HFT indicators if you want to be very active.
http://www.tradingphysics.com/Feeds/AvailableFeeds.aspx
http://www.tradingphysics.com/Resources/Specifications/HistoricalTimeAndSales.aspx

ActiveTick - 1-minute resolution or tick data (original, unfiltered
and unmodified format)
https://www.activetick.com/activetick/contents/MarketDataServicesDevelopers.aspx

Take into account that if you want to have regular time series, the
database in seconds or milliseconds will be huge.

Best regards,
Daniel

>
> James Hirschorn, Ph.D.
> *Quantitative Technologies*
> Toronto, Canada
> +1-647-929-0494
>
>
> On Thu, Apr 4, 2019 at 5:31 AM Brian G. Peterson 
> wrote:
>
> > quantmod supports multiple data sources, both paid and free.

___
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] Free financial data - equities, equity options and ETFs - for quantmod package (or other packages)

2019-04-04 Thread Daniel Cegiełka


> On 4 Apr 2019, at 11:31, Brian G. Peterson  wrote:
> 
> quantmod supports multiple data sources, both paid and free.
> 
> The documentation is installed with the package or you can find a pdf here:
> https://cran.r-project.org/web/packages/quantmod/quantmod.pdf
> 
> The code is here:
> https://github.com/joshuaulrich/quantmod/blob/master/R/getSymbols.R
> 
> For free daily data sources, I usually use Tiingo or Quandl in my public 
> talks.  These certainly have US equities and ETF's.
> 
> Especially for intraday data, expect to have to pay for it.  We have had good 
> luck with IQFeed on the low end of the cost scale. I am not aware of a simple 
> online source for historical options data.  Also, check if your broker has an 
> API.  e.g. Interactive Brokers(IB), TD Ameritrade, and Fidelity (at least) 
> all have programmatic ways of retrieving data.
> 

There is also ActiveTick. They have options. The prices depend on the number of 
subscribed instruments. Their API also works on Linux.

https://www.activetick.com/activetick/contents/MarketDataServicesPricing.aspx

https://www.activetick.com/activetick/contents/MarketDataServicesDevelopers.aspx

Best regards,
Daniel


> IB has an R package, as does Quandl.
> 
> For CSV data sources that would be downloaded from online, you can bring them 
> directly into R without having to go through the intermediary step of saving 
> the file to your local disk. R's data functions can use a url as a handle to 
> open a data stream (this is how quantmod's downloaders work, see the code 
> above).
> 
> Regards,
> 
> Brian



signature.asc
Description: Message signed with OpenPGP
___
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] Interaction with Alpha Vantage?

2017-11-06 Thread Daniel Cegiełka
2017-11-06 20:20 GMT+01:00 Daniel Cegiełka <daniel.cegie...@gmail.com>:
> 2017-11-06 19:37 GMT+01:00 Duncan Murdoch <murdoch.dun...@gmail.com>:
>
>>
>> I'm not so sure.  I haven't noticed any problems in their data (though I 
>> haven't done extensive testing), but in my opinion it is a bad sign if 
>> there's no way to contact them.
>
> e.g. 2004-11-01
>
>> GS['2004-10-28/2004-11-03','Low']
>  Low
> 2004-10-28 95.80
> 2004-10-29 97.43
> 2004-11-01  9.12
> 2004-11-02 98.50
> 2004-11-03 98.68

btw. data from Alpha Vantage (not from Google).

___
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] Interaction with Alpha Vantage?

2017-11-06 Thread Daniel Cegiełka
2017-11-06 19:37 GMT+01:00 Duncan Murdoch :

>
> I'm not so sure.  I haven't noticed any problems in their data (though I 
> haven't done extensive testing), but in my opinion it is a bad sign if 
> there's no way to contact them.

e.g. 2004-11-01

> GS['2004-10-28/2004-11-03','Low']
 Low
2004-10-28 95.80
2004-10-29 97.43
2004-11-01  9.12
2004-11-02 98.50
2004-11-03 98.68

___
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] Interaction with Alpha Vantage?

2017-11-06 Thread Daniel Cegiełka
And my implementation. Not finished, but works well for me...

Daniel


src.av.R
Description: Binary data
___
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] getting a subset corresponding to a list element

2017-05-26 Thread Daniel Cegiełka
2017-05-26 22:58 GMT+02:00 Michael Ashton :
> I'm not sure how to ask this with the proper terminology, but here goes:

> So, if I run the query with 3 symbols, I get a list with 3 elements. For 
> example, in this case, if

(...)

> But I don't WANT a list. I want a zoo object containing each of these as an 
> element.

Hi,
use my src.bloomberg.R custom code and try this:

require(xts)

# works with and without suffix 'Index' etc. :)

getSymbols.bloomberg(c('SPX', 'MXWO', 'MXEA'), from = as.Date(begdate))

# PX_LAST: SYM[,4] or Cl(SYM)
sym_data <- merge(SPX[,4], MXWO[,4], MXEA[,4])

tail(sym_data)

zoo_data <- as.zoo(sym_data)
tail(zoo_data)


btw. "to" arg is set as "to = Sys.Date() - 1" (EOD data)

getSymbols.bloomberg <- function(symbols = NULL, exchcode = 'US',
from = Sys.Date() - 365, to = Sys.Date() - 1, env = .GlobalEnv,
auto.assign, verbose, ...)

Best,
Daniel


src.bloomberg.R
Description: Binary data
___
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] Fwd: Error in addTxn - Quantstrat

2017-05-24 Thread Daniel Cegiełka
-- Forwarded message --



ok, I found a bug.

https://github.com/braverock/blotter/blob/master/R/addTxn.R#L81

as.Date("2017-01-01") return time-based object:

if(!is.timeBased(TxnDate) ){
TxnDate<-as.POSIXct(TxnDate)
}

and TxnDate != POSIXct

Best,
Daniel
diff -urN blotter.orig/R/addTxn.R blotter/R/addTxn.R
--- blotter.orig/R/addTxn.R 2017-05-24 21:24:42.0 +0200
+++ blotter/R/addTxn.R  2017-05-24 21:27:01.0 +0200
@@ -78,9 +78,10 @@
 
 PrevPosQty = getPosQty(pname, Symbol, TxnDate)
 
-if(!is.timeBased(TxnDate) ){
+if(is.timeBased(TxnDate) ){
 TxnDate<-as.POSIXct(TxnDate)
-}
+} else
+stop("TxnDate requires an appropriate time-based object")
 
 lastTxnDate <- end(Portfolio$symbols[[Symbol]]$txn)
 if (TxnDate < lastTxnDate) {
___
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] Error in addTxn - Quantstrat

2017-05-24 Thread Daniel Cegiełka
2017-05-24 19:45 GMT+02:00 Joshua Ulrich :
>
> This is a bug that was introduced here:
> https://github.com/braverock/blotter/commit/24b578628415111885d29ef97d5ab0eed1c7bb75


https://github.com/braverock/blotter/commit/24b578628415111885d29ef97d5ab0eed1c7bb75#diff-7347fe5a0f184f79ef064e92e3beb297R69

https://github.com/braverock/blotter/blob/master/R/addTxn.R#L85

why end() from stats?

https://github.com/braverock/blotter/blob/master/R/addTxn.R#L154

Should be end.xts(), eg:

end.xts <- function (x, ...)
{
if (!length(x)) {
index(x[length(.index(x)), ])
} else
index(x[NROW(x), ])
}

If I understood the problem correctly...

Best,
Daniel


>
>
>
> Here's a *minimal* reproducible example:
> require(blotter)
> currency("USD")
> initPortf("test", symbols="AAPL", currency="USD")
>
> addTxn("test", "AAPL", as.Date("2017-01-01"),  1, 10)
> addTxn("test", "AAPL", as.Date("2017-01-02"), -1, 10)
>
> Thanks for the report!  I'll work on a fix.
>
> Best,
> Josh
>

___
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] Yahoo Finance API change

2017-05-20 Thread Daniel Cegiełka
Maybe it would be better to add support for Alpha Vantage

http://www.alphavantage.co
http://www.alphavantage.co/#about

end examples:
http://www.alphavantage.co/documentation/

Daniel

___
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] PortfolioAttribution

2016-10-28 Thread Daniel Cegiełka
2016-10-28 16:04 GMT+02:00 fceci via R-SIG-Finance
:
>
> Hi everybody,
> first of all thanks for making the Rmetrics suite available to all. I really 
> find these libraries very useful.
> I have an issue installing the PortfolioAttribution package. The usual 
> command  
> install.packages("PortfolioAttribution",repos="http://R-Forge.R-project.org;) 
> does not work and indeed the link to the tar.gz 
> file:http://download.r-forge.r-project.org/src/contrib/PortfolioAttribution_0.3.tar.gz
> returns a 404 error.
> Is this package still available somewhere?
> Thanks! Frank
>

Hi Frank,

https://github.com/R-Finance/PortfolioAttribution

Best regards,
Daniel

___
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] tick data database

2016-02-02 Thread Daniel Cegiełka
2009-05-01 23:45 GMT+02:00 Hae Kyung Im :

> Hi,
>
> it may be slightly off topic but I was wondering if any of you heard
> about using netCDF format (or similar) to handle tick data?
>
> I thought kdb would be a nice option but the price seems a bit too
> high for my purpose. Do you know of any good open source alternative?
>
> Also is there any package to connect R with kdb?
>
>
Hi Haky,

If you want to have a database primarily for analysis, testing etc.:

http://www.cerebralmastication.com/wp-content/uploads/2010/06/RUG-Chicago-RYAN.pdf

http://files.meetup.com/1772780/Analyzing%20Big%20Data%20in%20R.pdf

Best regards,
Daniel

[[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] problem subsetting xts object with yearmon time index

2015-03-20 Thread Daniel Cegiełka
2015-03-20 18:18 GMT+01:00 Joshua Ulrich josh.m.ulr...@gmail.com:
 I can confirm this behavior with a simplified example using zoo 1.7-12
 and the latest development xts.

 data(sample_matrix)
 x - as.xts(sample_matrix)
 y - to.monthly(x)
 y['2007']
x.Open   x.Highx.Low  x.Close
 Feb 2007 50.22448 51.32342 50.19101 50.77091
 Mar 2007 50.81620 50.81620 48.23648 48.97490
 Apr 2007 48.94407 50.33781 48.80962 49.33974
 May 2007 49.34572 49.69097 47.51796 47.73780
 Jun 2007 47.74432 47.94127 47.09144 47.76719


 Thanks for the report.  I'll investigate.

 Best,
 Josh

hi,
I can not reproduce this error with zoo-1.7-12 and xts-0.8-0.

 getSymbols('MSFT')
[1] MSFT
 x - xts::to.monthly(MSFT)
 x['2015']
 MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
Jan 2015 46.66 47.9140.35  40.40   918956900 40.11
Feb 2015 40.59 44.3040.23  43.85   656204800 43.85
Mar 2015 43.67 44.1940.61  42.29   512133400 42.29
 x['2014']
 MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
Jan 2014 37.35 37.8934.63  37.84   930226200 36.57
Feb 2014 37.74 38.4635.69  38.31   705304500 37.30
Mar 2014 37.92 41.5037.49  40.99   778425700 39.91
Apr 2014 41.15 41.6638.90  40.40   746113500 39.34
May 2014 40.24 40.9738.51  40.94   574362900 40.15
Jun 2014 40.95 42.2939.86  41.70   555779700 40.89
Jul 2014 41.86 45.7141.05  43.16   731616500 42.32
Aug 2014 43.21 45.4742.21  45.43   513919700 44.83
Sep 2014 45.43 47.5744.53  46.36   860827300 45.74
Oct 2014 46.27 46.9742.10  46.95   853235700 46.33
Nov 2014 46.89 50.0546.73  47.81   522988700 47.47
Dec 2014 47.88 49.0644.90  46.45   626740700 46.12


Daniel

___
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] problems

2015-01-26 Thread Daniel Cegiełka
2015-01-26 21:03 GMT+01:00 Juanjo Fdez juanjosefernande...@hotmail.com:
 Dear all,

 i installed the R, and R Excel following these instructions

 http://homepage.univie.ac.at/erich.neuwirth/php/rcomwiki/doku.php?id=wiki:how_to_install

 then, I am trying to run this macro, but i get the message compillation 
 error   cant find the Project or library. Its running on exce 2010

 the macro worked fine previously in other computer with Excel 2003 and R 
 versión 2.15.2

 what am i doing wrong? thx


More information

There is a mailing list do discuss all the programs described above.
To subscribe, go to
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l.


http://homepage.univie.ac.at/erich.neuwirth/php/rcomwiki/doku.php?id=wiki:version_information_and_links

Best regards,
Daniel

___
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] problems

2015-01-26 Thread Daniel Cegiełka
2015-01-26 21:23 GMT+01:00 Juanjo Fdez juanjosefernande...@hotmail.com:
 Thx Daniel for that link its not working

 Enviado desde Surface

google... and bingo:

https://lists.univie.ac.at/mailman/listinfo/rcom-l

Daniel

___
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] blotter_0.9.1643 pennyPerShare() not reflecting addTxn usage

2014-10-31 Thread Daniel Cegiełka
2014-10-31 3:08 GMT+01:00 Gei Lin gmon...@gmail.com:
 within blotter::addTxn(), there's a call using the TxnFees argument as
 a function

 if (is.function(TxnFees)) *txnfees - TxnFees(TxnQty, TxnPrice)*

 pennyPerShare(), referenced as an example TxnFee function, doesn't
 have its arguments set to reflect this yet

 blotter::pennyPerSharefunction (TxnQty)
 {
 return(abs(TxnQty) * -0.01)
 }

It should be something like:

pennyPerShare - function(TxnQty, ...) {
return(abs(TxnQty) * -0.01)
}

thx,
Daniel

___
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] 'Defaults' removed from CRAN? (2014-10-03)

2014-10-08 Thread Daniel Cegiełka
Thank you for this information. This solves annoying problems that
have recently emerged in this topic, but as Mark pointed out, the
complete removal of Defaults may take much more time.

Best regards,
Daniel

___
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] blotter tradeStats Profit.factor is Infinite ?

2014-10-07 Thread Daniel Cegiełka
2014-10-07 7:38 GMT+02:00 Daniel Cegiełka daniel.cegie...@gmail.com:
 https://github.com/rforge/blotter/blob/master/pkg/blotter/R/tradeStats.R#L147

 GrossProfits - sum(PL.gt0)
 GrossLosses - sum(PL.lt0)
 if(GrossLosses == 0) ProfitFactor - NA
 else  ProfitFactor - abs(GrossProfits/GrossLosses)

more compact:

GrossProfits - sum(PL.gt0)
GrossLosses - sum(PL.lt0)
ProfitFactor - ifelse(GrossLosses == 0, NA, abs(GrossProfits/GrossLosses))

Maybe we should add more such checks to the code (for div ops)? eg:

AnnSharpe  - ifelse(StdDailyPL == 0, NA, AvgDailyPL/StdDailyPL * sqrt(252))
AvgWinLoss - ifelse(AvgLossTrade == 0, NA, AvgWinTrade/-AvgLossTrade)
MedWinLoss - ifelse(MedLossTrade == 0, NA, MedWinTrade/-MedLossTrade)
ProfitToMaxDraw  - ifelse(MaxDrawdown == 0, NA, -TotalNetProfit / MaxDrawdown)

btw. NA looks better than Inf.

Daniel

___
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] quantmod and yahoo historical data download error - did yahoo changed the url?

2014-09-18 Thread Daniel Cegiełka
2014-09-18 9:49 GMT+02:00 Samo Pahor samo.pa...@gmail.com:
 Hi,

 I am facing issues with downloading historical data from yahoo using
 quantmod this morning:
 [1] BAL
 Error in download.file(paste(yahoo.URL, s=, Symbols.name, a=, from.m,  :
   cannot open URL
 'http://ichart.finance.yahoo.com/table.csv?s=BALa=8b=17c=2014d=8e=18f=2014g=dq=qy=0z=BALx=.csv'
 In addition: Warning message:
 In download.file(paste(yahoo.URL, s=, Symbols.name, a=, from.m,  :
   cannot open: HTTP status was '404 Not Found'

 To me it looks like yahoo change urls (again?)

 rm(BAL)
 getSymbols(BAL)
[1] BAL
 tail(BAL)
   BAL.Open BAL.High BAL.Low BAL.Close BAL.Volume BAL.Adjusted
2014-09-0943.5044.23   43.50 44.03  1260044.03
2014-09-1043.9545.24   43.95 45.07  3050045.07
2014-09-1144.6745.84   44.67 45.69  4300045.69
2014-09-1245.4546.04   45.40 45.61  2960045.61
2014-09-1544.7644.76   44.00 44.17  1350044.17
2014-09-1643.9944.13   43.83 44.04   890044.04

looks ok.

Best regards,
Daniel

___
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] Ilya's Kipnis blog (quantstrat)

2014-08-26 Thread Daniel Cegiełka
http://quantstrattrader.wordpress.com/

Best regards,
Daniel

[[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] Ilya's Kipnis blog (quantstrat)

2014-08-26 Thread Daniel Cegiełka
2014-08-26 17:35 GMT+02:00 Ilya Kipnis ilya.kip...@gmail.com:

 Daniel,

 Was this a response to somebody's question, or are you just sending a
 link for the purpose of knowledge? In any case, thanks.

No, I just shared a link with the group. Thanks for such an amazing blog!

Daniel


 -Ilya


___
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] appending new data to a file with the mmap package

2014-07-23 Thread Daniel Cegiełka
2014-07-23 22:52 GMT+02:00 Claymore Marshall claymorejmarsh...@gmail.com:
 This is about Jeff Ryan's mmap package (for which documentation is sparse).

 My problem: I'm wondering what an effective way to *append* to an existing
 mmapped file which is already full of data would be. e.g. simple case: if
 the file contains 100 rows of data (as represented by mmap in R), I want to
 add say another 5 rows of new data, giving a new total of 105 rows of data.
 Surely many others have dealt with this problem before.  A common case
 would be appending new tick data to a large file via mmap.

 A quick search on SO gives a few discussions about remapping (mremap?) the
 mmap in general, as a method for appending to an existing mmapped file, but
 I haven't found that functionality to be available in the R mmap package.

I'm not sure if mremap is portable (e.g. windows).


 One related approach/solution, but not quite the same, as shown very kindly
 by the author of the code at http://censix.com/, is to update to a
 preallocated mmap in a file with a very large number of rows prefilled with
 NAs. But this approach requires making new files/volumes as the existing
 files fill up.  Furthermore, I'm not quite sure if there is a clean way to
 aggregate data for a given security which might be split across multiple
 files.  For example, say I have tick data files for each month; one for
 Jan, one for feb, one for march, etc.  Now suppose I want to pull into R
 the tick data just for 29 May 2014 to 3 June 2014, which is split across 2
 files?  I have to load into memory both files (or portions of them with
 mmap), and merge the data.  It would seem it would just be easier to append
 to one file to begin with, rather than split across files.

This solution makes sense and is called partitioning and used for
large data., e.g. ticks in kdb+

http://code.kx.com/wiki/Cookbook/LoadingFromLargeFiles

I'm afraid that partitioning can hit performance etc.

I hope that there will be more ideas here...
Best regards,
Daniel

___
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] Creating trading reports in pdf?

2013-08-12 Thread Daniel Cegiełka
Hi Mark,

http://timelyportfolio.blogspot.com/2013/03/one-pager-performance-report-with-knitr.html

http://timelyportfolio.blogspot.com/2013/03/production-quality-report-with-r-and.html

Best regards,
Daniel

___
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] Finding price difference of a time series

2013-08-04 Thread Daniel Cegiełka
2013/8/3 veepsirtt veepsi...@gmail.com:
 Hello Paul Teetor,

 p-value  is correct,still getting error.

 ht
 Augmented Dickey-Fuller Test

 data:  spreadT
 Dickey-Fuller = -2.2872, Lag order = 0, p-value = 0.4572
 alternative hypothesis: stationary
 ht$p-valueError in ht$p - value : non-numeric argument to binary operator


Hi Veepsirtt,

I think Paul is right. Take this example:

 a-list()
 a$p_value = 123
 a$p_value
[1] 123

 a$p-value = 456
Error in a$p - value = 456 : could not find function --
 a
$p_value
[1] 123

So with p-value variable you have a lot of potential to generate errors.

Best regards,
Daniel

___
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] Hands-on Webinar: Advances in Regression: Modern Ensemble and Data Mining Approaches (no charge)

2013-03-20 Thread Daniel Cegiełka
Hi Lisa,
Would you finally stop spamming this list? Does your products have
something to do with R?

thx,
Daniel

___
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] intraday historical data

2013-03-12 Thread Daniel Cegiełka
http://www.lmax.com/trading-tech/access

free real-time FX market data (without delay) and exchange access
(paper and live trading on LMAX MTF). json/xml via https or FIX-4.4
(ssl).

Best regards,
Daniel

___
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] FIX engine integration

2013-02-17 Thread Daniel Cegiełka
my two cents:

1. keep FIX (engine) outside of R (instances).

2. use rzmq/zeromq as middleware between the FIX engine and R (multi-instances):
http://www.zeromq.org/
https://github.com/armstrtw/rzmq

3. use filtering per topic (symbol subscribe):
http://www.zeromq.org/whitepapers:message-matching

4. You can use QuickFIX but a better option may be a fix8:
http://fix8.org/

Best regards,
Daniel

___
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] Plot GBM density in a 3 d plot

2012-11-28 Thread Daniel Cegiełka
Hi, this may be useful as an example:

http://www.quantmod.com/examples/chartSeries3d/
http://www.quantmod.com/examples/chartSeries3d/chartSeries3d.alpha.R

Best regards,
Daniel

[[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] beyond GPU support, 16+ cores, low power consumption, under $100 (64 cores for $200)?

2012-10-19 Thread Daniel Cegiełka
2012/10/18 Dan Rie d...@portfoliointelligence.com:
 This may not be DIRECTLY relevant to r-sig-finance, but I'm sure that it's of 
 interest to some of us.

Hi Dan,
I heard about this project before and I'm sure that it great platform
for R and finance. See, for example, Redline InRush Accelerated Ticker
Plant:

http://www.redlinetrading.com/products/ticker_plant/

this is the Cell processor specializing in parallel processing of
market data. Parallella also can be used in such an applications etc.

Put this information on Linkedin's finance groups. I hope that this
project will succeed.

Best regards,
Daniel

___
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] xts and Sys.time() - very stange behaviour

2012-08-01 Thread Daniel Cegiełka
 Note that this isn't likely the cause, unless you are concurrently
 doing something like as.character(index(x))==2001-01-01 08:30:01.999
 with an xts object.  That will convert the internal representation of
 the _entire_ index from double to time, whatever class that may be,
 and then to character!.

 If you use xts subsetting itself, the 'character' turns into a POSIXct
 for the value you are trying to match against.  So you only incur
 _one_ conversion (instantaneous).  This numeric value is then search
 for via binary search (i.e. O(log n) cost - more or less).  For
 anything like tick data, binary search is going to be much faster than
 a linear scan.

 Anyway, all the above still fails you if you catch a floating point
 issue.  I've got some ideas (no code) on a better way to do this of
 course...

Interesting discussion. This can be solved by using a uint64_t for the
timestamp index (date+time) - fast binary search would be still
available. Package providing int64 types in R:

http://cran.r-project.org/web/packages/int64/index.html

Daniel

___
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] Spread discovery and backtester code

2012-05-22 Thread Daniel Cegiełka
2012/5/22 Whit Armstrong armstrong.w...@gmail.com


 Also, nice move on the tslib submodules!

 -Whit


tslib and xts.

I didn't see needs to enter a password when opening.

regards,
Daniel

[[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] Spread discovery and backtester code

2012-05-22 Thread Daniel Cegiełka


 I could only find one other instance where you thought someone
 responded to you in a manner which deters people from making a
 contribution and it seemed like you were very quick to assume that
 Daniel was being rude when he was just being brief (and English isn't
 his native language).


I wrote my message very quickly - I wasn't able to write msg. There was no
password needed to open it. Code uses the xts and a lot from tslib, so the
question about licenses are very reasonable. So Chris please don't be
surprised that your code was coldly received.

best regards,
Daniel




  Chris.
 

 Best,
 --
 Joshua Ulrich  |  FOSS Trading: www.fosstrading.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] Are there genetic algorithm for trading strategy evolution in R?

2012-03-08 Thread Daniel Cegiełka
Let me add my two cents. Old Max Dama blog (mirror):

http://smartdatacollective.com/maxdama/22571/voodoo-spectrum-machine-learning-and-data-sets

Optimization is good to examine the sensitivity of the model and the
selection of appropriate parameters - this is useful. But playing with the
evolutionary strategy, what you Michael ask, is very risky.

regards,
Daniel



2012/3/8 Patrick Burns patr...@burns-stat.com

 Comments inline.


 On 08/03/2012 18:16, Michael wrote:

 Thanks folks!

 After digging further on the Internet, I have the following questions:

 Q1: I read the following article:

 http://cran.r-project.org/web/**packages/DEoptim/vignettes/**
 DEoptimPortfolioOptimization.**pdfhttp://cran.r-project.org/web/packages/DEoptim/vignettes/DEoptimPortfolioOptimization.pdf

 It seems that there are a bunch of parameters in this optimizer and the
 results are sensitive to these parameters.

 So there is another layer of optimization with respect to these optimizer
 parameters.

 Is the tweaking of these optimizer parameters data-mining, which will
 lead to data-snooping bias?


 I wouldn't think so, but there might be
 a way to manage it.



 Q2: Due to the random nature of the optimizer, each time you run the
 backtest, you will have different performance.

 What do you do in that case?


 That may be a good thing, if you are
 willing to use it.

 In what I've done on backtesting:

 http://www.portfolioprobe.com/**2010/11/05/backtesting-almost-**wordless/http://www.portfolioprobe.com/2010/11/05/backtesting-almost-wordless/

 I show how to assess whether the strategy
 is better than luck by using random trades.

 The standard thing to assume (as I do in
 that piece) is that the optimization is
 noiseless.  But really the optimization
 depends on a multitude of subtle influences.
 Even if you always got the exact global
 optimum, if a variance or expected return
 were slightly different, you could get a
 very different path.  The optimal path
 is fuzzy in actuality.



 So for out-of-sample real-trading, we are trading a random strategy?


 Yes.  But the inputs are random so even
 non-stochastic optimizers give you a
 random strategy in a sense.



 Q3: It's pretty easy to understand using Genetic Algorithms to serve as a
 replacement for regular optimizers;

 but using Genetic Algorithms to evolve trading strategies seem to be
 different. Anywhere we could find such an example in R?


 Yes, that is different.

 In 
 https://stat.ethz.ch/**pipermail/r-sig-finance/**2010q4/007033.htmlhttps://stat.ethz.ch/pipermail/r-sig-finance/2010q4/007033.html
 you can find Josh quoting me quoting Lao-Tzu
 on why you are unlikely to find much useful
 on that subject.

 Pat






 On Thu, Mar 8, 2012 at 8:25 AM, Zachary Mayerzach.ma...@gmail.com
  wrote:

  There is the DEoptimhttp://cran.r-project.**org/web/packages/DEoptim/**
 index.html 
 http://cran.r-project.org/web/packages/DEoptim/index.htmllibrary
 in r, which is an excellent library for differential evolution.  If
 you can define your trading strategy in terms of a bunch of parameters to
 adjust and an objective function (i.e. turn it into an optimization
 problem), DEoptim will help you find the minimum (or maximum).

 DEoptim works well on non-differentiable problems with many local minima.
  Here is an example of using it to solve a portfolio optimization
 problem:

 http://cran.r-project.org/web/**packages/DEoptim/vignettes/**
 DEoptimPortfolioOptimization.**pdfhttp://cran.r-project.org/web/packages/DEoptim/vignettes/DEoptimPortfolioOptimization.pdf



 On Thu, Mar 8, 2012 at 12:43 AM, Sofian Hadiwijayareztinpeace@gmail.**
 com reztinpe...@gmail.comwrote:

  how about quantmod library..

 On Wed, Mar 7, 2012 at 10:30 PM, Michaelcomtech@gmail.com  wrote:

  Hi all, Good morning, good afternoon and good evening!

 Could anybody please kindly point me to resources in R which shows
 about
 how to use Genetic algorithm to evolve trading strategies?

 I did a lot search on Google these days and certainly it's a

 well-covered

 and popular topic, but I don't see anywhere in R...

 Thanks a lot!

[[alternative HTML version deleted]]

 __**_
 R-SIG-Finance@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-sig-financehttps://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-financehttps://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]]

 

Re: [R-SIG-Finance] RBloomberg hanging on blpConnect()

2012-02-01 Thread Daniel Cegiełka
http://open.bloomberg.com/

MIT-style license:

http://open.bloomberg.com/pdf/bbg-eps-open-market-data.pdf

Bloomberg is now addressing the problem of proprietary programming
interfaces by opening the Bloomberg API, or
BLPAPI, for free use under a nonrestrictive MIT-style license. BLPAPI is a
proven interface that supports both
publish/subscribe and request/response paradigms and is the common access
point to Bloomberg market data
distribution products, including Desktop API, Server API, Managed B-Pipe
and Platform service products.


Nice news for RBloomberg :)

best regards,
daniel





2012/2/1 John Laing john.la...@gmail.com

 There are numerous threads here on this issue. Please make sure that
 your Bloomberg API is up-to-date (WAPI GO) and that you have a
 current version of Java installed.

 John

 On Wed, Feb 1, 2012 at 2:16 PM, Calvin calvin.li...@gmail.com wrote:
  Hi all,
 
  I am trying to get RBloomberg working with R version 2.14.1.  Here are my
  current package versions:
 
   R version 2.14.1
   rJava version 0.9-3
   RBloomberg Version 0.4-150
 
  When I call blpConnect (no arguments), then R basically hangs until I
 shut
  it down.  I had RBloomberg working with a much older version (pre: Java
  dependency), but I am having trouble with the latest version.  Also, I
  believe I have the latest versions of the Bloomberg API installed.
 
  Are there any further steps I can take to debug this issue?
 
  Thank you very much for any help!
 
  -Calvin
 
 [[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.


[[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] Blotter Package Installation

2012-01-03 Thread Daniel Cegiełka
similar problem:

http://r.789695.n4.nabble.com/Package-quot-quantstrat-quot-td3599657.html

regards,
daniel



2012/1/3 Jeffrey Ryan jeffrey.r...@lemnica.com

 The exact commands you run are required for us to help.

 That said, the package is on R-forge, not CRAN so adjust accordingly.
 Additionally, binaries may or may not be available - so having
 developer tools is recommended (always) to build from sources.

 HTH
 Jeff

 On Tue, Jan 3, 2012 at 12:06 PM, Julien Hébert Nguyen
 julien.he...@gmail.com wrote:
  Hi,
 
  I'm sorry if I should direct my post to a more appropriate forum, but I'm
  at loss.
  I've recently reinstalled R on my computer(s) and can't seem to install
 the
  blotter package on any of them.
 
  My Windows computers are running R 2.14.1
  My Mac computer is running R 2.14.0
  All are using Rstudio.
 
  I've tried installing the package, but I get the following error message:
 
  Installing package(s) into
  ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library’
  (as ‘lib’ is unspecified)
  Warning in install.packages :
  package ‘blotter’ is not available (for R version 2.14.0)
 
  Could someone guide me on how to resolve this issue. I've searched past
  blotter discussions but can't seem to find what to do to address this
  particular issue.
 
  Thanks!
 
  J.
 
 [[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.



 --
 Jeffrey Ryan
 jeffrey.r...@lemnica.com

 www.lemnica.com
 www.esotericR.com

 ___
 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] Blotter Package Installation

2012-01-03 Thread Daniel Cegiełka
2012/1/3 Julien Hébert Nguyen julien.he...@gmail.com

 Sorry for this other email, but I'm slow at this.
 I'm currently downloading xcode in the hope that it will allow me to
 install the blotter package.

 In the meantime, I've tried the approach proposed by Daniel in this
 following thread:
 http://r.789695.n4.nabble.com/Package-quot-quantstrat-quot-td3599657.html

 It doesn't work for Blotter since I need to install FinancialInstrument
 beforehand (dependencies). This being said, when I download and unpack the
 FinancialInstrument Source (.tar) from the TradeAnalytics development page
 it doesn't unpack in a folder like blotter, but rather gives me a .tar.cpgz
 file. Now I'm confused as to what to do with it since the *R CMD
 build*command doesn't seem to work on it.





2012/1/3 Julien Hébert Nguyen julien.he...@gmail.com

 Sorry for this other email, but I'm slow at this.
 I'm currently downloading xcode in the hope that it will allow me to
 install the blotter package.

 In the meantime, I've tried the approach proposed by Daniel in this
 following thread:
 http://r.789695.n4.nabble.com/Package-quot-quantstrat-quot-td3599657.html

 It doesn't work for Blotter since I need to install FinancialInstrument
 beforehand (dependencies). This being said, when I download and unpack the
 FinancialInstrument Source (.tar) from the TradeAnalytics development page
 it doesn't unpack in a folder like blotter, but rather gives me a .tar.cpgz
 file.


use snapshot from url (r-forge):
https://r-forge.r-project.org/snapshots.php?group_id=316


danice@entropy ~/rtmp $ ls -l
total 2632
-rw-r--r-- 1 danice 500 2692665 Jan  3 22:38 blotter-scm-latest.tar.gz
danice@entropy ~/rtmp $ tar xvf blotter-scm-latest.tar.gz

danice@entropy ~/rtmp $ ls -l
total 2636
drwxr-xr-x 6 danice 5004096 Jan  3 03:09 blotter-scm-2012-01-03
-rw-r--r-- 1 danice 500 2692665 Jan  3 22:38 blotter-scm-latest.tar.gz
danice@entropy ~/rtmp $ cd blotter-scm-2012-01-03/
.svn/   README  pkg/tags/   www/
danice@entropy ~/rtmp $ cd blotter-scm-2012-01-03/pkg/
danice@entropy ~/rtmp/blotter-scm-2012-01-03/pkg $ ls -l
total 16
drwxr-xr-x 9 danice 500 4096 Jan  3 03:09 FinancialInstrument
drwxr-xr-x 8 danice 500 4096 Jan  3 03:09 RTAQ
drwxr-xr-x 8 danice 500 4096 Jan  3 03:09 blotter
drwxr-xr-x 9 danice 500 4096 Jan  3 03:09 quantstrat
danice@entropy ~/rtmp/blotter-scm-2012-01-03/pkg $


danice@entropy ~/rtmp/blotter-scm-2012-01-03/pkg $ R CMD build
FinancialInstrument
* checking for file 'FinancialInstrument/DESCRIPTION' ... OK
* preparing 'FinancialInstrument':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* re-saving tabular files
* building 'FinancialInstrument_0.10.1.tar.gz'

danice@entropy ~/rtmp/blotter-scm-2012-01-03/pkg $ R CMD build blotter
* checking for file 'blotter/DESCRIPTION' ... OK
* preparing 'blotter':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'blotter_0.8.4.tar.gz'

danice@entropy ~/rtmp/blotter-scm-2012-01-03/pkg $ R CMD build quantstrat
* checking for file 'quantstrat/DESCRIPTION' ... OK
* preparing 'quantstrat':
* checking DESCRIPTION meta-information ... OK
* excluding invalid files
Subdirectory 'man' contains invalid file names:
  '.onLoad.Rd'
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory 'quantstrat/inst/doc'
Removed empty directory 'quantstrat/inst'
* looking to see if a 'data/datalist' file should be added
* building 'quantstrat_0.6.1.tar.gz'

danice@entropy ~/rtmp/blotter-scm-2012-01-03/pkg $ ls -l
total 288
drwxr-xr-x 9 danice 500   4096 Jan  3 03:09 FinancialInstrument
-rw-r--r-- 1 danice 500 139768 Jan  3 22:41
FinancialInstrument_0.10.1.tar.gz
drwxr-xr-x 8 danice 500   4096 Jan  3 03:09 RTAQ
drwxr-xr-x 8 danice 500   4096 Jan  3 03:09 blotter
-rw-r--r-- 1 danice 500  49993 Jan  3 22:41 blotter_0.8.4.tar.gz
drwxr-xr-x 9 danice 500   4096 Jan  3 03:09 quantstrat
-rw-r--r-- 1 danice 500  80197 Jan  3 22:42 quantstrat_0.6.1.tar.gz
danice@entropy ~/rtmp/blotter-scm-2012-01-03/pkg $

and install:

R CMD INSTALL FianancialInstrument_*
R CMD INSTALL blotter_*
R CMD INSTALL quantstrat_*

regards,
daniel

[[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] msts command in the forecast package?

2011-12-12 Thread Daniel Cegiełka
2011/12/12 Michael comtech@gmail.com

 Hi all,

 When I tried to use the msts command in the Forecast package...


  fcast - msts(as.vector(my data), c(4, 40))

 Error: could not find function msts


Have you loaded the forecast package?

 library(forecast)







 What could be the problem? I had made sure that the library(forecast) has
 been used...

 Thank you!

[[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] nice time series viewer?

2011-12-07 Thread Daniel Cegiełka
http://www.quantmod.com/examples/charting/

http://www.quantmod.com/documentation/zoomChart.html

xts+quantmod (+sweave) is a very good solution for most applications.

regards,
Daniel


2011/12/7 Michael comtech@gmail.com

 Hi all,

 I am looking for a nice time series grapher/viewer in R ... with the
 feature of scrolling, zooming, etc.

 Hopefully it could be of the quality at the
 report-generation-and-sending-to-boss level...

 Could anybody please give me some recommendations/pointers?

 Thanks a lot!

 ___
 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] How to get name of a ticker using Quantmod/R

2011-11-27 Thread Daniel Cegiełka
2011/11/28 George Kumar grgkum...@gmail.com:
 Just to add more information to my original post.

 Suppose I have a ticker like CSCO or a mutual fund like AAUTX

 I would like to be able to get the full name of the companies using some
 R/quantmod package.

 For CSCO -- Cisco Systems, Inc.
 for AAUTX - Thrivent Large Cap Value A


Such information you can hold in a FinancialInstrument package or using
xtsAttributes from xts.

https://r-forge.r-project.org/scm/viewvc.php/pkg/?root=blotter

or with xtsAttributes:

 getSymbols('CSCO')[1] CSCO str(xtsAttributes(CSCO))List of 2
 $ src: chr yahoo
 $ updated: POSIXct[1:1], format: 2011-11-28 06:56:16
xtsAttributes(CSCO) - list(FullName = Cisco Systems, Inc.)
str(xtsAttributes(CSCO))List of 3
 $ src : chr yahoo
 $ updated : POSIXct[1:1], format: 2011-11-28 06:56:16
 $ FullName: chr Cisco Systems, Inc. attributes(CSCO)$FullName[1]
Cisco Systems, Inc.




best regards,
Daniel




 Thanks again.
 George

 --
 View this message in context:
http://r.789695.n4.nabble.com/How-to-get-name-of-a-ticker-using-Quantmod-R-tp4114044p4114124.html
 Sent from the Rmetrics mailing list archive at Nabble.com.

 ___
 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] marketdata in qsiblive

2011-10-19 Thread Daniel Cegiełka
try in R console:

?save
?load

save(file=name.RData)
save.image(name.RData)

load(name.RData)

daniel


2011/10/19 Xiaofang sfan.st...@gmail.com:
 Hi there,
 I am now trying the qsiblive by Soren, and it requires a daily marketdata
 file, just I have not figured out how to create such a rdata file, what kind
 of data to be included? can anyone give me a hint on this?

 Thanks in advance
 Fan

        [[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] real time data and quantmod

2011-10-18 Thread Daniel Cegiełka
I think the key to do this will be a xts package. You only need to
specify (and implement) how you want to build xts objects from a real
time market data stream. See also IBrokers and how concurrent
programming works there.

btw. getSymbols() is just a wrapper witch import data from source to
xts object (OHLCV+Adj).

best regards,
daniel


2011/10/18 Simone Gogna singletontheb...@msn.com:
 Hi,
 is there any way to combine the quantmod package with real time stock and 
 index data?

 getSymbols only provides me with historical data only.

 thanks
 Simone
        [[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] Data (Was: TZs)

2011-10-14 Thread Daniel Cegiełka
http://blog.joda.org/2011/10/time-zone-database-rebooted.html

regards,
daniel



2011/10/7 Jeffrey Ryan jeffrey.r...@lemnica.com:
 Posting simple graphs, even raw data is *likely* to be okay for three reasons:

 1) No one will care. Yahoo, CME, etc would gain little in preventing
 this or tracking it.
 2) No one could tell were your data comes from anyway - especially if
 it is graph.
 3) Fair Use

 of course, I am not a lawyer...

 Jeff


 On Fri, Oct 7, 2011 at 1:11 PM, Andrew Miller amill...@illinois.edu wrote:
 Thank you for all of your responses, they have helped a lot.

 One thing that interests me is how much analysis would have to be done to
 distribute the graphs?  For example, would posting a simple graph of the
 price history, or the spread between two futures be acceptable without
 license? Or would only more involved graphs be acceptable?

 Thanks again,

 -Andrew

 On Fri, Oct 7, 2011 at 12:44 PM, Dirk Eddelbuettel e...@debian.org wrote:


 On 7 October 2011 at 12:05, Brian G. Peterson wrote:
 | On Fri, 2011-10-07 at 11:12 -0500, Dirk Eddelbuettel wrote:
 |  Google/Yahoo actually pay the exchanges. That came up when Google
 |  started to show real-time data in an Ajax-y form (that you can easily
 |  program against) and some news stories at the time reported what deal
 |  Google had struck with the NYSE etc.
 |
 | Of course they paid the exchange.  So Google/Yahoo (obviously) have
 | redistribution rights.
 |
 | The 'terms of use' almost certainly don't allow *you* to redistribute
 | that *data* though.  Thus my comment about consulting relevant
 | contracts.

 Agreed. My response merely aimed to dash some cold water on your statement

   take advantage of 'loopholes' in the data pull methodologies provided by
   Yahoo/Google/etc.

 as this is in fact not a loophole. The cgi interface at Yahoo! is fully
 aware
 of people programming against it, and I have both supported that interface
 (via the Finance::YahooQuote module in the godforsaken Perl language) for
 users, and deployed it daily myself for about a dozen years. No issue
 there:
 Yahoo pays, we get to use it, I doubt we can redistribute, consult a lawyer
 for details, news at eleven.

 Andrew also asked about the dissemination of derived analysis (graphs etc).
 which I think that is fine because that is your work rather that their raw
 data.  IANAL.

 Dirk

 PS There was also a 'not' missing in my 'program easily against ajax-y'. It
 is not easy, or we all would have 'free' quasi-real-time data now.

 --
 New Rcpp master class for R and C++ integration is scheduled for
 San Francisco (Oct 8), more details / reg.info available at

 http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php

 ___
 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.




 --
 Jeffrey Ryan
 jeffrey.r...@lemnica.com

 www.lemnica.com
 www.esotericR.com

 ___
 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] Data (Was: TZs)

2011-10-07 Thread Daniel Cegiełka
interesting studies:

http://www.techdirt.com/articles/20111006/11532316235/astrolabe-claims-it-holds-copyright-timezone-data-sues-maintainers-public-timezone-database.shtml

http://www.thedailyparker.com/PermaLink,guid,c5f28bae-4b9c-41ea-b7b7-8891ad63c938.aspx

best,
daniel




2011/10/7 Andrew Miller amill...@illinois.edu:
 Thank you for all of your responses, they have helped a lot.

 One thing that interests me is how much analysis would have to be done to
 distribute the graphs?  For example, would posting a simple graph of the
 price history, or the spread between two futures be acceptable without
 license? Or would only more involved graphs be acceptable?

 Thanks again,

 -Andrew

 On Fri, Oct 7, 2011 at 12:44 PM, Dirk Eddelbuettel e...@debian.org wrote:


 On 7 October 2011 at 12:05, Brian G. Peterson wrote:
 | On Fri, 2011-10-07 at 11:12 -0500, Dirk Eddelbuettel wrote:
 |  Google/Yahoo actually pay the exchanges. That came up when Google
 |  started to show real-time data in an Ajax-y form (that you can easily
 |  program against) and some news stories at the time reported what deal
 |  Google had struck with the NYSE etc.
 |
 | Of course they paid the exchange.  So Google/Yahoo (obviously) have
 | redistribution rights.
 |
 | The 'terms of use' almost certainly don't allow *you* to redistribute
 | that *data* though.  Thus my comment about consulting relevant
 | contracts.

 Agreed. My response merely aimed to dash some cold water on your statement

   take advantage of 'loopholes' in the data pull methodologies provided by
   Yahoo/Google/etc.

 as this is in fact not a loophole. The cgi interface at Yahoo! is fully
 aware
 of people programming against it, and I have both supported that interface
 (via the Finance::YahooQuote module in the godforsaken Perl language) for
 users, and deployed it daily myself for about a dozen years. No issue
 there:
 Yahoo pays, we get to use it, I doubt we can redistribute, consult a lawyer
 for details, news at eleven.

 Andrew also asked about the dissemination of derived analysis (graphs etc).
 which I think that is fine because that is your work rather that their raw
 data.  IANAL.

 Dirk

 PS There was also a 'not' missing in my 'program easily against ajax-y'. It
 is not easy, or we all would have 'free' quasi-real-time data now.

 --
 New Rcpp master class for R and C++ integration is scheduled for
 San Francisco (Oct 8), more details / reg.info available at

 http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php

 ___
 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] Filtering dates/times from zoo/xts series

2011-09-26 Thread Daniel Cegiełka
2011/9/26 chrisbird ch...@chrisbird.com

 Thanks Brian,

 I did try using the ['T09:00/T21:00'] method for extraction but it did not
 return anything - I will reinvestigate this and see if I can get it
 working.


It works... you are sure that the data was ok? Very strange that you have
received nothing...

 d-xts(1:25, Sys.time() + 1:25) d[,1]
2011-09-26 13:26:551
2011-09-26 13:26:562
2011-09-26 13:26:573
2011-09-26 13:26:584
2011-09-26 13:26:595
2011-09-26 13:27:006
2011-09-26 13:27:017
2011-09-26 13:27:028
2011-09-26 13:27:039
2011-09-26 13:27:04   10
2011-09-26 13:27:05   11
2011-09-26 13:27:06   12
2011-09-26 13:27:07   13
2011-09-26 13:27:08   14
2011-09-26 13:27:09   15
2011-09-26 13:27:10   16
2011-09-26 13:27:11   17
2011-09-26 13:27:12   18
2011-09-26 13:27:13   19
2011-09-26 13:27:14   20
2011-09-26 13:27:15   21
2011-09-26 13:27:16   22
2011-09-26 13:27:17   23
2011-09-26 13:27:18   24
2011-09-26 13:27:19   25 d[2011-09-26 13:27:00/2011-09-26 13:27:10]
   [,1]
2011-09-26 13:27:006
2011-09-26 13:27:017
2011-09-26 13:27:028
2011-09-26 13:27:039
2011-09-26 13:27:04   10
2011-09-26 13:27:05   11
2011-09-26 13:27:06   12
2011-09-26 13:27:07   13
2011-09-26 13:27:08   14
2011-09-26 13:27:09   15
2011-09-26 13:27:10   16 d[T13:27:00/T13:27:10][,1]
2011-09-26 13:27:006
2011-09-26 13:27:017
2011-09-26 13:27:028
2011-09-26 13:27:039
2011-09-26 13:27:04   10
2011-09-26 13:27:05   11
2011-09-26 13:27:06   12
2011-09-26 13:27:07   13
2011-09-26 13:27:08   14
2011-09-26 13:27:09   15
2011-09-26 13:27:10   16




 The processing is not to remove non-trading days/holidays - I do that
 elsewhere. I'm doing processing on some complex strategies which use some
 instruments which trade a lot, but not everyday. I only wish to process the
 data from liquid days and strip out the less liquid data.


It's quite a sophisticated approach to data. Probably when you filter using
the time you would have to count the number of observations and does not
bind data below a certain level. I have no idea how to do it in an elegant
way.

best regards,
daniel



 I will certainly investigate quantstrat.

 Thanks,

 Chris.


 --
 View this message in context:
 http://r.789695.n4.nabble.com/Filtering-dates-times-from-zoo-xts-series-tp3842937p3843408.html
 Sent from the Rmetrics mailing list archive at Nabble.com.

 ___
 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] Need help for calculating 9 period cci

2011-09-19 Thread Daniel Cegiełka
 getSymbols('RHT')
 CCI(cbind(Hi(RHT), Lo(RHT), Cl(RHT)),n=20,ma=SMA,c=0.015)

best regards,
daniel


2011/9/20 Bharat Kherwa bharatram.m...@gmail.com:
 Hello All

 I need some help regarding calculating 9 period cci,

 I did it this way:

library(TTR)
data(ttrc)
cci - CCI(ttrc[,c(High,Low,Close)] , ma = list(SMA, n=20), c=0.015))

 Error in do.call(maType, c(list(HLC), maArgs)) :
  'what' must be a character string or a function,

 Then I tried calculating ma first: this way:


ma-SMA(ttrc[, Close], 9);
cci - CCI(ttrc[9:nrow(ttrc),c(High,Low,Close)] , ma, c=0.015);

 Error in if (n  1 || n  NROW(x)) stop(Invalid 'n') :
  missing value where TRUE/FALSE needed


 Please let me know how to do this,
 any help will be greatly appreciated,

 thanks a lot
 Bharat

 ___
 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] Add Bollinger Bands to Portfolio Equity Curve

2011-06-16 Thread Daniel Cegiełka
try TTR package and: ?bbands

regards,
daniel


2011/6/16 Idris Raja idris.r...@gmail.com

 Hi all.

 I am trying to add Bollinger Bands to an equity curve of one of my own
 portfolios.

 Is there a function in an R library to do this?

 Cheers

 ___
 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] Package quantstrat

2011-06-15 Thread Daniel Cegiełka
W dniu 15 czerwca 2011 17:28 u¿ytkownik G See gsee...@gmail.com napisa³:

 It's on R-Forge, not CRAN.  Is that the problem? Try this:

 install.packages('quantstrat',repos='http://R-Forge.r-project.org')



...or save the package on the disk.

http://r-forge.r-project.org/R/?group_id=316

My guess is that you are using Windows, so select the menu: 'Packages -
Install packages from local zip files'.





 2011/6/15 Daniel Cegie³ka daniel.cegie...@gmail.com

 quantstrat works very well under R-2.13. I don't understand why you have a
 problem with the installation - can you give more information about this
 (error logs)?

 best regards,
 daniel


 2011/6/15 Horst R. Wolf horstrw...@msn.com

 
  Is there any possibility to install the package quantstrat underR
 2.13.0
  ?
  Horst
 
 
 
 
 
 [[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.




[[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] Package quantstrat

2011-06-15 Thread Daniel Cegiełka
OK.

1) download source from this links:

https://r-forge.r-project.org/snapshots.php?group_id=316

2) unpack and go to pkg directory: (from console:
cd blotter-scm-2011-06-15/pkg/)

3) run on console:

R CMD build FinancialInstrument
R CMD build blotter
R CMD build quantstrat

4) install:

R CMD INSTALL FianancialInstrument_*
R CMD INSTALL blotter_*
R CMD INSTALL quantstrat_*


best regards,
daniel


W dniu 15 czerwca 2011 17:50 u¿ytkownik Horst R. Wolf horstrw...@msn.com
 napisa³:

 I tried it but I failed. See my last response. I using MacOS X Leopard.

 Thanks.








 --
 From: daniel.cegie...@gmail.com
 Date: Wed, 15 Jun 2011 17:36:59 +0200

 Subject: Re: [R-SIG-Finance] Package quantstrat
 To: gsee...@gmail.com
 CC: horstrw...@msn.com; r-sig-finance@r-project.org



 W dniu 15 czerwca 2011 17:28 u¿ytkownik G See gsee...@gmail.com napisa³:

 It's on R-Forge, not CRAN.  Is that the problem? Try this:

 install.packages('quantstrat',repos='http://R-Forge.r-project.orghttp://r-forge.r-project.org/
 ')



 ...or save the package on the disk.

 http://r-forge.r-project.org/R/?group_id=316

 My guess is that you are using Windows, so select the menu: 'Packages -
 Install packages from local zip files'.





 2011/6/15 Daniel Cegie³ka daniel.cegie...@gmail.com

 quantstrat works very well under R-2.13. I don't understand why you have a
 problem with the installation - can you give more information about this
 (error logs)?

 best regards,
 daniel


 2011/6/15 Horst R. Wolf horstrw...@msn.com

 
  Is there any possibility to install the package quantstrat underR
 2.13.0
  ?
  Horst
 
 
 
 
 
 [[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.





[[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] How to test pairs trading strategy

2011-05-29 Thread Daniel Cegiełka
 Why I am not getting any plot?.

I have chart.. but eq_* == 1

 How to test pairs trading strategy?

Try quantstrat package - this is a high-quality backtester. In demo
you have a pair trading script... so install and run demo.

https://r-forge.r-project.org/scm/viewvc.php/pkg/quantstrat/demo/pair_trade.R?view=markuprevision=605root=blotter

https://r-forge.r-project.org/R/?group_id=316

Best regards,
Daniel


2011/5/29 Velappan Periasamy veepsi...@gmail.com:
 How to test pairs trading strategy?

 Why I am not getting any plot?.
 Kindly help me
 with regards
 veepsirtt

 # We will need the quantmod package for charting and pulling data
 # You can install packages via: install.packages(packageName)
 # install.packages(c(quantmod,TTR))
 library(quantmod)

 # Pull KO, PEP stock data from Yahoo! Finance
 tckr1-KO
 tckr2-PEP
 start-Sys.Date()-500
 end- format(Sys.Date(),%Y-%m-%d) # -mm-dd
 getSymbols(tckr1, from=start, to=end)
 getSymbols(tckr2, from=start, to=end)

 #Calculate the pair ratio
 ra - Cl(KO)/Cl(PEP)

 #Create a long (up) signal
 #if the current ratio is less than 2.7*STD from mean.
 sigup - ifelse(ra  mean(ra)-2.7*sd(ra) , 1, 0)

 # Create the short (dn) signals
 #if the current ratio is more  than 0.5*STD from mean.
 sigdn - ifelse(ra  mean(ra)-0.5*sd(ra) -1, 0)

 sigup[is.na(sigup)] - 0
 sigdn[is.na(sigdn)] - 0

 # Lag signals to align with days in market,
 # not days signals were generated
 #sigup - Lag(sigup,1) # Use lag() to avoid Toby's error
 #sigdn - Lag(sigdn,1) # Use lag() to avoid Toby's error
 sigup - lag(sigup,1) # Note k=1 implies a move *forward*
 sigdn - lag(sigdn,1) # Note k=1 implies a move *forward*

 # Replace missing signals with no position
 # (generally just at beginning of series)
 sigup[is.na(sigup)] - 0
 sigdn[is.na(sigdn)] - 0

 # Combine both signals into one vector
 sig - sigup + sigdn

 # Calculate Close-to-Close returns
 ret - ROC(Cl(KO))
 ret[1] - 0

 # Calculate equity curves
 eq_up - cumprod(1+ret*sigup)
 eq_dn - cumprod(1+ret*sigdn*-1)
 eq_all - cumprod(1+ret*sig)

 # Replicate Michael's nice chart
 plot.zoo( cbind(eq_up, eq_dn),
 ylab=c(Long,Short), col=c(green,red),
 main=Simple Pair Trading Strategy)
 # Wait a few seconds before making next chart...

        [[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] Strategy performance summary report

2011-05-02 Thread Daniel Cegiełka
Hi algotr8der,

As you can see on r-forge, Blotter has alpha development status. This
project isn't finished and there is no the final version. Be
forgiving, please.. or help to develop this package.

The latest documentation can be found at this link:

https://r-forge.r-project.org/scm/viewvc.php/pkg/blotter/man/?root=blotter

The _main_ purpose of Blotter is the PnL - it's neither backtesting
nor portfolio analysis tool. If you are interested in analysis and
statistics of the portfolio (or strategy) rather see the
PerformanceAnalytics package.

Here you have a stable version of the documentation and examples:

http://cran.r-project.org/web/packages/PerformanceAnalytics/index.html

Development version:

https://r-forge.r-project.org/projects/returnanalytics/

Best regards,
daniel



2011/5/2 algotr8der algotr8...@gmail.com:
 Hello everyone.

 I have been searching for documentation for the blotter package and I am
 confused as to what is the official documentation. I have version 193 of
 blotter installed and there are no user guides or package vignettes
 associated with the install.

 I too am looking for ways to extract trade statistics.

 So - my questions are:

 1) Can someone please point me to the official documentation for blotter

 2) Are functions such as table.TradeStats.R and the likes implemented in new
 versions of blotter.

 Thank you very kindly.


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Strategy-performance-summary-report-tp3166698p3489164.html
 Sent from the Rmetrics mailing list archive at Nabble.com.

 ___
 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] quotes from cvs file, how to?

2011-03-18 Thread Daniel Cegiełka
Hi Benedict! :)

There is getSymbols.csv function in getSymbols.R code:

https://r-forge.r-project.org/scm/viewvc.php/pkg/R/getSymbols.R?view=markuprevision=560root=quantmod

try:

?getSymbols.csv

Best regards,
daniel



2011/3/18 BeBa kb2...@poczta.wp.pl:
 Hi,
 I need help with using chartSeries from the quantmod package.
 The file that is to be used has this structure:


 str(wig20)
 'data.frame':   4200 obs. of  7 variables:
  $ X.TICKER.    : Factor w/ 1 level WIG20: 1 1 1 1 1 1 1 1 1 1 ...
  $ X.DTMMDD.: int  19940414 19940418  19940509 ...
  $ X.OPEN.      : num  1000 1050 1125 1305 1350 ...
  $ X.HIGH.      : num  1000 1050 1125 1305 1350 ...
  $ X.LOW.       : num  1000 1050 1125 1305 1350 ...
  $ X.CLOSE.     : num  1000 1050 1125 1305 1350 ...
  $ X.VOL.       : num  35800 49975 69030 77076 114219 ...


 and here is what it looks like:

 head(wig20)
  X.TICKER. X.DTMMDD. X.OPEN. X.HIGH. X.LOW. X.CLOSE.   X.VOL.
 1     WIG20      19940414  1000.0  1000.0 1000.0   1000.0  35800.0
 2     WIG20      19940418  1050.5  1050.5 1050.5   1050.5  49975.0
 3     WIG20      19940419  1124.9  1124.9 1124.9   1124.9  69029.5
 4     WIG20      19940421  1304.8  1304.8 1304.8   1304.8  77075.5
 5     WIG20      19940425  1350.1  1350.1 1350.1   1350.1 114219.0
 6     WIG20      19940426  1216.2  1216.2 1216.2   1216.2   8309.0


 Since I do not need the TICKER column I chose to proceed as follows:

 wig20skipped - read.table(file=WIG20.mst, colClasses=c(NULL,
 integer, numeric, numeric, numeric, numeric, numeric),
 col.names=c(NULL, date, o, h, l, c, vol), sep=,,
 header=T)


 Ok, now wig20skipped looks similar to what yahoo finance site provides:
 head(wig20skipped)
      date      o      h      l      c      vol
 1 19940414 1000.0 1000.0 1000.0 1000.0  35800.0
 2 19940418 1050.5 1050.5 1050.5 1050.5  49975.0
 3 19940419 1124.9 1124.9 1124.9 1124.9  69029.5
 4 19940421 1304.8 1304.8 1304.8 1304.8  77075.5
 5 19940425 1350.1 1350.1 1350.1 1350.1 114219.0
 6 19940426 1216.2 1216.2 1216.2 1216.2   8309.0




 In order for the chartSeries() to draw the data they need to be xtsible.
 So:

 wig20zoo - read.zoo(wig20skipped, format=%Y%m%d)
 wig20asxts - as.xts(wig20zoo)

 Just to confirm that I do things right:
 is.xts(wig20asxts)
 [1] TRUE


 and Now the problem: neither chartSeries(wig20asxts) nor 
 candleCharts(wig20asxts) can display candlisticks.
 I don't know why. Also:
 addVolatility() results in
 addVolatility()
 Error in dim(data) - dim : attempt to set an attribute on NULL

 Perhaps this could help someone to diagnose the problem:

 str(wig20asxts)
 An ‘xts’ object from 1994-04-14 to 2011-03-09 containing:
  Data: num [1:4200, 1:5] 1000 1050 1125 1305 1350 ...
  - attr(*, dimnames)=List of 2
  ..$ : NULL
  ..$ : chr [1:5] o h l c ...
  Indexed by objects of class: [Date] TZ:
  xts Attributes:
  NULL



 Thanks for any help.

 BeBa

 ___
 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] R to common lisp translator

2011-01-25 Thread Daniel Cegiełka
At first, there is r2c project, where one can translate R to C.. but it's
old stuff

http://www.rforge.net/r2c/

I agree with Robert and Andres that R and lisp could be interesting as a
finance threads, but in general R's HPC list is a better place for this
threads..

http://lispjobs.wordpress.com/2008/06/18/2-new-jobs-at-alphacet-stamford-ct/

regards,
daniel




2011/1/25 Robert Sams rob...@sanctumfi.com

 I think we can make an exception here. There are areas in finance where
 one would like to use R but the performance of its interpreted execution
 is too poor. I too would be interested to know if anyone on this list
 has had success with R/CL translation, especially in the context of
 computing on big time series. Anyone?

 R

 -Original Message-
 From: r-sig-finance-boun...@r-project.org
 [mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Paul Teetor
 Sent: 24 January 2011 22:35
 To: Andres Susrud; r-sig-fina...@stat.math.ethz.ch
 Subject: Re: [R-SIG-Finance] R to common lisp translator

 Andres,

 Can you explain the connection between your question and finance?

 With a question such as this, you may have better luck using the general
 R-help
 mailing list.

 Paul


  Paul Teetor, Elgin, IL  USA
 http://quanttrader.info/public




 
 From: Andres Susrud andres.sus...@gmail.com
 To: r-sig-fina...@stat.math.ethz.ch
 Sent: Mon, January 24, 2011 1:39:40 PM
 Subject: [R-SIG-Finance] R to common lisp translator

 Hi,

 just a question regarding common lisp translator, anyone know of a
 stable
 translator?

 http://dan.corlan.net/R_to_common_lisp_translator/

 http://common-lisp.net/project/rcl/

 http://common-lisp.net/project/rclg/

 I found three sources.

 Any experience with it?

[[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.


[[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] Genetic Algorithms Portfolio Optimization

2011-01-22 Thread Daniel Cegiełka
try this (it's not GA):

https://r-forge.r-project.org/projects/deoptim/

Markowitz portfolio sample:

https://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/DEoptim/inst/doc/SSRN_ID1590456.pdf?revision=22root=deoptim

https://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/DEoptim/inst/doc/SSRN_ID1590456.pdf?revision=22root=deoptimBest
regards,
daniel



2011/1/22 Lui ## lui.r.proj...@googlemail.com

 Dear group,

 I was just wondering whether some of you have some experience with the
 package rgenoud which does provide genetic algorithms for complex
 optimization problems. How did you efficiently solve the constraints
 (sum of all weights 1, variance  target)? Setting the solution
 infeasible through if-clauses did not seem to be so promising ...
 The example below shows what I mean:

 (penalty-term)

 if (variance  targetvariance){
 penatly = -99
 }

 result is to be maximized, the variance should not exceed a certain
 threeshold. To me, it seemed much better to add a penalty term like

 penalty = ( (abs(variance-targetvariance)/targetvariance)*100)^50

 What is your general experience? Did you ever try solving the
 Markowitz portfolio with the rgenoud package?
 I know that there are good solvers around for the qudratic programming
 problem of the markowitz portfolio, but I want to go into a different
 direction which translates into a quadratic problem with quadratic
 constraints (and I havent found a good solver for that...).

 I am interested in your replies! Have a good weekend!

 Lui

 ___
 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.