Sections: #1. Connection #2. Request a monitoring ID #3. Monitoring using the ID #4. Unsubscribe

1. Connection

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] 0

2. Request a monitoring ID

sym = ttFeed.Subscribe("EURUSD", 2)

3. Monitoring using the ID

ttFeed.GetLevel2(sym)
## Empty data.table (0 rows) of 5 cols: bidPrice,bidVolume,askPrice,askVolume,createTime
Sys.sleep(3)

ttFeed.GetLevel2(sym)
##    bidPrice bidVolume askPrice askVolume          createTime
## 1:  1.08460      9000  1.08462   1500000 2016-01-12 15:00:37
## 2:  1.08459    991000  1.08463   3000000 2016-01-12 15:00:37
Sys.sleep(3)

ttFeed.GetLevel2(sym)
##    bidPrice bidVolume askPrice askVolume          createTime
## 1:  1.08454     11000  1.08457   1999000 2016-01-12 15:00:40
## 2:  1.08453   5991000  1.08458   2000000 2016-01-12 15:00:40

4. Unsubscribe

# Commented as it takes to long
ttFeed.Unsubscribe(sym)
## NULL