Re: [R-SIG-Finance] selecting specific rows from an xts object

2014-12-15 Thread David Reiner
If you include the date, or use fractional seconds to create an interval, it 
should work.
xts uses half open/half closed intervals so [T09:30:00/T09:30:00] is empty.

 (nobj - xts(1:5, as.POSIXct('2014-12-15 09:30')+(-2):2))
[,1]
2014-12-15 09:29:581
2014-12-15 09:29:592
2014-12-15 09:30:003
2014-12-15 09:30:014
2014-12-15 09:30:025
 nobj[2014-12-15 09:30:00]
[,1]
2014-12-15 09:30:003
 nobj[T09:29:59.5/T09:30:00.5]
[,1]
2014-12-15 09:30:003
HTH,
-- David


-Original Message-
From: R-SIG-Finance [mailto:r-sig-finance-boun...@r-project.org] On Behalf Of 
Robert Schien
Sent: Monday, December 15, 2014 8:32 AM
To: r-sig-finance@r-project.org
Subject: [R-SIG-Finance] selecting specific rows from an xts object


Hello,

I have a questions concerning the xts package.

How can I select rows for specific times from a xts series?
I know tthat one select a range with the help of T, for example
x[T09:30:00/T09:40:00]

But how can I select only the rows an 09:30:00 ?
x[T09:30:00/T09:30:00] does not work. This delivers the
whole time series.
x[T09:30:00] does not work, too. It delivers no rows at all.

So, how can I do, what I want?
I didn't find anything in the xts documentation.

Thank you in advance.

Greetings
Robert

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


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] Aligning time series

2014-04-16 Thread David Reiner
Definitely use xts !

For Question 2, I would merge all, leaving NA's for missing data.
Then what you do next depends on what you are trying to accomplish,
but sometimes LOCF can be appropriate,
for example if these are trades for less liquid instruments.
However, you may need to do some hard thinking about which of the many ways of 
dealing with missing data would be best for your specific task.

David L. Reiner, Ph.D.
Head Quant
XR Trading LLC

PS: better to post in plain text rather than html.

-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Chirag Anand
Sent: Wednesday, April 16, 2014 1:13 AM
To: r-sig-finance@r-project.org
Subject: Re: [R-SIG-Finance] Aligning time series

Hi Mikhail,

As Ilya said, xts takes care of it. You can use merge.zoo (if using
zoo) or merge.xts to merge two series. The missing timestamps are
taken care of by the all argument. You can use it to specify whether
to take missing timestamps from both the series, an individual series,
or not at all. The details are available in the respective man pages
of the functions.

On 16 April 2014 00:39, Ilya Kipnis ilya.kip...@gmail.com wrote:
 Mikhail, are you using the xts package? Because when you cbind two xts time
 series, it takes care of alignment for you.

 -Ilya


 On Tue, Apr 15, 2014 at 12:07 PM, Mikhail Beketov 
 mikhailbeke...@googlemail.com wrote:

 Hello,
 I have to analyze a large data-set of 1-min stock prices. The problem is
 that the time-series for different stocks in my data-set have different
 length, as some time points are missing in one series but present in
 another etc. So, I have to create a table with aligned time series (all
 dates/times should correspond to all the stocks). My questions are:
 1) Is there some efficient way to do it? Is there anything that is already
 programmed.
 2) Does it make sense to align all of them to shortest time series (so,
 delete the time points that are not given for all stocks)? Or, is better to
 copy the preceding price values for the absent time points, and therefore
 to align all of them to the longest time series?
 Thanks,
 Michael

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



--
Chirag Anand
http://atvariance.in/chiraganand

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


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] Pulling minute bar data with bar() function in Rbbg(RBloomberg) package in R

2013-08-19 Thread David Reiner
Sorry for the late reply - I was out for a few days.
(It's generally better to go to the list so you have more chances of getting a 
reply.)

I follow the last example under ?merge.xts to align my incomplete series:
just generate a sequence of date-times you want and merge the zero-width xts 
object with your other xts object.
You'll get NA's where there's no data, and you can leave them or use locf from 
zoo.
HTH,
-- David


-Original Message-
From: Alex Bennett [mailto:ppminer...@yahoo.com] 
Sent: Wednesday, August 14, 2013 4:04 PM
To: David Reiner
Subject: Re: [SPAM] - [R-SIG-Finance] Pulling minute bar data with bar() 
function in Rbbg(RBloomberg) package in R - Email found in subject

Hi David,

Thank you so much for the help - this worked perfectly! 

Using the isBizday() function at the start of the for loop circumvents the 
4th and stops the error I was getting. 

One more quick question regarding this: Right now the code only returns lines 
from minutes there was volume moved, and I am wondering if it is possible to 
add something (either code or a parameter) that will cause the bar() function 
to return a line for every minute instead of just minutes in which there were 
trades. For example, for a liquid name, like SPY, there will be 390 lines (one 
for every minute since there is volume moving every minute); however, for more 
illiquid names there could only be 100 lines returned because there are several 
minutes with no volume.  What I would like is for there to always be 390 lines 
returned, and, in the event there was no volume moved, have a zero on the line 
corresponding to those minutes. This would cause the use data frame to have 
390*n rows. 

Ultimately I would like a column with a number, 1-390, corresponding to each 
minute bar for a given day, and I cannot think of a way to efficiently add this 
column without having 390 rows per day from the start. 

Does this make sense? Do you have any insights as to how to achieve this goal? 

Thanks for your help!

Best, 
Alex Bennett




On Aug 14, 2013, at 10:38 AM, David Reiner david.rei...@xrtrading.com wrote:

 Alex,
 Sending your message in text instead of html will help you get an answer - 
 see below for what we received.
 But, no, you can go back further, but you must omit holidays the way you are 
 doing it, since the empty
 return from July 4 messes up your logic. The timeSequence function does take 
 a FinCenter argument,
 which may help you.
 
 start.date - localToUTC('2013-04-01 08:30') # I'm in Chicago
 end.date - localToUTC('2013-04-01 15:00')
 raw=bar(conn,GOOG US Equity,TRADE,start.date,end.date,60)
 head(raw)
   timeopenhigh low   
 close numEvents volume
 2013-04-01T13:30:00.000 2013-04-01T13:30:00.000 795.010 801.800 793.250 
 801.380  3650 512342
 2013-04-01T14:30:00.000 2013-04-01T14:30:00.000 801.380 801.380 796.600 
 798.850  2323 320520
 2013-04-01T15:30:00.000 2013-04-01T15:30:00.000 798.940 800.980 798.063 
 798.414  1063 152294
 2013-04-01T16:30:00.000 2013-04-01T16:30:00.000 798.450 801.350 798.070 
 800.777   815 119642
 2013-04-01T17:30:00.000 2013-04-01T17:30:00.000 800.860 802.209 800.500 
 801.280  1061 145566
 2013-04-01T18:30:00.000 2013-04-01T18:30:00.000 801.155 801.330 799.550 
 799.750  1299 185598
 
 HTH,
 -- David Reiner
 PS:
 localToUTC - function(x) {
  if (class(x)[1] == character) {
x - as.POSIXct(x) # Assume strings are in the correct format
  }
  format(x, %Y-%m-%d %H:%M:%OS3,tz=UTC)
 }
 
 -Original Message-
 From: r-sig-finance-boun...@r-project.org 
 [mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Alex Bennett
 Sent: Tuesday, August 13, 2013 8:18 PM
 To: r-sig-finance@r-project.org
 Subject: [SPAM] - [R-SIG-Finance] Pulling minute bar data with bar() function 
 in Rbbg(RBloomberg) package in R - Email found in subject
 
 I am fairly new to the Rbbg package, so please excuse any ignorance on my 
 part, however I am wondering if it is possible to pull more than ~25 days of 
 minute bar data using the bar() function. I've found I can't pull more than 
 25 or 26 days worth of data and am wondering if I am doing something wrong, 
 or if it is just not possible.
 Here is the code I am using:
 #install.packages(rJava)#install.packages(Rbbg, 
 repos=http://r.findata.org;)#install.packages(timeDate)library(rJava)library(Rbbg)library(timeDate)conn
  -blpConnect()weekdays =timeSequence(from=(Sys.Date()-38),to 
 =(Sys.Date()-1),by=day)[isWeekday(timeSequence(from=(Sys.Date()-38),to 
 =(Sys.Date()-1),by=day))]date_time=numeric()volume=numeric()for(i 
 in1:length(weekdays)){start.date -paste(weekdays[i],13:30:00.000)end.date 
 -paste(weekdays[i],20:00:00.000)raw=bar(conn,GOOG US 
 Equity,TRADE,start.date,end.date,1)date_time=append(date_time,raw$time)volume=append(volume,raw$volume)}date.time
  
 -data.frame(do.call('rbind',strsplit(as.character(date_time),'T',fixed=TRUE)))use=data.frame(date=format

Re: [R-SIG-Finance] [SPAM] - Pulling minute bar data with bar() function in Rbbg(RBloomberg) package in R - Email found in subject

2013-08-14 Thread David Reiner
Alex,
Sending your message in text instead of html will help you get an answer - see 
below for what we received.
But, no, you can go back further, but you must omit holidays the way you are 
doing it, since the empty
return from July 4 messes up your logic. The timeSequence function does take a 
FinCenter argument,
which may help you.

 start.date - localToUTC('2013-04-01 08:30') # I'm in Chicago
 end.date - localToUTC('2013-04-01 15:00')
 raw=bar(conn,GOOG US Equity,TRADE,start.date,end.date,60)
 head(raw)
   timeopenhigh low   close 
numEvents volume
2013-04-01T13:30:00.000 2013-04-01T13:30:00.000 795.010 801.800 793.250 801.380 
 3650 512342
2013-04-01T14:30:00.000 2013-04-01T14:30:00.000 801.380 801.380 796.600 798.850 
 2323 320520
2013-04-01T15:30:00.000 2013-04-01T15:30:00.000 798.940 800.980 798.063 798.414 
 1063 152294
2013-04-01T16:30:00.000 2013-04-01T16:30:00.000 798.450 801.350 798.070 800.777 
  815 119642
2013-04-01T17:30:00.000 2013-04-01T17:30:00.000 800.860 802.209 800.500 801.280 
 1061 145566
2013-04-01T18:30:00.000 2013-04-01T18:30:00.000 801.155 801.330 799.550 799.750 
 1299 185598

HTH,
-- David Reiner
PS:
localToUTC - function(x) {
  if (class(x)[1] == character) {
x - as.POSIXct(x) # Assume strings are in the correct format
  }
  format(x, %Y-%m-%d %H:%M:%OS3,tz=UTC)
}

-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Alex Bennett
Sent: Tuesday, August 13, 2013 8:18 PM
To: r-sig-finance@r-project.org
Subject: [SPAM] - [R-SIG-Finance] Pulling minute bar data with bar() function 
in Rbbg(RBloomberg) package in R - Email found in subject

I am fairly new to the Rbbg package, so please excuse any ignorance on my part, 
however I am wondering if it is possible to pull more than ~25 days of minute 
bar data using the bar() function. I've found I can't pull more than 25 or 26 
days worth of data and am wondering if I am doing something wrong, or if it is 
just not possible.
Here is the code I am using:
#install.packages(rJava)#install.packages(Rbbg, 
repos=http://r.findata.org;)#install.packages(timeDate)library(rJava)library(Rbbg)library(timeDate)conn
 -blpConnect()weekdays =timeSequence(from=(Sys.Date()-38),to 
=(Sys.Date()-1),by=day)[isWeekday(timeSequence(from=(Sys.Date()-38),to 
=(Sys.Date()-1),by=day))]date_time=numeric()volume=numeric()for(i 
in1:length(weekdays)){start.date -paste(weekdays[i],13:30:00.000)end.date 
-paste(weekdays[i],20:00:00.000)raw=bar(conn,GOOG US 
Equity,TRADE,start.date,end.date,1)date_time=append(date_time,raw$time)volume=append(volume,raw$volume)}date.time
 
-data.frame(do.call('rbind',strsplit(as.character(date_time),'T',fixed=TRUE)))use=data.frame(date=format(as.Date(date.time$X1),%m/%d/%Y),time=date.time$X2,volume=raw$volume)blpDisconnect(conn)
This works fine and pulls data from the trading days in the past 3.5 weeks. 
Now, if I try to change the 38 to a greater number in the line weekdays = 
timeSequence(from = (Sys.Date()-38), to = (Sys.Date()-1), by = 
day)[isWeekday(timeSequence(from = (Sys.Date()-38), to = (Sys.Date()-1), by = 
day))], I get the following error: Error in matrix.data[, 1] : subscript out 
of bounds when I try running the above script.
Is it the case that the API can only pull about 3.5 weeks of minute bar data? 
Or am I doing something incorrect? Ideally, I would like to have at least 100 
trading days worth of data.
Thank you all for your help.
[[alternative HTML version deleted]]



This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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

[R-SIG-Finance] Rbbg::bdp cannot return TIME type?

2013-08-09 Thread David Reiner
I was hoping to retrieve a field called ACT_TIME_LAST_SETTLE_RECEIVED_RT,
but I got an error: Error in convert.to.type(df.data, data_types) : unknown 
type TIME

Any chance of getting Rbbg extended to handle this type?
Or did I do something wrong? (I can got other fields OK.)

Thanks,
David L. Reiner

-

 require('Rbbg')
Loading required package: Rbbg
Loading required package: rJava
 conn - blpConnect()
R version 3.0.0 (2013-04-03)
rJava Version 0.9-4
Rbbg Version 0.4-155
Java environment initialized successfully.
Looking for most recent blpapi3.jar file...
Adding C:\blp\API\APIv3\JavaAPI\v3.4.3.2\lib\blpapi3.jar to Java classpath
Bloomberg API Version 3.4.3.2
 bdp(conn, ESU3 Index, ACT_TIME_LAST_SETTLE_RECEIVED_RT)
Error in convert.to.type(df.data, data_types) : unknown type TIME
 sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  
  LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C   LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] sos_1.3-5brew_1.0-6   Rbbg_0.4-155 rJava_0.9-4



This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] [SPAM] - Re: subset section of trading day from RBloombergbar download - Email found in subject

2013-07-25 Thread David Reiner
Actually, the T, while part of the standard, has to be specified in the 
format for as.POSIXct, or removed.
Then the xts command has to pass the core data and the index as POSIXct 
separately:

ftse.xts - xts(ftse_Bars[,-1], as.POSIXct(sub(T, ,ftse_Bars[,1])))

Then the subsetting can be done using Jeff's amazing datetime filtering:

ftse.sub - ftse.xts[T07:00/T15:30]

HTH,
David L. Reiner
XR Trading LLC

-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Brian Rowe
Sent: Thursday, July 25, 2013 2:05 PM
To: Tim Meggs
Cc: r-sig-finance@r-project.org
Subject: [SPAM] - Re: [R-SIG-Finance] subset section of trading day from 
RBloombergbar download - Email found in subject

That strange 'T' happens to be specified as part of the ISO 8601 date and time 
standard. As such it is compatible with as.POSIXlt and as.POSIXct.

 as.POSIXlt('2013-01-10T00:00:00.000')
[1] 2013-01-10

https://en.wikipedia.org/wiki/ISO_8601


On Jul 25, 2013, at 2:40 PM, Tim Meggs twme...@gmail.com wrote:

 Hi R finance people,

 I have downloaded some 15-min price Bar data across a number of days from
 Bloomberg for the March13 FTSE futures.

 library(Rbbg)
 conn - blpConnect()
 ftse - Z H3 Index
 ftse_Bars - bar(conn, ftse, TRADE, 2013-01-04 07:00:00.000, 2013-02-01
 20:00:00.000, 15)
 ftse_Bars-as.xts(ftse_Bars)
 blpDisconnect(conn)

 The data looks like this:

   time   open   highlow  close
 numEvents volume
 2013-01-10T01:00:00.000 2013-01-10T01:00:00.000 6050.5 6050.5 6047.0 6048.0
 12 12
 2013-01-10T01:15:00.000 2013-01-10T01:15:00.000 6046.5 6047.5 6046.5 6047.5
 2  2
 2013-01-10T01:30:00.000 2013-01-10T01:30:00.000 6046.5 6046.5 6044.5 6045.0
 12 21
 2013-01-10T01:45:00.000 2013-01-10T01:45:00.000 6044.5 6045.5 6044.5 6045.5
 6  9
 2013-01-10T02:00:00.000 2013-01-10T02:00:00.000 6045.5 6049.0 6045.5 6047.5
 11 13
 2013-01-10T02:15:00.000 2013-01-10T02:15:00.000 6053.0 6059.0 6049.0 6058.0
 37 68

 I would like to remove those bars that fall outside the hours 07:00 UTC to
 15:30 UTC, to leave me with data just from the hours when the cash index is
 open.  Given the time column I receive from Bloomberg is in the slightly odd
 format format %Y-%m-%dT%H:%M:%S with the strange T in the middle how can
 subset out my desired data?

 Any help greatly appreciated.

 Thanks
 Tim



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/subset-section-of-trading-day-from-RBloomberg-bar-download-tp4672338.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.


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] [SPAM] - Rbbg(Bloomberg) time zone problem and xtsconstructor - Email found in subject

2013-05-21 Thread David Reiner
new-xts(bid[,3:4],order.by=strptime(x=bid$time,format=%Y-%m-%dT%H:%M:%OS)-4*3600)

should work for you (until DST  ends.)
Note that bid$time was already character. Always look to see what you are 
getting back.
Also, it's considered polite to give the commands you used to get your results 
so helpers are encouraged to help.

-- David

-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Nikos Rachmanis
Sent: Tuesday, May 21, 2013 12:34 AM
To: r-sig-finance@r-project.org
Subject: [SPAM] - [R-SIG-Finance] Rbbg(Bloomberg) time zone problem and 
xtsconstructor - Email found in subject

Hi all,

I have come across the following time zone problem and I would
appreciate your input.

I am trying to download tick data using the Rbloomberg and I have found
out that the query should be done in UTC time zone. My current zone is
EST so i have written the code below to transform it from EST to
UTC and works fine however the output i get is indicated in UTC as
listed below for my query (instead of 10:00:00.000).


timetypevalue   size
1   2013-05-13T14:00:00.000 ASK_BEST454.87  1
2   2013-05-13T14:00:00.000 TRADE   454.58  100
3   2013-05-13T14:00:00.000 ASK_BEST454.78  10
4   2013-05-13T14:00:00.000 ASK_BEST454.7   1
5   2013-05-13T14:00:00.000 TRADE   454.58  100
6   2013-05-13T14:00:00.000 ASK_BEST454.7   1
7   2013-05-13T14:00:01.000 ASK_BEST454.69  1


My questions are the the following:
1) Is there a way I could write the timezone transformation and get the
correct timing or would I have to change after I download?
2) I have tried to use the xts constructor with the following command
but was not successful. Any idea how to separate the T in the time?
new-xts(bid[,3:4],order.by=strptime(x=as.character(bid$time),format=%Y-%m-%d
%H:%M:%OS,tz=EST))

Thank you all,

Nikos



#Rbloomberg Code
# Special options
options(warn=-1)
options(digits.secs = 3)
options(java.parameters = -Xmx1000m)

# Import libraries
library(RODBC)
library(Rbbg)

#set time interval (transforms from 10:00:00.001 to 14:00:00.001)
start_time-toString(format(as.POSIXct(2013-05-13 10:00:00.001,
tz=EST5EDT), tz=UTC))
end_time-toString(format(as.POSIXct(2013-05-13 10:15:00.001,
tz=EST5EDT), tz=UTC))

# Connect to Bloomberg API
conn -  blpConnect(log.level = finest)

#Download command
data - tick(conn, AAPL US Equity,
  c(TRADE,BID_BEST,ASK_BEST),
  start_date_time=start_time,
  end_date_time=end_time)

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


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] Rbbg in R 3.0.0

2013-04-16 Thread David Reiner
Thanks, John, that did the trick!

That error message threw me off, I guess.
(I usually just use the .Net API, where you pass in DateTime objects.)
I was going to look in the documentation for bar or tick, but I can't find it 
right now - where is it?

Thanks for supporting Rbbg, John - it's major for many of us!
-- David

From: John Laing [mailto:john.la...@gmail.com]
Sent: Tuesday, April 16, 2013 6:16 AM
To: George Wang
Cc: David Reiner; r-sig-finance@r-project.org
Subject: Re: [R-SIG-Finance] Rbbg in R 3.0.0

This isn't an installation problem. If the desktop API weren't installed 
David's script would be failing on the connection step instead of the data 
request.

I think it's a simple time formatting thing. Bloomberg is strict about the 
start/end times it accepts, and Rbbg doesn't do any intelligent conversion of 
user input (although it probably should). These changes make it work:
start - 2013-04-15 13:30:00.000
end - 2013-04-15 14:00:00.000

Lastly, the issue isn't specific to R 3.0. The script fails in the same way 
(and with the same resolution) on 2.15.

HTH,
John

On Tue, Apr 16, 2013 at 6:18 AM, George Wang 
grandti...@gmail.commailto:grandti...@gmail.com wrote:
You need to install the Bloomberg desktop API by WAPIgo.

But there seems to be an issue with the windows api download on Bloomberg side 
recently. Hope it's resolved now.

Sent from my iPad

On Apr 15, 2013, at 4:58 PM, David Reiner 
david.rei...@xrtrading.commailto:david.rei...@xrtrading.com wrote:

 I tried Rbbg in R 3.0.0, but I'm getting a Java-related error I think.
 Hints?

 install.packages(Rbbg, repos=http://r.findata.org/;, dependencies = TRUE)
 trying URL 'http://r.findata.org/bin/windows/contrib/3.0/Rbbg_0.4-155.zip'
 Content type 'application/zip' length 41069 bytes (40 Kb)
 opened URL
 downloaded 40 Kb

 package 'Rbbg' successfully unpacked and MD5 sums checked

 The downloaded binary packages are in
C:\Users\davidr\AppData\Local\Temp\RtmpAvhuq1\downloaded_packages
 require(Rbbg)
 Loading required package: Rbbg
 Loading required package: rJava
 conn - blpConnect()
 R version 3.0.0 (2013-04-03)
 rJava Version 0.9-4
 Rbbg Version 0.4-155
 Java environment initialized successfully.
 Looking for most recent blpapi3.jar file...
 Adding C:\blp\API\APIv3\JavaAPI\v3.4.3.2\lib\blpapi3.jar to Java classpath
 Bloomberg API Version 3.4.3.2
 ticker - GOOG US Equity
 start - 2013-04-15 13:30:00 # These are UTC, right?
 end - 2013-04-15 14:00:00
 interval - 1
 bar(conn, ticker, BID, start, end, interval)
 Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl,  :
  java.lang.ArrayIndexOutOfBoundsException: 6
 sessionInfo()
 R version 3.0.0 (2013-04-03)
 Platform: i386-w64-mingw32/i386 (32-bit)

 locale:
 [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United 
 States.1252LC_MONETARY=English_United States.1252
 [4] LC_NUMERIC=C   LC_TIME=English_United States.1252

 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base

 other attached packages:
 [1] Rbbg_0.4-155 rJava_0.9-4

 loaded via a namespace (and not attached):
 [1] tools_3.0.0

 Any help is much appreciated!
 David L. Reiner
 XR Trading LLC



 This e-mail and any materials attached hereto, including, without limitation, 
 all content hereof and thereof (collectively, XR Content) are confidential 
 and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
 protected by intellectual property laws.  Without the prior written consent 
 of XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
 reproduced or otherwise used by anyone other than current employees of XR or 
 its affiliates, on behalf of XR or its affiliates.

 THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF 
 ANY KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
 DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
 CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE 
 LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED 
 TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF 
 PROFITS AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, 
 OR INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY 
 OF SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

 ___
 R-SIG-Finance@r-project.orgmailto: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.orgmailto: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

[R-SIG-Finance] Rbbg in R 3.0.0

2013-04-15 Thread David Reiner
I tried Rbbg in R 3.0.0, but I'm getting a Java-related error I think.
Hints?

 install.packages(Rbbg, repos=http://r.findata.org/;, dependencies = TRUE)
trying URL 'http://r.findata.org/bin/windows/contrib/3.0/Rbbg_0.4-155.zip'
Content type 'application/zip' length 41069 bytes (40 Kb)
opened URL
downloaded 40 Kb

package 'Rbbg' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\davidr\AppData\Local\Temp\RtmpAvhuq1\downloaded_packages
 require(Rbbg)
Loading required package: Rbbg
Loading required package: rJava
 conn - blpConnect()
R version 3.0.0 (2013-04-03)
rJava Version 0.9-4
Rbbg Version 0.4-155
Java environment initialized successfully.
Looking for most recent blpapi3.jar file...
Adding C:\blp\API\APIv3\JavaAPI\v3.4.3.2\lib\blpapi3.jar to Java classpath
Bloomberg API Version 3.4.3.2
 ticker - GOOG US Equity
 start - 2013-04-15 13:30:00 # These are UTC, right?
 end - 2013-04-15 14:00:00
 interval - 1
 bar(conn, ticker, BID, start, end, interval)
Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl,  :
  java.lang.ArrayIndexOutOfBoundsException: 6
 sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  
  LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C   LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] Rbbg_0.4-155 rJava_0.9-4

loaded via a namespace (and not attached):
[1] tools_3.0.0

Any help is much appreciated!
David L. Reiner
XR Trading LLC



This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] 4-digit SIC codes

2013-02-05 Thread David Reiner
Very nice, Garrett!
More curious than anything, but does anyone know why I get the extraneous 
characters when I do it?
They are present in x as well. I believe they are non-breaking spaces.

 head(SIC)
  SICCode A/D  Office    Industry Title
4 1005 ÂAGRICULTURAL PRODUCTION-CROPS
5 2005 Â AGRICULTURAL PROD-LIVESTOCK  ANIMAL SPECIALTIES
6 7005 ÂAGRICULTURAL SERVICES
7 8005 Â FORESTRY
8 9005 ÂFISHING, HUNTING AND TRAPPING
910009 Â METAL MINING
 sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  
  LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C   LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] XML_3.95-0.1

loaded via a namespace (and not attached):
[1] tools_2.15.2

Thanks,
-- David Reiner


-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of G See
Sent: Monday, February 04, 2013 9:30 PM
To: Bastian Offermann
Cc: r-sig-finance@r-project.org
Subject: Re: [R-SIG-Finance] 4-digit SIC codes

I'm not sure, but here's a really quick and dirty way to get it

 library(XML)
 x - readHTMLTable(http://www.sec.gov/info/edgar/siccodes.htm;,
  stringsAsFactors=FALSE)[[4]]
 colnames(x) - x[2, ]
 SIC - x[-c(1:3), ]
 head(SIC)
  SICCode A/D  OfficeIndustry Title
4 100   5 AGRICULTURAL PRODUCTION-CROPS
5 200   5  AGRICULTURAL PROD-LIVESTOCK  ANIMAL SPECIALTIES
6 700   5 AGRICULTURAL SERVICES
7 800   5  FORESTRY
8 900   5 FISHING, HUNTING AND TRAPPING
91000   9  METAL MINING

 SIC[SIC$SICCode == 2834, ]
   SICCode A/D  Office   Industry Title
912834   1  PHARMACEUTICAL PREPARATIONS

HTH,
Garrett

On Mon, Feb 4, 2013 at 9:19 PM, Bastian Offermann
bastian250...@yahoo.co.uk wrote:
 Hi,
 does anybody know whether 4-digit SIC codes are available in R? Something
 along the lines

 2834 Pharmaceutical Preparations

 Thank you.

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


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] getEndOfMonth and getEndOfBizWeek in RcppBDT broken?

2012-08-08 Thread David Reiner
Thanks, Dirk. You're the best!

-- David


-Original Message-
From: Dirk Eddelbuettel [mailto:e...@debian.org]
Sent: Wednesday, August 08, 2012 1:02 PM
To: David Reiner
Cc: r-sig-finance@r-project.org; d...@eddelbuettel.com
Subject: Re: [R-SIG-Finance] getEndOfMonth and getEndOfBizWeek in RcppBDT 
broken?


Ok, bug found.  In the R file definining the convenience functions

getEndOfBizWeek - function(date = Sys.Date()) {
stopifnot(inherits(date, Date))
bdt$getEndOfBizWeek(date)
}

getEndOfMonth - function(date = Sys.Date()) {
stopifnot(inherits(date, Date))
bdt$getEndOfMonth(date)
}

both of these miss the crucial

bdt$fromDate(date)

to actually set the date you supply.  You could write yourself a local
variant til the updated package comes through.

Thanks for spotting this.

Dirk

--
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] [SPAM] - Re: [SPAM] - Re: 1 minute time interval in Bloomberg - Email found in subject - Email found in subject

2012-05-14 Thread David Reiner
Sorry for the noise and wrong page number.
It would have seemed that the parameter to set would be gapFillInitialBar, 
but this fills only the first bar (if empty) with the previous values (and 0 
volume).
So I guess Bloomberg doesn't provide this through the 3.x API; however, it is 
available through the Excel API. Go figure.

-- David


-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of David Reiner
Sent: Monday, May 14, 2012 2:11 PM
To: John Laing; krisan haria
Cc: r-sig-finance@r-project.org
Subject: [SPAM] - Re: [R-SIG-Finance] [SPAM] - Re: 1 minute time interval in 
Bloomberg - Email found in subject - Email found in subject

My workaround would be similar to this, but the OP perhaps knows of the 
optional arguments available in the Bloomberg API
that allow one to specify how empty periods should be treated (e.g., previous 
value, nil.)
See pp. 115-116 in the API Version 3.x Developer's Guide (2041121.pdf).
It would be nice if these optional arguments were exposed in RBloomberg.
(If they are in fact exposed somewhere but not in the bars() function, perhaps 
a pointer to the relevant place would be helpful.)
HTH,
-- David


-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of John Laing
Sent: Monday, May 14, 2012 12:18 PM
To: krisan haria
Cc: r-sig-finance@r-project.org
Subject: [SPAM] - Re: [R-SIG-Finance] 1 minute time interval in Bloomberg - 
Email found in subject

Krisan,

I'm not aware of a way to get time periods back that have no data
associated. But this makes sense: what would you expect Bloomberg to
show you for OHLC in minutes when there were no trades?

You could get the set of all dates and diff it with the dates you
actually got back:
all.mins - seq(as.POSIXct(2012-03-21 09:00:00),
as.POSIXct(2012-03-21 15:00:00), 1 min)
data.mins - as.POSIXct(t_bar1$time, format = %Y-%m-%dT%H:%M:%S)
missing.mins - as.POSIXct(setdiff(all.mins, data.mins), origin =
as.Date(1970-01-01))

What you do from there is up to you.

John


On Mon, May 14, 2012 at 5:12 AM, krisan haria krisanha...@gmail.com wrote:
 Hi

 I am trying to get data (open,high,low close) in 1 minute time intervals
 from Bloomberg.

 Currently I have the following

 library(RBloomberg)
 conn=blpConnect()
 t_bar1= bar(conn, IUSA IM Equity, TRADE, 2012-03-21 09:00:00.000,
 2012-03-21 15:00:00.000, 1)

 head(t_ob1)
   timeopenhigh low
 close numEvents volume
 2012-03-21T09:01:00.000 2012-03-21T09:01:00.000 10.5825 10.5875 10.5825
 10.5875 2295
 2012-03-21T09:05:00.000 2012-03-21T09:05:00.000 10.5850 10.5850 10.5850
 10.5850 1   3000
 2012-03-21T09:07:00.000 2012-03-21T09:07:00.000 10.5850 10.5850 10.5850
 10.5850 1   1352
 2012-03-21T09:11:00.000 2012-03-21T09:11:00.000 10.5875 10.5875 10.5875
 10.5875 1   3465
 2012-03-21T09:18:00.000 2012-03-21T09:18:00.000 10.5850 10.5850 10.5850
 10.5850 1   1314
 2012-03-21T09:23:00.000 2012-03-21T09:23:00.000 10.5800 10.5800 10.5800
 10.5800 1400


 As you can see, it only seems to get the data for when there was a trade.
 How do I get this data for the whole day inlcuding the 1 minute intervals
 when there were no trades

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


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY

Re: [R-SIG-Finance] [SPAM] - self-fulfilling prophecies in financial study - Email found in subject

2012-05-09 Thread David Reiner
This book has some good examples:
An Engine, Not a Camera: How Financial Models Shape Markets
by Donald Mackenzie

-- David

-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Wei-han Liu
Sent: Wednesday, May 09, 2012 7:02 AM
To: R-SIG-Finance@r-project.org
Subject: [SPAM] - [R-SIG-Finance] self-fulfilling prophecies in financial study 
- Email found in subject

Hi R users:

There are some possible candidates of self-fulfilling prophecies in financial 
study.

Could some people share some thoughts about the relevant theories, econometric 
tests, and R packages for implementation?

Thanks for your attention and sharing.

Wei-han
[[alternative HTML version deleted]]



This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] [SPAM] - RBloomberg: Error in process.result(result, first.column) - Email found in subject

2012-01-11 Thread David Reiner
Bloomberg allows going only so far in the past for intraday data
(50 trading days, I thought, although your query works for any date after 
2001-09-11.)
HTH,
-- David

From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of 
scott.ly...@instinet.com
Sent: Tuesday, January 10, 2012 3:56 PM
To: r-sig-finance@r-project.org
Subject: [SPAM] - [R-SIG-Finance] RBloomberg: Error in 
process.result(result,first.column) - Email found in subject


Hi, folks.

First, I'd like to take this opportunity to thank the many people on this list 
who have contributed so much to R.

I've been using RBloomberg happily for a few weeks now. Today, with no change 
in my environment that I'm aware of, I've encountered a strange error.

The following self-contained example reproduces the error at will in my 
environment ...

library(RBloomberg)
conn-blpConnect()
d81-2011-11-01
sTime-00:00:00.000
eTime-23:59:00.000
barLen-60
# works ...
bar(conn, TD CN Equity, BID, paste(d81,sTime), paste(d81,eTime), barLen)
# change date ...
d81-2011-06-01
# Error in process.result(result, first.column) : subscript out of bounds ...
bar(conn, TD CN Equity, BID, paste(d81,sTime), paste(d81,eTime), barLen)


 sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 
LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] RBloomberg_0.4-150 rJava_0.9-2

loaded via a namespace (and not attached):
[1] tools_2.13.1


Any help would be greatly appreciated.

Thanks,

Scott



Scott Lyden
Global Trading Research
Instinet
San Francisco, CA USA
[cid:image001.gif@01CCD078.F3138F20]

*

Disclaimer



In compliance with applicable rules and regulations, Instinet

reviews and archives incoming and outgoing email communications,

copies of which may be produced at the request of regulators.

This message is intended only for the personal and confidential

use of the recipients named above. If the reader of this email

is not the intended recipient, you have received this email in

error and any review, dissemination, distribution or copying is

strictly prohibited. If you have received this email in error,

please notify the sender immediately by return email and

permanently delete the copy you received.



Instinet accepts no liability for any content contained in the

email, or any errors or omissions arising as a result of email

transmission. Any opinions contained in this email constitute

the sender's best judgment at this time and are subject to change

without notice. Instinet does not make recommendations of a

particular security and the information contained in this email

should not be considered as a recommendation, an offer or a

solicitation of an offer to buy and sell securities.



*




This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.
inline: image001.gif___
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] Bloomberg login through R

2011-12-06 Thread David Reiner
I have a windows task scheduled to run a script to login to Bloomberg at a time 
before I need to get Bloomberg data.
I suppose you could run the script from within R if you prefer.
(I actually moved on to a C# program, but that is really off-topic.)
As John said, one seems to be able to get data while logged out, but sometimes 
it will fail, so being logged in is safer.
Here is my script BBLogin.wsf; it is not secure, but we share usage of the BB 
terminals anyway, so aren't concerned.
If anyone has a better way, please let us know!

package
   job id=vbs
  script language=VBScript
 set WshShell = WScript.CreateObject(WScript.Shell)
 WshShell.AppActivate 1-BLOOMBERG
 WScript.Sleep 1000
 WshShell.SendKeys {esc}
 WScript.Sleep 1000
 WshShell.SendKeys login~
 WScript.Sleep 2000
 WshShell.SendKeys YOURUSERNAME{tab}YOURPASSWORD~
 WScript.Sleep 1000
  /script
   /job
/package

HTH,
-- David


-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of John Laing
Sent: Monday, December 05, 2011 10:53 AM
To: Pierre Lapointe
Cc: Ayhan Yüksel (Finans Portföy A.Ş.); r-sig-finance@r-project.org
Subject: Re: [R-SIG-Finance] Bloomberg login through R

This will work to an extent, but is not the intended use. The Bloomberg APIs 
will continue to work for a time after you log off from the terminal. 
Eventually the connection will go away.

In response to Ayhan's original question: there is not a way to provide login 
credentials through R. It is expected that a terminal is already open and 
connected to Bloomberg, and the API then piggybacks on that session.

John

2011/12/5 Pierre Lapointe pierre...@gmail.com:
 Why don't you try it?
 Type LOFF GO on your Bloomberg
 And try to use RBloomberg.
 It works on mine.
 2011/12/5 Ayhan Yüksel (Finans Portföy A.Ş.) ayhan.yuk...@finansportfoy.com:
 Hi,



 I have a question about gathering data from Bloomberg using Rbloomberg 
 package.



 If the bloomberg terminal is logged off, is it possible to login to 
 Bloomberg through R?



 e.g. something like:



 library(RBloomberg)

 conn - blpConnect(username=ABCDE, password=123456)



 Kind regards,

 Ayhan Yuksel


 Bu e-posta'nin icerdigi bilgiler (ekleri dahil olmak uzere) gizlidir. 
 Onayimiz olmaksizin ucuncu kisilere aciklanamaz. Bu mesajin gonderilmek 
 istendigi kisi degilseniz, lutfen mesaji sisteminizden derhal siliniz. 
 Finans Portföy Yönetimi A.S. bu mesajin icerdigi bilgilerin dogrulugu veya 
 eksiksiz oldugu konusunda bir garanti vermemektedir. Bu nedenle bilgilerin 
 ne sekilde olursa olsun iceriginden, iletilmesinden, alinmasindan, 
 saklanmasindan sorumlu degildir. Bu mesajin icerigi yazarina ait olup, 
 Finans Portföy Yönetimi A.S.'nin goruslerini icermeyebilir. The 
 information contained in this e-mail (including any attachments) is 
 confidential. It must not be disclosed to any person without our authority. 
 If you are not the intended recipient, please delete it from your system 
 immediately. Finans Portfoy Yonetimi A.S. makes no warranty as to the 
 accuracy or completeness of any information contained in this message and 
 hereby excludes any liability of any kind for the information contained 
 therein or for the information transmission, reception, storage or use of 
 such in any way whatsoever. Any opinions expressed in this message are those 
 of the author and may not necessarily reflect the opinions of Finans Portfoy 
 Yonetimi A.S.


[[alternative HTML version deleted]]


 ___
 R-SIG-Finance@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-finance
 -- Subscriber-posting only. If you want to post, subscribe first.
 -- Also note that this is not the r-help list where general R questions 
 should go.

 ___
 R-SIG-Finance@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-finance
 -- Subscriber-posting only. If you want to post, subscribe first.
 -- Also note that this is not the r-help list where general R questions 
 should go.

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


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its 

Re: [R-SIG-Finance] [SPAM] - Re: Skewness function for intraday data returndistribution - Email found in subject

2011-10-31 Thread David Reiner
Pretty sure the first one is a typo - if the last power is 3/2, they match up.
HTH,
-- David

-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Patrick Burns
Sent: Monday, October 31, 2011 3:10 AM
To: r-sig-finance@r-project.org
Subject: [SPAM] - Re: [R-SIG-Finance] Skewness function for intraday data 
returndistribution - Email found in subject

The skewness of c * X should be equal to the skewness of X.  If I'm reading the 
formulas correctly, that is true of the second one but not the first.

It would be interesting to hear if you find different results intraday than I 
did with daily data over a year:

http://www.portfolioprobe.com/2011/10/03/predictability-of-kurtosis-and-skewness-in-sp-constituents/

On 31/10/2011 05:18, Roupell, Darko wrote:
 Hi All,

 I have written a skew function to calculate stock skewness using intraday 5 
 min data. However, going through literature I have come across two very 
 similar formulas, though they produce different skewness coefficient and 
 wonder if anyone else has used similar formulas and know which one is the 
 correct one.

 mq_skewness = function(data){
 data = dataformatc(data);
#returns midquote log returns as xts object
mq_ret = mq_return(data);
#returns midquote log returns as xts object
mq_ret_sqr = mq_ret^2;
#returns realized daily volatility as xts object
RVar=sum(  mq_ret_sqr)
n = length(mq_ret);

#first formula to measure skewness
mq_skewness = sqrt(n) * (sum(mq_ret^3))/sum(mq_ret_sqr)^(2/3)

   # second formula to measure skewness
mq_skewness = sqrt(n) * sum((mq_ret/sqrt(RVar))^3)

return(mq_skewness);
 }

#first formula to measure skewness
mq_skewness = sqrt(n) * (sum(mq_ret^3))/sum(mq_ret_sqr)^(2/3)
 [1] 0.0003991095
# second formula to measure skewness
mq_skewness = sqrt(n) * sum((mq_ret/sqrt(RVar))^3) [1] 0.09759751 #
 this is output from base package function but this may not be
 appropriate to use for intraday data
 skewness(mq_ret)
 [1] 0.3035787
 __
 Darko Roupell



 ** IMPORTANT MESSAGE * This
 e-mail message is intended only for the addressee(s) and contains
 information which may be confidential.
 If you are not the intended recipient please advise the sender by
 return email, do not use or disclose the contents, and delete the
 message and any attachments from your system. Unless specifically
 indicated, this email does not constitute formal advice or commitment by the 
 sender or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its 
 subsidiaries.
 We can be contacted through our web site: commbank.com.au.
 If you no longer wish to receive commercial electronic messages from
 us, please reply to this e-mail by typing Unsubscribe in the subject line.

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


--
Patrick Burns
patr...@burns-stat.com
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe

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


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

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

Re: [R-SIG-Finance] RBloomberg connection options - Email found in subject

2011-09-28 Thread David Reiner
Thanks for the response, John.
I tried this:
 tick(conn, ESA Index, c(BID, ASK), 2011-09-28 10:00:00.000, 
 2011-09-28 10:00:01.000, option_names=useUTCTime,option_values=FALSE)
Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl,  : 
  com.bloomberglp.blpapi.NotFoundException: Element Defintion: useUTCTime not 
found in: IntradayTickRequest

I guess I will have to always remember to shift my times to/from UTC or write a 
wrapper.
I'm not sure it is supported for intraday tick requests; on WAPIgo under the 
API development topics #5,
they seem to indicate that it should work for at least VWAPs, but it's a little 
hard to know if it applies to others.

Thanks for all your good work on this package!
-- David

 sessionInfo()
R version 2.13.1 Patched (2011-08-17 r56745)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  
  LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C   LC_TIME=English_United States.1252   
 

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base 

other attached packages:
[1] zoo_1.7-3  RBloomberg_0.4-150 rJava_0.9-1   

loaded via a namespace (and not attached):
[1] grid_2.13.1 lattice_0.19-31

-Original Message-
From: John Laing [mailto:john.la...@gmail.com] 
Sent: Tuesday, September 27, 2011 9:19 PM
To: David Reiner
Cc: r-sig-finance@r-project.org
Subject:  Re: [R-SIG-Finance] RBloomberg connection options

David,

These options in the RBloomberg package correspond directly to options that 
Bloomberg exposes through the API. I haven't been able to come up with any 
cases where the options do interesting things, but they would be set through a 
bdp (or similar) call like this:

bdp(conn, GOOG Equity, PX_LAST, option_names = includeExchangeCodes, 
option_values = TRUE)

Sorry if that's not especially helpful... If I come up with a better example 
I'll be sure to let you know.

John

On Thu, Sep 22, 2011 at 10:22 AM, David Reiner david.rei...@xrtrading.com 
wrote:
 Thanks to Ana and John for this great package!

 I am intrigued by the options shown in one example, but clueless as to how to 
 take advantage of them.
 How do we set useUTCTime to FALSE ?
 Here's the example that shows there is such an option:

 library(RBloomberg)
 conn - blpConnect()
 conn$BOOLEAN_OPTION_NAMES
  [1] useUTCTime                returnRelativeDate        
 adjustmentNormal          adjustmentAbnormal
  [5] adjustmentSplit           adjustmentFollowDPDF      returnEids     
            includeConditionCodes
  [9] includeNonPlottableEvents includeExchangeCodes

 I tried conn$ useUTCTime and conn@ useUTCTime, and conn - 
 blpConnect(useUTCTime=FALSE) but none of these make sense to the 
 package.

 Thanks for the help,
 David L. Reiner, Ph.D.
 Head Quant
 XR Trading LLC
 550 West Jackson Boulevard, Suite 1000 Chicago, IL 60661-5704
 (312) 244-4610 direct
 (312) 244-4500 main
 david.rei...@xrtrading.com



 This e-mail and any materials attached hereto, including, without limitation, 
 all content hereof and thereof (collectively, XR Content) are confidential 
 and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
 protected by intellectual property laws.  Without the prior written consent 
 of XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
 reproduced or otherwise used by anyone other than current employees of XR or 
 its affiliates, on behalf of XR or its affiliates.

 THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF 
 ANY KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
 DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
 CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE 
 LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED 
 TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF 
 PROFITS AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, 
 OR INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY 
 OF SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

 ___
 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] RBloomberg connection options

2011-09-22 Thread David Reiner
Thanks to Ana and John for this great package!

I am intrigued by the options shown in one example, but clueless as to how to 
take advantage of them.
How do we set useUTCTime to FALSE ?
Here's the example that shows there is such an option:

 library(RBloomberg)
 conn - blpConnect()
 conn$BOOLEAN_OPTION_NAMES
 [1] useUTCTimereturnRelativeDateadjustmentNormal 
 adjustmentAbnormal
 [5] adjustmentSplit   adjustmentFollowDPDF  returnEids   
 includeConditionCodes
 [9] includeNonPlottableEvents includeExchangeCodes

I tried conn$ useUTCTime and conn@ useUTCTime, and
conn - blpConnect(useUTCTime=FALSE)
but none of these make sense to the package.

Thanks for the help,
David L. Reiner, Ph.D.
Head Quant
XR Trading LLC
550 West Jackson Boulevard, Suite 1000
Chicago, IL 60661-5704
(312) 244-4610 direct
(312) 244-4500 main
david.rei...@xrtrading.com



This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] [SPAM] - fOptions American options Implied Volatility - Email found in subject

2011-05-17 Thread David Reiner
Massimo,
This stock has dividends, so you might have to use a different valuation model 
for American valuation.
Some sort of discrete dividend model should work.
HTH,
-- David


-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of msalese
Sent: Tuesday, May 17, 2011 4:37 AM
To: r-sig-finance@r-project.org
Subject: [SPAM] - [R-SIG-Finance] fOptions American options Implied Volatility 
- Email found in subject

Hi guys,
working with RMetrics/fOptions library I see there isn't a function to
compute iv on American Options so I've build this function to do the job:

library(fOptions)

impVolAmCall-function(pmkPrice,Und,Strike,expTime,rInt,pb){
  auxAmCall-function(pVol,pmkPrice,pUnd,pStrike,pexpTime,prInt){
at-CRRBinomialTreeOption(TypeFlag = ca, S = pUnd, X=pStrike,Time
=pexpTime, r = prInt, b = pb, sigma = pVol, n = 15)
return(pmkPrice-at@price)
  }

limpVol-uniroot(f=auxAmCall,lower=0.05,upper=2,tol=0.001,pmkPrice=pmkPrice,pUnd=Und,pStrike=Strike,pexpTime=expTime,prInt=rInt)
  return(limpVol$root)
}

After that I downloaded options price from Italian IDEM on G.MI (Generali
Assurance) and loaded all in the obsPrice3 data.frame:

str(obsPrice3)
'data.frame':   12 obs. of  6 variables:
 $ expDays : num  59 59 59 59 59 59 59 59 59 59 ...
 $ YExpDays: num  0.234 0.234 0.234 0.234 0.234 ...
 $ Bid : num  2.219 1.726 1.249 0.845 0.544 ...
 $ Ask : num  2.266 1.769 1.293 0.883 0.579 ...
 $ Strike  : num  13.5 14 14.5 15 15.5 16 16.5 17 17.5 18 ...
 $ MidPrice: num  2.242 1.747 1.271 0.864 0.561 ...


expDays YExpDaysBidAsk Strike MidPrice
1   59 0.234127 2.2190 2.2660   13.5  2.24250
2   59 0.234127 1.7255 1.7690   14.0  1.74725
3   59 0.234127 1.2490 1.2930   14.5  1.27100
4   59 0.234127 0.8450 0.8830   15.0  0.86400
5   59 0.234127 0.5445 0.5785   15.5  0.56150
6   59 0.234127 0.3325 0.3670   16.0  0.34975
7   59 0.234127 0.1895 0.2180   16.5  0.20375
8   59 0.234127 0.1010 0.1280   17.0  0.11450
9   59 0.234127 0.0485 0.0760   17.5  0.06225
10  59 0.234127 0.0115 0.0445   18.0  0.02800
11  59 0.234127 0.0005 0.0830   18.5  0.04175
12  59 0.234127 0.0005 0.0775   19.0  0.03900

Now I'd like to compute the iv for all the chain so I've used mapply:

mapply(FUN=impVolAmCall,obsPrice3$MidPrice,obsPrice3$Strike,Und=15.75,expTime=59/252,rInt=0.01,pb=0.01)
but R replay with:

Error in uniroot(f = auxAmCall, lower = 0.05, upper = 2, tol = 0.001,  :
  f() values at end points not of opposite sign

The point is that for otm options I'm not able to find zero in auxAmCall
(auxiliary function) coded inside impVolAmCall function.
I'm new to R so I think that something is wrong in my code, can someone help
me ?

Thanks
Massimo
http://r.789695.n4.nabble.com/file/n3528629/obsPrice3.rda obsPrice3.rda

--
View this message in context: 
http://r.789695.n4.nabble.com/fOptions-American-options-Implied-Volatility-tp3528629p3528629.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.


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR 
CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

___
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] [SPAM] - Re: XTS with unique time stamps? - Email found in subject

2011-01-31 Thread David Reiner
Jeff,
When you do extend it to remove duplicates, you might want to
give a choice whether to keep the first or last duplicated value.
I know I've used both for various reasons.
Thanks for such a great set of packages!
-- David

-Original Message-
From: r-sig-finance-boun...@r-project.org 
[mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Jeffrey Ryan
Sent: Monday, January 31, 2011 9:37 AM
To: Brian G. Peterson
Cc: r-sig-finance@r-project.org
Subject: [SPAM] - Re: [R-SIG-Finance] XTS with unique time stamps? - Email 
found in subject

Brian, Worik

w.r.t the new functionality in xts.

It is so bleeding edge that Brian gave you the wrong name ;-) think
make [the] index unique.  It probably will also be extended to do
the former removal of subsequent non-unique observations/times as
well.

HTH,
Jeff


?make.index.unique

make.index.unique package:xts  R Documentation

Force Time Values To Be Unique

Description:

 A generic function to force sorted time vectors to be unique.
 Useful for high-frequency time-series where original time-stamps
 may have identical values. For the case of xts objects, the
 default 'eps' is set to one-hundred microseconds. In practice this
 advances each subsequent identical time by 'eps' over the previous
 (possibly also advanced) value.

Usage:

 make.index.unique(x, eps = 1e-05, ...)

 make.time.unique(x, eps = 1e-05, ...)

Arguments:

   x: An xts object, or POSIXct vector.

 eps: value to add to force uniqueness.

 ...: unused

Details:

 The returned time-series object will have new time-stamps so that
 'isOrdered( .index(x) )' evaluates to TRUE.

Value:

 A modified version of x.

Note:

 Incoming values must be pre-sorted, and no check is done to make
 sure that this is the case.  If the index values are of
 storage.mode 'integer', they will be coerced to 'double'.

Author(s):

 Jeffrey A. Ryan

See Also:

 'align.time'

Examples:

 ds - options(digits.secs=6) # so we can see the change

 x - xts(1:10, as.POSIXct(2011-01-21) + c(1,1,1,2:8)/1e3)
 x
 make.index.unique(x)

 options(ds)



On Mon, Jan 31, 2011 at 6:05 AM, Brian G. Peterson br...@braverock.com wrote:
 On Monday, January 31, 2011 12:55:03 am Worik wrote:
 I am having trouble with non-unique time stamps in an xts.

 My underlying data has some repeated rows (in a csv file).

 How can I easily get rid of the duplicates?

 I feel I must be missing something simple.  If not I can concoct an
 example to illustrate my problem.

 Worik,

 It depends on what you need.

 If you can remove the rows with duplicated indices, then a construction such
 as:

 myxts-myxts[!duplicated(index(myxts))]

 should work.

 If you need all of the observations, and need to artificially make them unique
 (as is a common problem with tick data), then you will see discussion in the
 list archives here and other places regarding adding artificial indices to 
 high
 frequency data while preserving order. You will need the latest xts from R-
 Forge and use a construction like this:

 myxts-make.unique.index(myxts)

 which will (by default) add .1 sec to each non-unique index after the
 first, preserving order, and providing every observation with a unique index.
 Note that this presumes that the original order of the observations was
 correct in the first place, no provision has been made if you have different
 circumstances.

 Thanks to Jeff Ryan for (very) recently adding this second method.

 Regards,

  - Brian

 --
 Brian G. Peterson
 http://braverock.com/brian/
 Ph: 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.




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

www.lemnica.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.


This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, XR Content) are confidential 
and proprietary to XR Trading, LLC (XR) and/or its affiliates, and are 
protected by intellectual property laws.  Without the prior written consent of 
XR, the XR Content may not (i) be disclosed to any third party or (ii) be 
reproduced or otherwise used by anyone other than current employees of XR or 
its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY 
DISCLAIMS