rib icon indicating copy to clipboard operation
rib copied to clipboard

is.null(private$socket) is not TRUE

Open MislavSag opened this issue 4 years ago • 3 comments

Hi,

I am trying to connect to IB through Gateway.

The Gateway works as expected when I use http calls, but when I try to use code from docs:

# Instantiate wrapper, client and connect
wrap <- IBWrapSimple$new()
ic   <- IBClient$new(wrap)
ic$connect(host="localhost", port=5000L, clientId=1L)

I got an error:

Error in ic$connect(host = "localhost", port = 5000L, clientId = 1L) : 
  is.null(private$socket) is not TRUE

MislavSag avatar Sep 29 '21 11:09 MislavSag

It looks like you are trying to start an already open connection. Try issuing ic$disconnect() first.

But, more importantly, since you mention http and port=5000 it seems you are trying to interact with the Client Portal, i.e. the REST based API.

This package is not usable with that. Instead, it's meant to be used with the Trader Workstation TWS API.

Both use the term "Gateway" but they are two unrelated pieces of software.

See available IB API.

lbilli avatar Sep 29 '21 12:09 lbilli

Is it possible to use this this package with Client Portal: https://interactivebrokers.github.io/cpwebapi/

I am not sure if it would be possible to install and run TWS on server, if I will want to run algo strategy on server.

Sorry for very late response.

MislavSag avatar Jul 25 '22 13:07 MislavSag

This package has no use with the Client Portal.

It certainly is possible to run TWS on a server or cloud, which I do.

If you don't know already, you can head to the TWS User Group forum to check out what other people are doing and seek advice.

lbilli avatar Jul 25 '22 13:07 lbilli