R Shiny interface for the OANDA fxTrade API

[This article was first published on shikokuchuo{net}, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

1 478ec2042047eb285ec4d30177a825af0f8b106a38ac1faeb863c6c1c9df407f

About ichimoku

The ichimoku R package provides tools for creating and visualising Ichimoku Kinko Hyo (cloud chart) strategies. It features in the Empirical Finance CRAN Task View, and was selected as one of RStudio’s Top 40 New CRAN Packages for May 2021. It provides in its latest version an interface to the OANDA fxTrade API.

About the OANDA fxTrade API

OANDA is an authoritative source of foreign exchange data utilised by both governments and global corporations alike. OANDA offers a few APIs, including its rates for business, but the fxTrade API is perhaps the most comprehensive, built upon its retail and professional trading offering of the same name. Access to the fxTrade API is free but requires registration for a practice/demo account.

The API can be used for retrieving historical and live streaming price data for major currencies, metals, commodities, government bonds and stock indices. It is a rich source of financial data with excellent availability, for instance daily OHLC pricing data for major forex pairs from the start of 2005, and data granularity ranging from 5 seconds to monthly.

For the total list of over 120 covered instruments please see here.


Click on an image to view in full resolution.

Showcased here is the function oanda_studio(), the implementation in R Shiny. As it is a Shiny app, the function may be called without any arguments; the full range of options can simply be selected interactively from within the web interface.

Data is live and updates at the specified refresh rate (default is every 5 secs).

The cursor infotip provides an innovative overview of the data directly from the chart (can be turned on or off as desired).



oanda_studio with infotip

Of course arguments for customisation can be specified within the call to oanda_studio() itself. Demonstrating some further options below with Soybean futures:

oanda_studio("SOYBN_USD", granularity = "M5", refresh = 10, price = "B", theme = "dark")

oanda_studio in dark mode

Other functions

Other functions to access the OANDA fxTrade API are included in the ichimoku package. These are standard R functions for retrieving data in tabular form and charting (not reliant on Shiny), and include:

ichimoku R package site: https://shikokuchuo.net/ichimoku/

ichimoku CRAN page: https://CRAN.R-project.org/package=ichimoku

ichimoku OANDA fxTrade API vignette: https://shikokuchuo.net/ichimoku/articles/xoanda.html

‘OANDA’ and ‘fxTrade’ are trademarks owned by OANDA Corporation, an entity unaffiliated with the ichimoku package.

To leave a comment for the author, please follow the link and comment on their blog: shikokuchuo{net}.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)