Added the SoftFX R wrapper package over FDK (Financial Development Kit)
If you see this error: "You are probably missing the Visual C++ Redistributable for Visual Studio 2013", then please download it from here: https://www.microsoft.com/en-us/download/details.aspx?id=40784
if(!require("data.table"))
install.packages("data.table")
library("data.table")
if(!require("stringi"))
install.packages("stringi")
library("stringi")
installBinaryHttr <- function(fdkRLibPackage){
basicUrl = "https://github.com/SoftFx/FdkRLib/raw/master/dist/"
fullUrl = paste(basicUrl, fdkRLibPackage, sep = "")
download.file(fullUrl,destfile = fdkRLibPackage, method = "libcurl")
install.packages(fdkRLibPackage, repos = NULL, type = "source", dependencies = TRUE)
file.remove(fdkRLibPackage)
}
if(!require("rClr"))
installBinaryHttr("rClr_0.7-4.zip")
installBinaryHttr("rFdk_1.0.20160315.zip")
You have sample code inside examples/sample_bars.r with various snippets of code.
A simple code sample code is the following:
ttConnect()
#Get configuration information of your account
head(ttConf.Symbol())
head(ttConf.Currency())
#Quotes in the last 5 minutes
now <-as.POSIXct(Sys.time(), tz="GMT")
# 300 seconds from present
prevNow <-as.POSIXct(now-(5*60))
ttFeed.TickBestHistory("EURUSD", startTime = prevNow, endTime=now)
Follow this link with expanded example and output:
Configuration: http://rpubs.com/ihalankou/configuration
Feed History: http://rpubs.com/ihalankou/feed_history
Trades: http://rpubs.com/ciplogic/107674
Real-time feed sample http://rpubs.com/ihalankou/realtime_quotes