0

我的代码的输出:

library(IBrokers)
tws <- twsConnect(port=7496)

Error in socketConnection(host = host, port = port, open = "ab", blocking = blocking) : 
  cannot open the connection
In addition: Warning message:
In socketConnection(host = host, port = port, open = "ab", blocking = blocking) :
  localhost:7496 cannot be opened

我已经在 TWS 中检查了我的全局配置。端口实际上是 7496。

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] IBrokers_0.9-12 xts_0.12-0      zoo_1.8-8      

loaded via a namespace (and not attached):
[1] compiler_3.6.3  tools_3.6.3     grid_3.6.3      lattice_0.20-40

我正在使用最新的 Linux Mint。我的 IB 账户已获批准并入金。

4

1 回答 1

3

它终于奏效了!原来“启用 ActiveX 和套接字客户端”复选框未选中。我检查了它并且它有效。

于 2020-08-29T15:58:31.877 回答