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

G See gsee000 at gmail.com
Mon Dec 3 13:57:17 CET 2012


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



More information about the R-SIG-Finance mailing list