twsConnect {IBrokers}R Documentation

Establish, Check or Terminate a Connection to TWS

Description

Functions to initiate, check, or disconnect from the Trader Workstation (TWS).

Usage

twsConnect(clientId = 1, host = 'localhost', 
           port = 7496, verbose = TRUE, timeout = 5,
           filename = NULL,
           blocking = TRUE)

twsDisconnect(con)

isConnected(x)
is.twsConnection(x)
is.twsPlayback(x)

Arguments

clientId the unique client id to associate with
host the host server
port the port that the TWS is listening on
verbose should the connection attempt be verbose
timeout length in seconds before aborting attempt
filename file containing recorded TWS data
blocking should the connection be blocking (TRUE)
con a valid twsConnection object
x a connection to be checked

Details

Returns a twsConnection object for use in subsequent TWS API calls. Attempting to create another connection to the server with the same clientId will result in an error.

If filename is set to a file containing data recorded in the standard TWS format - calls using this connection will playback the recorded data.

By default, on Unix-alike platforms blocking is set to TRUE By using select calls within the process, this allows for multiple connections to be managed within a single R session (e.g. manage data from an external source, and execute with Interactive Brokers).

Value

A twsConnection object.

Note

While it is not strictly required to disconnect via twsDisconnect it is probably advisable.

If not set options(digits.secs=6) will be called internally to properly represent on screen the R based timestamps.

Author(s)

Jeffrey A. Ryan

References

Interactive Brokers: www.interactivebrokers.com

Examples

## Not run: 
tws <- twsConnect()
twsDisconnect(tws)
## End(Not run)

[Package IBrokers version 0.2-6 Index]