Sections: #1. Connection #2. Request a monitoring ID #3. Monitoring using the ID #4. Unsubscribe
Connect to TT Live server: ttConnect()
options(warn=-1)
require(rFdk)
## Loading required package: rFdk
ttConnect()
## Loading required package: rClr
## Loading the dynamic library for Microsoft .NET runtime...
## Loaded Common Language Runtime version 4.0.30319.42000
## Loading required package: stringi
## Loading required package: data.table
## [1] TRUE
sym = ttFeed.Subscribe("EURUSD", 2)
ttFeed.GetLevel2(sym)
## bidPrice bidVolume askPrice askVolume createTime
## 1: 1.12468 1e+06 1.12471 1e+06 2016-09-13 12:21:55
## 2: 1.12466 1e+05 1.12472 1e+05 2016-09-13 12:21:55
Sys.sleep(3)
ttFeed.GetLevel2(sym)
## bidPrice bidVolume askPrice askVolume createTime
## 1: 1.12468 1e+06 1.12471 1e+06 2016-09-13 12:21:55
## 2: 1.12466 1e+05 1.12472 1e+05 2016-09-13 12:21:55
Sys.sleep(3)
ttFeed.GetLevel2(sym)
## bidPrice bidVolume askPrice askVolume createTime
## 1: 1.12468 1e+06 1.12471 1e+06 2016-09-13 12:21:55
## 2: 1.12466 1e+05 1.12472 1e+05 2016-09-13 12:21:55
# Commented as it takes to long
ttFeed.Unsubscribe(sym)
## NULL