Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MislavSag opened this issue Sep 29, 2021 · 3 comments
Open

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

MislavSag opened this issue Sep 29, 2021 · 3 comments

Comments

@MislavSag
Copy link

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
Copy link
Owner

lbilli commented Sep 29, 2021

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
Copy link
Author

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
Copy link
Owner

lbilli commented Jul 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants