TFX: TFX package: An R interface to the TrueFX(tm) Market Data Web...

Description Details Author(s) References Examples


TrueFX(tm) is a brand name that is owned by Integral Development Corp. This software is in no way affiliated, endorsed, or approved by TrueFX(tm), Integral Development Corp, or any of its affiliates. The TFX package provides functions to access the free, real-time, top-of-book, dealable, interbank foreign exchange rate quotes provided by TrueFX(tm).


The Web API can be accessed with an authenticated or an unauthenticated session. The following is from TrueFX(tm) Market Data Web API Developer Guide: "Unauthenticated requests ... return a default response in the form of a snapshot session that includes data for all currency pairs... Unauthenticated requests do not support the more powerful query-based functionality, including incremental responses containing only the changed currency pairs."

A registered TrueFX(tm) account with a confirmed username is required to create an authenticated session (TrueFX(tm) accounts are free).

There are typically three steps to creating an authenticated TrueFX(tm) session and requesting data:

ConnectTrueFX is used to request a TFXsession object which has a session ID needed to make a data request.

QueryTrueFX will request market data from TrueFX(tm) using a TFXsession object that was created by ConnectTrueFX

ParseTrueFX will parse the results returned by QueryTrueFX into something that is easier to work with.

There are also functions to Disconnect and Reconnect a TFXsession

This package does not yet have explicit support for streaming data, but it can be accomplished a few different ways, one of which would be to use a while loop.

In addition to real time data, TrueFX(tm) also offers historical data since 2009.

From the TrueFX(tm) website, "TrueFX is the first service that brings you real, dealable prices from real market participants from all the major market makers, with absolutely no intermediary. As a technology company, we can offer you historical tick-by-tick market data, at zero cost to you.

This data is top-of-the-book, tick-by-tick market data, with fractional pip spreads in millisecond detail. All timestamps are based on GMT."

The data can be downloaded from

There is a script in the /inst/parser directory of the FinancialInstrument pacakage ( that will download all available data, convert it to xts and save it to disk in binary files that are split by day such that FinancialInstrument:::getSymbols.FI can easily read them.

Some version of that script may make its way into a future release of this package.


Garrett See



## Not run: 
## Unauthenticated

## Must have a TrueFX(tm) account to run the following (Membership is free)
## Replace JSTrader and Ou812 with your username and password, respectively
id <- ConnectTrueFX("EUR/USD,AUD/JPY", u='JSTrader', p='Ou812', f='html')

browseURL(paste0("", id))

#view the Web API Developer Guide:

## End(Not run)

Search within the TFX package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.