darwinex / dwx-zeromq-connector

Wrapper library for algorithmic trading in Python 3, providing DMA/STP access to Darwinex liquidity via a ZeroMQ-enabled MetaTrader Bridge EA.
https://blog.darwinex.com/zeromq-interface-python-r-metatrader4/
BSD 3-Clause "New" or "Revised" License
344 stars 228 forks source link

zmp communication problem between python and MT4 #12

Closed hongyx11 closed 5 years ago

hongyx11 commented 5 years ago

Hi, I want to test the subscribe data function. I can successfully get EA work, but when I execute my subscriber in python script, it doesn't show anything, when I pass the parameter zmq.NOBLOCK to the socket.recv(), it gives me the error: zmq.error.again: Resource temporarily unavailable. I write the simplest code of subscriber in a single python script to check the rightness. I also test the zmq pub sub mode seperately only in python. It works.

import sys import zmq port = "5576" context = zmq.Context() socket = context.socket(zmq.SUB) socket.connect ("tcp://localhost:5576") socket.setsockopt_string(zmq.SUBSCRIBE,"EURUSD") string = socket.recv(zmq.NOBLOCK) print(string)

Does anyone know why? Thanks!

hongyx11 commented 5 years ago

Sloved after reboot.