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
341 stars 227 forks source link

Exception Type KeyError. Args: ('_action',) #100

Closed ciremoussadia closed 3 years ago

ciremoussadia commented 3 years ago

Hello, it's almost a week I'm having this error for almost all commands.

Exception Type KeyError. Args:
('_action',)

This is an example


In [1]: from DWX_ZeroMQ_Connector_v2_0_1_RC8 import DWX_ZeroMQ_Connector

In [2]: dwx = DWX_ZeroMQ_Connector()
[INIT] Ready to send commands to METATRADER (PUSH): 32768
[INIT] Listening for responses from METATRADER (PULL): 32769
[INIT] Listening for market data from METATRADER (SUB): 32770

In [3]: dwx._DWX_MTX_NEW_TRADE_()

Exception Type KeyError. Args:
('_action',)
In [4]: 
elvinex commented 3 years ago

Hi, I can't replicate this error. As you can see in _generate_default_order_dict() the action is set to '_action': 'OPEN' if you don't define a custom action.

Did you download the most recent version and are you using python 3?

ciremoussadia commented 3 years ago

@elvinex yes I've the latest version of both and I don't define a custom action.

ciremoussadia commented 3 years ago

@elvinex auto-trading was deactivated

elvinex commented 3 years ago

Ok, thanks for letting us know. It it still a small bug in the API because normally you should get a {'_response': 'TRADING_IS_NOT_ALLOWED__ABORTED_COMMAND'} response if auto-trading is turned off. I found the reason and made a small update. Now it should give the correct error message.

ciremoussadia commented 3 years ago

Wow @elvinex awesome I'm glad I help you find that. Thanks for the update.