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

Trades in account:

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

3. Monitoring using the ID

# Commented as it takes to long
ttFeed.GetLevel2(sym)
##    bidPrice bidVolume askPrice askVolume          createTime
## 1:  1.06290     5e+05  1.06292   1000000 2015-11-23 11:12:33
## 2:  1.06289     1e+06  1.06293   1500000 2015-11-23 11:12:33
Sys.sleep(3)

ttFeed.GetLevel2(sym)
##    bidPrice bidVolume askPrice askVolume          createTime
## 1:  1.06288     5e+05  1.06291     2e+06 2015-11-23 11:12:36
## 2:  1.06287     1e+06  1.06292     5e+05 2015-11-23 11:12:36
Sys.sleep(3)

ttFeed.GetLevel2(sym)
##    bidPrice bidVolume askPrice askVolume          createTime
## 1:  1.06289     2e+06  1.06291   1500000 2015-11-23 11:12:39
## 2:  1.06258     2e+03  1.06292    100000 2015-11-23 11:12:39

4. Unsubscribe

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