RTTWebClient"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(RTTWebClient)
library(lubridate)

Example of RTTWebApi methods (basic class)

Init Public(default) Client Obj (reference R class)

ttWebClient <- InitPublicWebClient(server = "ttlivewebapi.fxopen.com")
#or use InitPrivateWebClient(server = "ttlivewebapi.fxopen.com", port = 8443, id = "", key = "", secret = "") to set a private connect. Need set HMAC id, key and secret

Get Dividends data.table

print(ttWebClient$GetDividendsRawMethod())

Get Symbol data.table

print(ttWebClient$GetSymbolsInfoRawMethod())

Get BarHistory data.table

print(ttWebClient$GetBarRawMethod("EURUSD", "Bid","M1", round(as.double(now("UTC")) * 1000), count = -10))

Get TickHistory data.table

print(ttWebClient$GetTicksRawMethod("EURUSD", round(as.double(now("UTC")) * 1000), count = -10))

Example of RTTWebApiHost (Wrapper about RTTWebClient to make request from R easy)

Init RTTWebApiHost obj

ttWebApiHost <- InitRTTWebApiHost(server = "ttlivewebapi.fxopen.com")

Get Dividends data.table

print(ttWebApiHost$GetDividends())

Get Symbol data.table

print(ttWebApiHost$GetSymbolsInfo())

Get BarHistory data.table

print(ttWebApiHost$GetBarsHistory("EURUSD", "Bid","M1", now("UTC") - days(1), now("UTC")))

Get TicksHistory data.table

print(ttWebApiHost$GetTickHistory("EURUSD",  now("UTC") - days(1), now("UTC")))


Try the RTTWebClient package in your browser

Any scripts or data that you put into this service are public.

RTTWebClient documentation built on May 31, 2021, 5:07 p.m.