简体   繁体   中英

no data exchanged between IBpy2 and IBGateway

I am using backtrader as client with IBpy2 to access my IBC controlled IBGateway running on Docker.

I'm facing the issue that my system starts and just hangs there, with no errors or printed debug info.

I debugged my way as far as this line , reading:

self.m_serverVersion = self.m_reader.readInt()

Which is waiting to receive the server version through the connection, which never arrives.

I get this only when the IBGateway runs through docker, I don't understand how it's possible that IBpy can establish a connection but cannot exchange data.

I could not pinpoint where the problem might be, the fact that it happens only when IBC is on docker compose suggests that this depends on Docker compose, here's my docker-compose.yml file

--- updated: ---

version: '3.7'
services:
  trader:
    build: ./
    image: mytrader
    container_name: mytrader
    networks: 
      - trading
    depends_on: 
      - tws  

  tws:
    build: ./ib-docker
    image: ibconnect
    container_name: ibconnect
    ports:
      # - "4001:4001"
      - "4003:4003"
      - "5901:5901"
    volumes:
      - ./ib-docker/config.ini:/root/ibc/config.ini
      # - ./ib-docker/twsstart.sh:/opt/ibc/twsstart.sh
      - ./ib-docker/gatewaystart.sh:/opt/ibc/gatewaystart.sh
    environment:
      - TZ=UTC
      # Variables pulled from /root/IBController/IBControllerGatewayStart.sh
      - VNC_PASSWORD=password
      - IBC_PATH=/opt/ibc
      - LOG_PATH=/root/ibc/logs
    env_file:
      - tws_credentials.env
    networks: 
      - trading

networks: 
  trading: 
    driver: bridge

and the list of networks

% docker network ls
NETWORK ID          NAME                    DRIVER              SCOPE
4ad25f1cf0f4        bridge                  bridge              local
9ca6f0e3f509        giuliotrader_default    bridge              local
3afbca83e020        giuliotrader_trading    bridge              local
73c2590a3a11        host                    host                local
34e58c19f5e3        none                    null                local

happy to post any additional files or info as might be needed.

Thanks,

Good afternoon, maybe you should use link from trader to tws

services:
  trader:
    links:
      - tws
    build: ./
    image: mytrader
    container_name: mytrader

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM