ib_connect: Establish a connection with Interactive Brokers

View source: R/ib_connect.R

ib_connectR Documentation

Establish a connection with Interactive Brokers

Description

Creates a socket connection to a running instance of Trader Workstation or IB Gateway – either persistant (async) or one-time (sync).

Usage

ib_connect(
  master = FALSE,
  tws = FALSE,
  host = active_itr_option("host"),
  port = active_itr_option("port")
)

Arguments

host

(default = localhost) Where is the IB connection hosted?

port

(default = 4002) What port is the IB connection listening on? Defaults to 4002, which is IB's default port for the paper trading account port accessible using IB Gateway.

client_id

desired client id as an INT or CHAR. Must be a number between 0 and 32767, inclusive.

async

boolean:

"FALSE": Creates a socket that will immediately return the server's response to an API call, even if it means putting other processes on hold while the response is retrieved.

"TRUE" (default): The likely case if 'ib_connect()' is being called by a user instead of within one of the API calls. Will create a persistent async socket that, after being writen to, will release controlto other processes while the socket retrieves data from IB, which can be read later.


JakeVestal/InteractiveTradeR documentation built on June 5, 2024, 2:21 p.m.