QueryTrueFX: Query TrueFX(tm)

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/TFX.R

Description

Create a session with TrueFX(tm) and request market data.

Usage

1
2
3
4
5
  ConnectTrueFX(currency.pairs, username, password,
    qualifier = "default", format, snapshot = FALSE)

  QueryTrueFX(session, parse.response = TRUE,
    pretty = TRUE, reconnect = TRUE)

Arguments

currency.pairs

character vector, or comma delimited string of Symbols (ISO names) of currency pairs. (e.g. "EUR/USD,AUD/USD", or c("EUR/USD", "AUD/USD")). If missing or if nchar(currency.pairs) < 1, the Symbols of all currency pairs for which TrueFX(tm) provides historical data will be used (see references section).

username

character. A registered TrueFX(tm) user name; required to establish an authenticated session.

password

character. A registered TrueFX(tm) password; required to establish an authenticated session

qualifier

any string; required to establish an authenticated session. (“default” by default)

format

One of “default”, “csv”, or “html”. Indicates the format for the HTTP Response.

snapshot

logical. No incremental updates if TRUE

session

a TFXsession object created by ConnectTrueFX.

parse.response

logical. Should the results be passed through ParseTrueFX before returning?

pretty

logical. Passed to ParseTrueFX. Indicates whether to format the parsed results and convert to data.frame. Ignored if parse.response is not TRUE

reconnect

logical. If the TFXsession has timed out, should it be reconnected?

Details

If no currency.pairs are provided to ConnectTrueFX, the 15 pairs for which TrueFX(tm) offers historical data will be used. Note that only the first 10 of these are returned in an unauthenticated session.

ConnectTrueFX will create a TFXsession classed object that can be used in calls to QueryTrueFX to request market data.

Of the three formats, “default” is the most timely (updates first)and “csv” is the most delayed (updates last)

the “csv” and “html” formats have the “High” and “Low” columns backwards. (“default” does not). This may be corrected for in a future release if the TrueFX(tm) Web service doesn't correct it first.

Value

ConnectTrueFX returns a TFXsession object that is a TrueFX(tm) server-generated session ID returned with a successful authenticated session request. It is a colon delimited string with username, password, qualifier, and the time (in milliseconds) that the session was created.

QueryTrueFX returns the results of a TrueFX(tm) request using

Note

the formal arguments start with the same lowercase letter as their corresponding TrueFX(tm) Market Data Web Query Parameters

Author(s)

Garrett See

References

http://www.truefx.com/dev/data/TrueFX_MarketDataWebAPI_DeveloperGuide.pdf

http://truefx.com/?page=downloads to see for which pairs TrueFX(tm) provides historical data.

See Also

ParseTrueFX, Reconnect, TrueFXRef

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Cannot run these because there may not be an internet connection
## Not run: 
QueryTrueFX()  #unauthenticated
QueryTrueFX(pretty=FALSE)
QueryTrueFX(parse=FALSE)

## For authenticated session, you must have a username and password (it's free).
## Use your username and passward instead of JSTrader and Ou812
id <- ConnectTrueFX('EUR/USD,GBP/USD', username='JSTrader', password='Ou812')
QueryTrueFX(id)
QueryTrueFX(ConnectTrueFX(username='JSTrader', password='Ou812',
                          format='csv'), parse=FALSE)

QueryTrueFX(ConnectTrueFX(username='JSTrader', password='Ou812',
                          format='html'), parse=FALSE)

## If you have shiny installed
## install.packages("shiny", repos="http://rstudio.org/_packages")
library(shiny)
runGist("4122626")
## view the code for this shiny app at
#browseURL("https://gist.github.com/4122626")

## End(Not run)

TFX documentation built on May 2, 2019, 4:21 a.m.

Related to QueryTrueFX in TFX...