oanda_stream {ichimoku}R Documentation

OANDA Streaming Data

Description

Stream live price and liquidity data for major currencies, metals, commodities, government bonds and stock indices from the OANDA fxTrade Streaming API.

Usage

oanda_stream(instrument, display = 8L, limit, server, apikey)

Arguments

instrument

string containing the base currency and quote currency delimited by '_' or '-' (e.g. "USD_JPY" or "usd-jpy"). Use the oanda_instruments function to return a list of all valid instruments.

display

[default 8L] integer rows of data to display in the console at any one time.

limit

(optional) specify a time in seconds by which to limit the streaming session. The session will end with data returned automatically after the specified time has elapsed.

server

(optional) specify the "practice" or "live" server according to the account type held. If not specified, will default to "practice", unless this has been changed by oanda_switch.

apikey

(optional) string containing the OANDA fxTrade API key (personal access token), or function that returns this string. Does not need to be specified if already stored as the environment variable OANDA_API_KEY or by oanda_set_key. Can also be entered interactively if not specified.

Details

This function connects to the OANDA fxTrade Streaming API. Send an interrupt using the 'Esc' key or 'Ctrl+c' to stop the stream and return the session data.

Note: only messages of type 'PRICE' are processed. Messages of type 'HEARTBEAT' consisting of only a timestamp are discarded.

Value

Returned invisibly, a dataframe containing the data for the streaming session on function exit. The latest rows of the dataframe are printed to the console, as governed by the 'display' argument.

Streaming Data

Summarised from the streaming API documentation:

Further Details

Please refer to the OANDA fxTrade API vignette by calling: vignette("xoanda", package = "ichimoku").

Examples

## Not run: 
# OANDA fxTrade API key required to run this example
data <- oanda_stream("USD_JPY", display = 8L)

## End(Not run)


[Package ichimoku version 1.5.1 Index]