[R-SIG-Finance] time index in high frequency data

2012-12-03 Thread Wei-han Liu
Hi R users:

I have a high frequency dataset with the following two time indexes: TDATE and 
TTIME. I would like to read in the following series in the specific data 
format: -mm-dd and hh-mm, and convert them as xts objects. Could any people 
can share some advice in this regard?

Many thanks.

Wei-han

TDATE TTIME 
20091009 930 
20091009 1130 
20091009 1500 
20091012 930 
20091012 1130 
20091012 1500 
20091013 930 
20091013 1130 
20091013 1500 
20091014 930 
20091014 1130 
20091014 1500 
20091015 930 
20091015 1130 
20091015 1500 
20091016 930 
20091016 1130 
20091016 1500 
20091019 930 
20091019 1130 
20091019 1500 
20091020 930 
20091020 1130 
20091020 1500 
20091021 930 
20091021 1130 
[[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] time index in high frequency data

2012-12-03 Thread Santosh Srinivas
You could find more direction on the r-help list .. I remember using
help from that list

You can do something like this.  (Code pasted from my routine)

f2 - function(d, t, format = %Y%m%d %H:%M:%S) {
as.POSIXct(strptime(paste(d, t),format=format))
}

require(zoo)
optData.z - read.zoo(optData.df.1[c(1:2,5:11)],index=list(1,2), FUN=f2)

The index columns refer to the date and time in your dataset.

zoo objects can be converted to xts using as.xts

I think you should be able to create xts directly using a similar approach


On Mon, Dec 3, 2012 at 5:10 PM, Wei-han Liu weihanliu2...@yahoo.com wrote:
 Hi R users:

 I have a high frequency dataset with the following two time indexes: TDATE 
 and TTIME. I would like to read in the following series in the specific data 
 format: -mm-dd and hh-mm, and convert them as xts objects. Could any 
 people can share some advice in this regard?

 Many thanks.

 Wei-han

 TDATE TTIME
 20091009 930
 20091009 1130
 20091009 1500
 20091012 930
 20091012 1130
 20091012 1500
 20091013 930
 20091013 1130
 20091013 1500
 20091014 930
 20091014 1130
 20091014 1500
 20091015 930
 20091015 1130
 20091015 1500
 20091016 930
 20091016 1130
 20091016 1500
 20091019 930
 20091019 1130
 20091019 1500
 20091020 930
 20091020 1130
 20091020 1500
 20091021 930
 20091021 1130
 [[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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread G See
Hello all,

I'd like to introduce the TFX package which I recently published to CRAN.

It is a simple R interface to the free TrueFX Web API. You can use it to
get real-time quotes with millisecond resolution and fractional-pip bid/ask
spreads for 26 currency pairs.

There is an RPub overview of the TFX package available here:
http://rpubs.com/gsee/TFX

The shiny package (http://www.rstudio.com/shiny/) has made the TFX package
more relevant (at least to me). You can see a demo of using TFX with shiny
by running the following code which will open a browser window and display
FX quotes that update every 750 milliseconds:

# install.packages('shiny', repos=c('http://rstudio.org/_packages',
# getOption('repos'))
library(shiny)
runGist(4122626)
#--
The code for the above shiny app can be viewed or downloaded from
https://gist.github.com/4122626

I've also had a little bit of success creating real-time streaming charts
using svSockets, following the video (
http://www.youtube.com/watch?v=rvT8XThGA8o) on the data.table homepage (
http://datatable.r-forge.r-project.org/) as a template and using TFX as the
data source.

Finally, TrueFX provides historical tick data for 15 currency pairs going
back to May 2009 (http://truefx.com/?page=downloads). There is a script in
the inst/parser directory of the FinancialInstrument package (
www.tinyurl.com/DownloadTrueFX) that can be used to download all of that
data to disk in a format that FinancialInstrument::getSymbols.FI can easily
read. This script is not intended to be used on Windows.

I have no affiliation with TrueFX.

Hope it's useful,
Garrett

P.S. The RPub (http://rpubs.com/gsee/TFX) is also included as a vignette in
the R-Forge version (installable with install.packages(TFX, repos=
http://r-forge.r-project.org;). As outlined in the NEWS file, the only
updates in the R-Forge version are aesthetic: there are better error
messages, a print.TFXsession method, and Reconnect and Disconnect no longer
print the returned TFXsession object.

[[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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread Dennis Lee


I copied and pasted the code for Shiny app, but it doesn't update the FX quotes
every 750 ms. I tried it on Firefox and Chrome.




 From: G See gsee...@gmail.com
To: r-sig-finance r-sig-finance@r-project.org 
Sent: Monday, 3 December 2012 8:57 PM
Subject: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX Web API

[sorry for the previous HTML e-mail. Gmail seems to think that's what
I meant to do]

Hello all,

I'd like to introduce the TFX package which I recently published to CRAN.

It is a simple R interface to the free TrueFX Web API. You can use it
to get real-time quotes with millisecond resolution and fractional-pip
bid/ask spreads for 26 currency pairs.

There is an RPub overview of the TFX package available here:
http://rpubs.com/gsee/TFX

The shiny package (http://www.rstudio.com/shiny/) has made the TFX
package more relevant (at least to me). You can see a demo of using
TFX with shiny by running the following code which will open a browser
window and display FX quotes that update every 750 milliseconds:

# install.packages('shiny', repos=c('http://rstudio.org/_packages',
# getOption('repos'))
library(shiny)
runGist(4122626)
#--
The code for the above shiny app can be viewed or downloaded from
https://gist.github.com/4122626

I've also had a little bit of success creating real-time streaming
charts using svSockets, following the video
(http://www.youtube.com/watch?v=rvT8XThGA8o) on the data.table
homepage (http://datatable.r-forge.r-project.org/) as a template and
using TFX as the data source.

Finally, TrueFX provides historical tick data for 15 currency pairs
going back to May 2009 (http://truefx.com/?page=downloads). There is a
script in the inst/parser directory of the FinancialInstrument package
(www.tinyurl.com/DownloadTrueFX) that can be used to download all of
that data to disk in a format that FinancialInstrument::getSymbols.FI
can easily read. This script is not intended to be used on Windows.

I have no affiliation with TrueFX.

Hope it's useful,
Garrett

P.S. The RPub (http://rpubs.com/gsee/TFX) is also included as a
vignette in the R-Forge version (installable with
install.packages(TFX, repos=http://r-forge.r-project.org;). As
outlined in the NEWS file, the only updates in the R-Forge version are
aesthetic: there are better error messages, a print.TFXsession method,
and Reconnect and Disconnect no longer print the returned TFXsession
object.

___
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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread G See
Aw. That's a shame.  What version of shiny and websockets are you using?

Maybe try:
   devtools::install_github('shiny', 'rstudio')

It works for me on linux with the following sessionInfo

 sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] bitops_1.0-4.1 TFX_0.1.1  shiny_0.1.12

loaded via a namespace (and not attached):
[1] caTools_1.13 digest_0.6.0 RJSONIO_1.0-1tools_2.15.2
[5] websockets_1.1.6 XML_3.95-0.1 xtable_1.7-0


Garrett

On Mon, Dec 3, 2012 at 10:33 AM, Dennis Lee dennis...@yahoo.com.au wrote:


 I copied and pasted the code for Shiny app, but it doesn't update the FX 
 quotes
 every 750 ms. I tried it on Firefox and Chrome.



 
  From: G See gsee...@gmail.com
 To: r-sig-finance r-sig-finance@r-project.org
 Sent: Monday, 3 December 2012 8:57 PM
 Subject: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX Web API

 [sorry for the previous HTML e-mail. Gmail seems to think that's what
 I meant to do]

 Hello all,

 I'd like to introduce the TFX package which I recently published to CRAN.

 It is a simple R interface to the free TrueFX Web API. You can use it
 to get real-time quotes with millisecond resolution and fractional-pip
 bid/ask spreads for 26 currency pairs.

 There is an RPub overview of the TFX package available here:
 http://rpubs.com/gsee/TFX

 The shiny package (http://www.rstudio.com/shiny/) has made the TFX
 package more relevant (at least to me). You can see a demo of using
 TFX with shiny by running the following code which will open a browser
 window and display FX quotes that update every 750 milliseconds:

 # install.packages('shiny', repos=c('http://rstudio.org/_packages',
 # getOption('repos'))
 library(shiny)
 runGist(4122626)
 #--
 The code for the above shiny app can be viewed or downloaded from
 https://gist.github.com/4122626

 I've also had a little bit of success creating real-time streaming
 charts using svSockets, following the video
 (http://www.youtube.com/watch?v=rvT8XThGA8o) on the data.table
 homepage (http://datatable.r-forge.r-project.org/) as a template and
 using TFX as the data source.

 Finally, TrueFX provides historical tick data for 15 currency pairs
 going back to May 2009 (http://truefx.com/?page=downloads). There is a
 script in the inst/parser directory of the FinancialInstrument package
 (www.tinyurl.com/DownloadTrueFX) that can be used to download all of
 that data to disk in a format that FinancialInstrument::getSymbols.FI
 can easily read. This script is not intended to be used on Windows.

 I have no affiliation with TrueFX.

 Hope it's useful,
 Garrett

 P.S. The RPub (http://rpubs.com/gsee/TFX) is also included as a
 vignette in the R-Forge version (installable with
 install.packages(TFX, repos=http://r-forge.r-project.org;). As
 outlined in the NEWS file, the only updates in the R-Forge version are
 aesthetic: there are better error messages, a print.TFXsession method,
 and Reconnect and Disconnect no longer print the returned TFXsession
 object.

 ___
 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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread Dirk Eddelbuettel

On 3 December 2012 at 08:33, Dennis Lee wrote:
| I copied and pasted the code for Shiny app, but it doesn't update the FX 
quotes
| every 750 ms. I tried it on Firefox and Chrome.

I copied and paste ? Maybe you did that the wrong way?  

What happens when you install the shiny and TFX packages, and execute

library(shiny)
runGist(4122626)

which has been very reliable for me on different machine 
(home/work/netbook/...) ?

Dirk

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.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.


Re: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread Dennis Lee
I am running it on Windows, maybe you didn't understand what I said.

I did get the first quote displayed correctly, so it is not because of the 
library.

My problem is that it doesn't update periodically. I will try to figure it out
when I have time, just too late now (its past midnight here) to solve this.

 sessionInfo() R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit) 

It could be because of my R version (maybe not), but then again I have 

installed the CRAN version of shiny (and not the dev version on Github).




 From: Dirk Eddelbuettel e...@debian.org

Cc: r-sig-finance r-sig-finance@r-project.org 
Sent: Tuesday, 4 December 2012 12:56 AM
Subject: Re: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX Web 
API


On 3 December 2012 at 08:33, Dennis Lee wrote:
| I copied and pasted the code for Shiny app, but it doesn't update the FX 
quotes
| every 750 ms. I tried it on Firefox and Chrome.

I copied and paste ? Maybe you did that the wrong way?  

What happens when you install the shiny and TFX packages, and execute

    library(shiny)
    runGist(4122626)

which has been very reliable for me on different machine 
(home/work/netbook/...) ?

Dirk

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread Jeff Ryan
If the backend is using websockets, that is very new ground in the land of
HTML.  M$ prides itself typically on being off by a decade w.r.t. adoption
of such 'shiny' things.

So... that may indeed be your issue.

Jeff


On Mon, Dec 3, 2012 at 11:05 AM, Dennis Lee dennis...@yahoo.com.au wrote:

 I am running it on Windows, maybe you didn't understand what I said.

 I did get the first quote displayed correctly, so it is not because of the
 library.

 My problem is that it doesn't update periodically. I will try to figure it
 out
 when I have time, just too late now (its past midnight here) to solve this.

  sessionInfo() R version 2.15.1 (2012-06-22)
 Platform: i386-pc-mingw32/i386 (32-bit)

 It could be because of my R version (maybe not), but then again I have

 installed the CRAN version of shiny (and not the dev version on Github).



 
  From: Dirk Eddelbuettel e...@debian.org

 Cc: r-sig-finance r-sig-finance@r-project.org
 Sent: Tuesday, 4 December 2012 12:56 AM
 Subject: Re: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX
 Web API


 On 3 December 2012 at 08:33, Dennis Lee wrote:
 | I copied and pasted the code for Shiny app, but it doesn't update the FX
 quotes
 | every 750 ms. I tried it on Firefox and Chrome.

 I copied and paste ? Maybe you did that the wrong way?

 What happens when you install the shiny and TFX packages, and execute

 library(shiny)
 runGist(4122626)

 which has been very reliable for me on different machine
 (home/work/netbook/...) ?

 Dirk

 --
 Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.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.




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

www.lemnica.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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread G See
I just tried it on Windows and it works for me with the sessionInfo below.

Are you sure you have at least version 1.1.6 of websockets?

 sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)

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

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

other attached packages:
[1] bitops_1.0-5 TFX_0.1.0shiny_0.2.3

loaded via a namespace (and not attached):
[1] caTools_1.13 digest_0.5.2 RJSONIO_1.0-1tools_2.15.1
 websockets_1.1.6 XML_3.9-4.1  xtable_1.7-0

Garrett


On Mon, Dec 3, 2012 at 11:09 AM, Jeff Ryan jeff.a.r...@gmail.com wrote:
 If the backend is using websockets, that is very new ground in the land of
 HTML.  M$ prides itself typically on being off by a decade w.r.t. adoption
 of such 'shiny' things.

 So... that may indeed be your issue.

 Jeff


 On Mon, Dec 3, 2012 at 11:05 AM, Dennis Lee dennis...@yahoo.com.au wrote:

 I am running it on Windows, maybe you didn't understand what I said.

 I did get the first quote displayed correctly, so it is not because of the
 library.

 My problem is that it doesn't update periodically. I will try to figure it
 out
 when I have time, just too late now (its past midnight here) to solve this.

  sessionInfo() R version 2.15.1 (2012-06-22)
 Platform: i386-pc-mingw32/i386 (32-bit)

 It could be because of my R version (maybe not), but then again I have

 installed the CRAN version of shiny (and not the dev version on Github).



 
  From: Dirk Eddelbuettel e...@debian.org

 Cc: r-sig-finance r-sig-finance@r-project.org
 Sent: Tuesday, 4 December 2012 12:56 AM
 Subject: Re: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX
 Web API


 On 3 December 2012 at 08:33, Dennis Lee wrote:
 | I copied and pasted the code for Shiny app, but it doesn't update the FX
 quotes
 | every 750 ms. I tried it on Firefox and Chrome.

 I copied and paste ? Maybe you did that the wrong way?

 What happens when you install the shiny and TFX packages, and execute

 library(shiny)
 runGist(4122626)

 which has been very reliable for me on different machine
 (home/work/netbook/...) ?

 Dirk

 --
 Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.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.




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

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

___
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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread Dennis Lee
I did get this warning when I ran the code:

 runGist(4122626) Loading required package: TFX Warning: package ‘TFX’ 
 was built under R version 2.15.2 

I have checked websockets:


loaded via a namespace (and not attached): [1] bitops_1.0-5 caTools_1.13
 devtools_0.8 [4] digest_0.6.0 evaluate_0.4.2   httr_0.2 [7] 
memoise_0.1  parallel_2.15.1  plyr_1.7.1  
[10] RCurl_1.95-3 RJSONIO_1.0-1stringr_0.6.1   
[13] tools_2.15.1 websockets_1.1.6 whisker_0.1 
[16] xtable_1.7-0 

I have checked pause updates:

Pause updates

So, Windows is not the issue, I have to update R to version 2.15.2 then
seems logical to me.





 From: G See gsee...@gmail.com
To: Jeff Ryan jeff.a.r...@gmail.com 

ject.org 
Sent: Tuesday, 4 December 2012 1:12 AM
Subject: Re: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX Web 
API

I just tried it on Windows and it works for me with the sessionInfo below.

Are you sure you have at least version 1.1.6 of websockets?

 sessionInfo()
R version 2.15.1 (2012-06-22)
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 LC_NUMERIC=C
                      LC_TIME=English_United States.1252

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

other attached packages:
[1] bitops_1.0-5 TFX_0.1.0    shiny_0.2.3

loaded via a namespace (and not attached):
[1] caTools_1.13     digest_0.5.2     RJSONIO_1.0-1    tools_2.15.1
websockets_1.1.6 XML_3.9-4.1      xtable_1.7-0

Garrett


On Mon, Dec 3, 2012 at 11:09 AM, Jeff Ryan jeff.a.r...@gmail.com wrote:
 If the backend is using websockets, that is very new ground in the land of
 HTML.  M$ prides itself typically on being off by a decade w.r.t. adoption
 of such 'shiny' things.

 So... that may indeed be your issue.

 Jeff



e:

 I am running it on Windows, maybe you didn't understand what I said.

 I did get the first quote displayed correctly, so it is not because of the
 library.

 My problem is that it doesn't update periodically. I will try to figure it
 out
 when I have time, just too late now (its past midnight here) to solve this.

  sessionInfo() R version 2.15.1 (2012-06-22)
 Platform: i386-pc-mingw32/i386 (32-bit)

 It could be because of my R version (maybe not), but then again I have

 installed the CRAN version of shiny (and not the dev version on Github).



 
  From: Dirk Eddelbuettel e...@debian.org

 Cc: r-sig-finance r-sig-finance@r-project.org
 Sent: Tuesday, 4 December 2012 12:56 AM
 Subject: Re: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX
 Web API


 On 3 December 2012 at 08:33, Dennis Lee wrote:
 | I copied and pasted the code for Shiny app, but it doesn't update the FX
 quotes
 | every 750 ms. I tried it on Firefox and Chrome.

 I copied and paste ? Maybe you did that the wrong way?

 What happens when you install the shiny and TFX packages, and execute

     library(shiny)
     runGist(4122626)

 which has been very reliable for me on different machine
 (home/work/netbook/...) ?

 Dirk

 --
 Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.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.




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

 www.lemnica.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.
[[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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread G See
On Mon, Dec 3, 2012 at 11:28 AM, Dennis Lee dennis...@yahoo.com.au wrote:
 I did get this warning when I ran the code:

 runGist(4122626) Loading required package: TFX Warning: package ‘TFX’ was 
 built under R version 2.15.2

 I have checked websockets:


 loaded via a namespace (and not attached): [1] bitops_1.0-5 caTools_1.13  
devtools_0.8 [4] digest_0.6.0 evaluate_0.4.2   httr_0.2 
 [7] memoise_0.1  parallel_2.15.1  plyr_1.7.1
 [10] RCurl_1.95-3 RJSONIO_1.0-1stringr_0.6.1
 [13] tools_2.15.1 websockets_1.1.6 whisker_0.1
 [16] xtable_1.7-0

 I have checked pause updates:

 Pause updates

This should be UNchecked!


 So, Windows is not the issue, I have to update R to version 2.15.2 then
 seems logical to me.


But, I ran it on R 2.15.1 and it worked fine.  See my sessionInfo in
the previous message.

So, I'm not sure what's not working for you.  Maybe some local
security settings?

Garrett

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


Re: [R-SIG-Finance] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread Jeff Ryan
websockets are _incredibly_ browser sensitive, as I noted before.  I worked
on/with the websockets package back when Bryan Lewis first wrote it, and to
say getting the pieces aligned is tricky is an understatement.

I don't know the current browser status, but you may need to update those
as well.

HTH
Jeff


On Mon, Dec 3, 2012 at 11:40 AM, G See gsee...@gmail.com wrote:

 On Mon, Dec 3, 2012 at 11:28 AM, Dennis Lee dennis...@yahoo.com.au
 wrote:
  I did get this warning when I ran the code:
 
  runGist(4122626) Loading required package: TFX Warning: package ‘TFX’
 was built under R version 2.15.2
 
  I have checked websockets:
 
 
  loaded via a namespace (and not attached): [1] bitops_1.0-5
 caTools_1.13 devtools_0.8 [4] digest_0.6.0 evaluate_0.4.2
 httr_0.2 [7] memoise_0.1  parallel_2.15.1  plyr_1.7.1
  [10] RCurl_1.95-3 RJSONIO_1.0-1stringr_0.6.1
  [13] tools_2.15.1 websockets_1.1.6 whisker_0.1
  [16] xtable_1.7-0
 
  I have checked pause updates:
 
  Pause updates

 This should be UNchecked!

 
  So, Windows is not the issue, I have to update R to version 2.15.2 then
  seems logical to me.
 

 But, I ran it on R 2.15.1 and it worked fine.  See my sessionInfo in
 the previous message.

 So, I'm not sure what's not working for you.  Maybe some local
 security settings?

 Garrett

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




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

www.lemnica.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] Introducing TFX: An R Interface to the TrueFX Web API

2012-12-03 Thread rex

G See gsee...@gmail.com [2012-12-03 04:57]:

I'd like to introduce the TFX package which I recently published to CRAN.

It is a simple R interface to the free TrueFX Web API. You can use it
to get real-time quotes with millisecond resolution and fractional-pip
bid/ask spreads for 26 currency pairs.

There is an RPub overview of the TFX package available here:
http://rpubs.com/gsee/TFX


Wow, this looks _very_ cool! Thank you for all the R work you do.


# install.packages('shiny', repos=c('http://rstudio.org/_packages',
# getOption('repos'))
library(shiny)
runGist(4122626)


Runs with no problems here. Starts a Chrome session on localhost:8100.


#--
The code for the above shiny app can be viewed or downloaded from
https://gist.github.com/4122626


Did that, pasted server.R and ui.R into ~/R/gsee/, then within
an interactive R session, did:


runApp(appDir = '~/R/gsee', port = 8100L)


It runs as before, and after opening up port 8100, the world can see
it. Amazing. Firefox 16.x and Chrome 20.0.1132.57 both work.


sessionInfo()

R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)

[...]

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


other attached packages:
[1] bitops_1.0-4.1 shiny_0.2.3TFX_0.1.1 


loaded via a namespace (and not attached):
[1] caTools_1.13 digest_0.5.2 RJSONIO_0.98-1   tcltk_2.15.1
[5] tools_2.15.1 websockets_1.1.6 XML_3.9-4xtable_1.7-0 


I've also had a little bit of success creating real-time streaming
charts using svSockets, following the video
(http://www.youtube.com/watch?v=rvT8XThGA8o) on the data.table
homepage (http://datatable.r-forge.r-project.org/) as a template and
using TFX as the data source.


Love to see this in action.


Hope it's useful,


Looks as if it will be very useful indeed. :)

Thanks again,

-rex
--
All of us necessarily hold many casual opinions that are ludicrously
wrong simply because life is far too short for us to think through even
a small fraction of the topics that we come across.
  --Julian Simon

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