twsConnect {IBrokers}R Documentation

Establish or Terminate a Connection to TWS

Description

Connect or disconnect to the Trader Workstation (TWS).

Usage

twsConnect(clientId = 1, host = 'localhost', 
           port = 7496, verbose = TRUE, timeout = 10)
twsDisconnect(con)

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
con a valid twsConnection object

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.

Value

A twsConnection object.

Note

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

This may not work the first time on a Windows machine. The best course of action would be to upgrade your OS to something more robust like *nix.

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.1-0 Index]