lbilli / rib

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

Time zone issue (JST) when connecting to the IB API #5

Closed jpuser2 closed 5 years ago

jpuser2 commented 5 years ago

Thank you for this new package.

Connection to the API seems ok but with a time zone error : JST (Japan) given by the IB server is not a valid time zone string. The issue seems to be the same for the Julia package Jib.jl

What is not clear to me at this stage is whether this error has a consequence on the next steps. I cannot retrieve any information from the connection but it may be because I am not using the right syntax and not because of this error.

> library(rib)
> # Instantiate wrapper, client and connect
> wrap <- IBWrapSimple$new()
> ic   <- IBClient$new(wrap)
> ic$connect(port=7496, clientId=1)
Server Version and Timestamp: 151 20190820 15:25:04 JST 
Error in checkTZ(substr(s, 19L, nchar(s))) : 
  tz %in% OlsonNames() is not TRUE
> ic$isOpen
[1] TRUE
> ic$reqCurrentTime()
> ic$checkMsg(2)
[1] 0
> wrap$content
NULL
lbilli commented 5 years ago

As three-letter time zone codes are generally unreliable, a rudimentary lookup is tried to determine the time zone used by the server. JST is not included yet; I'll add it soon.

In the meantime, if you want to try these packages, you can choose a different time zone (e.g. UTC, EST) in the TWS login screen.