lbilli / rib

An R implementation of Interactive Brokers API
GNU General Public License v3.0
33 stars 7 forks source link

is.null(private$socket) is not TRUE #12

Open MislavSag opened 2 years ago

MislavSag commented 2 years ago

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
lbilli commented 2 years ago

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.

MislavSag commented 2 years ago

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.

lbilli commented 2 years ago

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.