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
346 stars 229 forks source link

OPEN_TRADES is not a valid JSON object #58

Closed gadieichhorn closed 3 years ago

gadieichhorn commented 4 years ago

The OPEN_TRADES JSON is not valid as it uses ' instead of "

I suggested a pull request for one fix that was missing in the mapping of the ticket ID from long to string. The work on making it a valid JSON is more effort.

In Java I basically replaced ' with " and made it valid JSON.

{'_action': 'OPEN_TRADES', '_trades': {'105016345': {'_magic': -1483520651, '_symbol': 'EURUSD', '_lots': 0.01000000, '_type': 1, '_open_price': 1.10155000, '_open_time': '2019.11.26 14:19:22', '_SL': 1.10175000, '_TP': 1.10135000, '_pnl': -0.02000000, '_comment': 'null'}, '105016344': {'_magic': -1483218303, '_symbol': 'GBPUSD', '_lots': 0.01000000, '_type': 1, '_open_price': 1.28630000, '_open_time': '2019.11.26 14:19:20', '_SL': 1.28650000, '_TP': 1.28610000, '_pnl': 0.00000000, '_comment': 'null'}, '105016326': {'_magic': -1483520651, '_symbol': 'EURUSD', '_lots': 0.01000000, '_type': 1, '_open_price': 1.10155000, '_open_time': '2019.11.26 14:18:30', '_SL': 1.10175000, '_TP': 1.10135000, '_pnl': -0.02000000, '_comment': 'null'}, '105016301': {'_magic': -1483520651, '_symbol': 'EURUSD', '_lots': 0.01000000, '_type': 1, '_open_price': 1.10156000, '_open_time': '2019.11.26 14:17:18', '_SL': 1.10176000, '_TP': 1.10136000, '_pnl': -0.01000000, '_comment': 'null'}, '105016147': {'_magic': -1483520651, '_symbol': 'EURUSD', '_lots': 0.01000000, '_type': 1, '_open_price': 1.10163000, '_open_time': '2019.11.26 14:09:17', '_SL': 1.10183000, '_TP': 1.10143000, '_pnl': 0.04000000, '_comment': 'null'}, '105015551': {'_magic': -1490723155, '_symbol': 'EURUSD', '_lots': 0.01000000, '_type': 0, '_open_price': 1.10172000, '_open_time': '2019.11.26 13:49:03', '_SL': 1.10152000, '_TP': 1.10192000, '_pnl': -0.14000000, '_comment': 'null'}}}
elvinex commented 3 years ago

Thanks for raising this issue. It is true that it is not valid JSON. But it more intuitive to have the ticket ID as the same type (integer) as in mql4. Therefore, we decided to keep the current solution.