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

[Potential Bug] Subscribing to Multiple Symbols #64

Open octopyth opened 4 years ago

octopyth commented 4 years ago

Hi I am attempting to subscribe to more than one symbols at the same time. First I try: _zmq._DWX_MTX_SUBSCRIBE_MARKETDATA_('EURUSD') image Then I attempt to subscribe to ADD a different symbol by: _zmq._DWX_MTX_SUBSCRIBE_MARKETDATA_('GBPUSD') Nothing happens. After I unsubscribe from EURUSD then I see the GBPUSD results: _zmq._DWX_MTX_UNSUBSCRIBE_MARKETDATA_('EURUSD') image

So when subscribed to multiple symbols, only one symbol is displayed on the screen, while the expected behaviour is to see all the subscribed symbols.

Also what would be the best way to transfer these subscribed multiple symbols to SQL database for example?

octopyth commented 4 years ago

It looks like it is impossible to subscribe to multiple symbols at the same time, as subscribing is based on zmq.socket.setsockopt(zmq.SUBSCRIBE, topicfilter). If one wants to subscribe to two symbols with _zmq._DWX_MTX_SUBSCRIBEMARKETDATA(SYMBOL_2), what happens is the TOPIC FILTER is updated with a new filter and there is only one SYMBOL being captured in _zmq._Market_Data_DB This can be validated with _zmq._Market_Data_DB[SYMBOL_1].len() and _zmq._Market_Data_DB[SYMBOL_2].len() After updating the filter, the LEN of captured entries for SYMBOL_1 remains the fixed. It contradicts to what is described here: https://youtu.be/3nM0c2kG_Sw?t=2034

octopyth commented 4 years ago

reopening issue

integracore2 commented 4 years ago

Thank you for raising this @octopyth 👍

We'll try to reproduce this internally and patch the code as necessary.

Many thanks for your due diligence!

ajax79 commented 3 years ago

same issue. only one symbol in same time. the first subscribed symbol can be freeze.