IBrokers is very convenient retrieving data from IB for stocks and futures.

Today I tried it with options.
I have encountered an error:  "Unable connect as the client id is already in
use. Retry with a unique client id."
I wonder  how to change the unique client id.

After restarting the R terminal, it seems that it still could not retrieve
the twsOption("QQQAS",expiry="200908", strike="45.0", right="C").

Thanks.

> opt<-twsOption("GC",expiry="200908", strike="930.0", right="C")
> reqHistoricalData(opt,useRTH="0",duration="6 M",)
waiting for TWS reply ....
Error: Unable to complete historical data request
In addition: Warning message:
In errorHandler(con, verbose, OK = c(165, 300, 366, 2104, 2106,  :
  No security definition has been found for the request.
> opt1 <- twsOption("QQQAS",expiry="200908", strike="45.0", right="C")
> reqHistoricalData(opt1,useRTH="0",duration="6 M",)
Error in twsConnect(123456, blocking = TRUE) :
In addition: Warning message:
In errorHandler(s, verbose) :
  Unable connect as the client id is already in use. Retry with a unique
client id.
> twsDisconnect(tws)  # disconnect from the TWS
> tws <- twsConnect() # make a new connection to the TWS
> reqCurrentTime(tws) # check the server's timestamp
[1] "2009-06-04 08:50:57 GMT"
> reqHistoricalData(opt1,useRTH="0",duration="6 M",)
Error in twsConnect(123456, blocking = TRUE) :
In addition: Warning message:
In errorHandler(s, verbose) :
  Unable connect as the client id is already in use. Retry with a unique
client id.

	[[alternative HTML version deleted]]

