Closed ghost closed 4 years ago
Same problem here. Would expect any function call to return a dict with the output. For example how should you get the ticket number programmatically after opening a trade? In the tutorial it was hardcoded by looking at the output, I assumed the function call opening the trade would return a dict which can be used in the next call to access the ticket number from there. I'm not sure how the workflow should be. Any advice will be much appreciated.
Hi @wisenlucky and @CornerStone12,
Thank you both very much for your interest in the project 🙂
The _get_response_()
function is indeed coded to return the response (when it is received).
Executing the call to _DWX_MTX_GET_ALL_OPEN_TRADES_
followed immediately by a call to _get_response_
will likely result in nothing being read from the variable. What's happening here is that data has been requested by the first call, but not yet been received as quickly as Python has executed the read after the request.
It is therefore important to enclose any calls to _DWX_MTX_xxxxx
methods inside a loop with an appropriate delay.
Please see an example implementation in the class method def _trader_(self, _symbol, _max_trades):
in the following file:
https://github.com/darwinex/dwx-zeromq-connector/blob/master/v2.0.1/python/examples/template/strategies/coin_flip_traders_v1.0.py
Hope this proves useful!
I connected Python and get responses from MT4, however, there is a small issue:
When I execute above code - all open trades are printed in console in JSON format, however I cannot save it as variable. _output returns None in this case. If I try _output = _zmq._thread_data_output _output also returns None
Can you plz help? Struggling with it over a week now.