Git Product home page Git Product logo

darwinex / darwinexlabs Goto Github PK

View Code? Open in Web Editor NEW
339.0 73.0 296.0 59.91 MB

Datasets, tools and more from Darwinex Labs - Prop Investing Arm & Quant Team @ Darwinex

Home Page: https://www.darwinex.com

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
quantitative-finance data-science algorithmic-trading investing trading-strategies systematic-trading-strategies machine-learning artificial-intelligence neural-networks deep-learning

darwinexlabs's Introduction

Important Notice (2019-03-18 12:20 UTC):

Future updates to the DWX_ZeroMQ_Connector project will be served in its own dedicated repository here: https://github.com/darwinex/dwx-zeromq-connector

Need help? Join the Darwinex Collective Slack for Q&A, debug and more.

Darwinex Labs

Darwinex Labs is the Prop Investing Arm & Quant Team @ Darwinex (www.darwinex.com) - The Open Trader Exchange.

Who we are

Founded in 2012, Darwinex is a Broker, Asset Manager and Technology Provider, authorized and regulated by the Financial Conduct Authority (FCA) in the United Kingdom.

The Darwinex® trademark and the www.darwinex.com domain are owned by Tradeslide Trading Tech Limited, a company duly authorised and regulated by the Financial Conduct Authority (FCA) in the United Kingdom with FRN 586466.

What we do

In our quest to democratize the financial landscape, we’ve:

  1. Engineered the technology necessary to wrap trading strategies as an asset class. The DARWIN asset/wrapper lets investors invest in / trade manager talent, alpha and community sentiment in real-time, while fairly compensating for trader IP.

  2. Eliminated the startup costs and regulatory overhead associated with starting a hedge fund, enabling under-capitalized talent to compete at institutional scale under our regulatory umbrella - the foundation of our Hedge Fund as a Service business model.

  3. Successfully assetized alpha, enabling anyone with access to our community data via the DARWIN API to engineer investment strategies uncorrelated to any other asset class in existence.

We’ve hence created an ecosystem for traders and investors to pool collective talent, information and capital for private and social benefit, one that:

  1. Structurally solves the “manage peanuts, make peanuts” problem faced by under-capitalized talent.

  2. Facilitates merit-driven access to investor leverage with no downside risk.

How we do it

These outcomes have been achieved via our proprietary data wrapper - the DARWIN (Dynamic Asset & Risk-Weighted Investment) asset, that:

  1. Replicates alpha signal in real-time, our algorithmic Risk Manager transforming it to one with a fixed target Value-at-Risk (95% confidence) for investors.

  2. Enables an ‘apples to apples’ comparison of all DARWIN assets listed on our Exchange, asset risk comparable to that of a mid-cap stock.

  3. Encrypts all underlying transactions both historically and in real-time, thus protecting trader IP from compromise and dissemination, enabling fair compensation on a high-water mark basis.

  4. Collects 20% performance fees from investor profits on behalf of the alpha generators providing the signal, and pays the amount to them under our regulatory umbrella.

The DARWIN Exchange

This transaction between traders and investors is **facilitated through our proprietary marketplace - The DARWIN Exchange - an:

  1. Online “Hedge Fund as a Service” for traders to list their strategy/data as tradable DARWINs.

  2. “Liquid Alt Amazon for investors” where investors source talent via a one-stop shop solution including Prime Brokerage, Risk Management and Back-Office

Our technology is bolted on to this Exchange providing traders with regulatory cover to charge a 20% success fee on investor profits.

By doing so, we've built an ecosystem giving traders equal opportunity, where merit alone drives outcomes.

Their interests are aligned with ours, as well as those of fellow traders, pooling our collective talent, information and capital for private and social benefit.

Trading Technology

We offer traders a range of platforms, access to our liquidity via FIX and a proprietary API offering (DARWIN API) to trade DARWIN assets on our Exchange.

We strive to deliver the best, most competitive execution conditions at all times, and 100% DMA/STP access to the FX, Stock, Commodity, Index and Crypto CFD markets.

darwinexlabs's People

Contributors

darwinex avatar integracore2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

darwinexlabs's Issues

[DEPRECATED] ZeroMQ_MT4_R_Template.R freezes RStudio (fixed but lost functional version)

ZeroMQ_MT4_R_Template.R freezes RStudio because of an issue related to stdin.
I was able to fix it like so:

while(TRUE){
    content <- readLines(stdin(), n=1)
    if(content=='ex'){
        print(paste('End Command:',content))
        break
    }

Actually I had a fully functional version. But since two days, I'm not able to recreate it. It's totally strange.
In my opinion exceptions are crucial in the 'socket-land', keyword 'deadlocks'. So server and clients have to use an extensive amount of checks and exceptions. Connections, bindings and contexts have to be closed, terminated etc. decently. Otherwise any debugging is nothing less then hell.

Latest R/Win7/MT4

[RESOLVED] Implicit Conversion Warnings

DWX_ZeroMQ_Server_v2.0.1_RC8

I get a bunch of warnings...actually can't been overseen...

implicit conversion from 'number' to 'string' (multiple lines)
declaration of 'data' hides global declaration in file [...] Z85.mqh (multiple lines)
expression not boolean GlobalVariable.mqh (multiple lines)

By the way, is this server version for Python only?
I can't find any information, on how to handle the versions in regard to R.
And is it OK to use the old version because of its simple, easy to extend structur?

Thank you.

Error during DWX_ZeroMQ_Server_v2.0.1_RC8.mq4 compilation

Hi! I faced with seven errors during compile's process of DWX_ZeroMQ_Server_v2.0.1_RC8.mq4 file in MT4. I believe that these errors are related to HTML comments, but I guess those are misleading errors! Is everybody faced with this problem too?

'' - single quote needed DWX_ZeroMQ_Server_v2.0.1_RC8.mq4 158 10

'`' - unknown symbol DWX_ZeroMQ_Server_v2.0.1_RC8.mq4 158 11

Compile error and warning in mql4 "DWX_ZeroMQ_Server_v2.0.1_RC8.mq4" and "GlobalVariable.mq4"

The two file "DWX_ZeroMQ_Server_v2.0.1_RC8.mq4" and "GlobalVariable.mq4" are showing error and warnings

The file "DWX_ZeroMQ_Server_v2.0.1_RC8.mq4" is showing 1 error

'&' - parameter passed as reference, variable expected DWX_ZeroMQ_Server_v2.0.1_RC8.mq4 205 27

while the file "GlobalVariable.mq4" is showing 4 errors and 2 warining

(!) expression not boolean GlobalVariable.mqh 42 78
(!) expression not boolean GlobalVariable.mqh 64 64
(-) '::' - unexpected token GlobalVariable.mqh 200 46
(-) 'create' - function not defined GlobalVariable.mqh 200 48
(-) '::' - unexpected token GlobalVariable.mqh 211 32
(-) 'create' - function not defined GlobalVariable.mqh 211 34

Note: The other include files loaded properly

[MOVED] _TP cannot be used, other wise the order in MT4 will be closed immediately

Hi,

I came across an issue making me very confused. When using the DWX_MTX_NEW_TRADE() to place an order: {'_action': 'OPEN', '_type': 1, '_symbol': 'USDJPY', '_price': 0.0, '_SL': 0.0, '_TP': 10, '_comment': 'good luck', '_lots': 1, '_magic': 123456, '_ticket': 0}, the _msg, TRADE;OPEN;1;USDJPY;0.0;0.0;10;good luck;1;123456;0, is sent to MT4 server. Yes, the server received the messege, and placed the order, however, immediately it closed the order.

2019.07.04 00:05:00.544 DWX_ZeroMQ_Server_v2.0.1_RC8 USDJPY,M1: open #179916973 sell 1.00 USDJPY at 107.785 ok
2019.07.04 00:05:00.746 DWX_ZeroMQ_Server_v2.0.1_RC8 USDJPY,M1: close #179916973 sell 1.00 USDJPY at 107.785 at price 107.798

Then I tried when the _TP is 0, the order can be placed and kept there.

Could you please give me some help?

Thanks.

Xiangyi

Cannot call 'libzmq.dll::zmq_ctx_new', DLL is not allowed

Just a heads up, I did a fresh install of MT4 and DLL imports were preset to off.

To fix, Tools > Options > Expert Advisors > Allow DDL Imports.

I also checked Allow Automated Trading.

Thank you for all of the open source code.

ZMQ and python. _DWX_MTX_GET_ALL_OPEN_TRADES_() "None" output when 18 or more positions are opened.

Hi all

Thank you in advance for your support.

I have been operating with python code requesting y zmq market data and open positions. I can obtain open positions but when i have opened 18 or more trades, the method DWX_MTX_GET_ALL_OPEN_TRADES() gives me None as output instead of the open trades.
Have anybody had the same problem anytime. Could it be related with the waiting time of response?

Thank you in advance!

why using zeromq?

hi
i want implement machine learning/deep learning method in meta trader and find multiple approach
1- ENCOG library connect to mt with simple dll
2- ALGLIB library connect to mt with simple dll
3- mt4Rb7.dll can connect directly to R
4- matlab using read/write on single file
5- zeromq using socket to connect python / R

what is your opinion and what is best approach? and why ?

Suffix

This ind works with suffix ? I am getting this under expert tab

2022.10.02 20:08:47.470 DLabs_CurrencyIndex EURJPYi,H1: Price unavailable @ time: 2022.04.08 01:00:00symbol: EURCAD

same for all pairs

Can't compile DWX_ZeroMQ_Server_v2.0.1_RC8.mq4

When trying to compile the expert on MT4 MetaEditor it gives me some errors.
-Single quote needed ( Lines : 147, 390,506,518...)
-Unknown symbol ( Lines : 147, 390,506,518)
-Invalid prepocessor command ( Lines : 2121...)

Any idea what can be the issue?
Thanks

Issues receiving responses when executing code in PyCharm

Hello everyone,
So here is my problem, I am working on a web scraper to perform trades depending on information gathered on the internet.
However, when I try executing requests inside a python script, such as _zmq.DWX_MTX_GET_ALL_OPEN_TRADES() I get no answers from the server and cannot retrieve any information under _zmq._Market_Data_DB or _zmq._History_DB.

Moreover, if I try to open an order with zmq.DWX_MTX_NEW_TRADE(order) I get the Resource timeout.. please try again. error.
(MS VC++ is downloaded and up to date; verbose = True)

If using a python shell, however, I can pass orders that are received by MetaTrader4 and I am getting the expected output from other functions.

Therefore, this is leading me to believe that maybe there is a problem receiving responses from MetaTrader4 when using a script instead of a shell command. Any idea on how to fix this would be really appreciated.
Thank you.

Running python 3.9 on Windows 10, Using MetaTrader4 and coding in PyCharm

ZeroMQ-Server & MT4 Strategy Tester

The event listener 'OnTimer()' is not implemented in strategy tester.
Therefore triggering instead via 'OnTick()' does the trick within strategy tester.
I've got this working with the older version of the server script and a R-Client.
The newer one freezes the strategy tester, if triggered via 'OnTick()'. Any ideas here?

ZeroMQ_MT4_R_Template.R

There is a missconception in the remote.send function. Request and answer will not work on the same socket.

Error 129 : Invalid Price Error

I am getting an Error with code 129 (Invalid Price). My python code is :

from DWX_ZeroMQ_Connector_v2_0_1_RC8 import DWX_ZeroMQ_Connector

_zmq = DWX_ZeroMQ_Connector()
_zmq._DWX_MTX_NEW_TRADE_()

I tried several days by changing EA code. But I could not resolve this.

BID/ASK prices are NOT being streamed into _zmq._Market_Data_DB

Hi. I'm able to run other commands such as sending new orders but each time i subscribe to market data and then trying to get data i get an empty dict {}:

>>> _zmq._DWX_MTX_SUBSCRIBE_MARKETDATA_('EURUSD')
[KERNEL] Subscribed to EURUSD BID/ASK updates. See self._Market_Data_DB.
>>> _zmq._Market_Data_DB

[Output]
>>> {}

I use python 3.7
Please help!

Connectivity between Python and MT4 issue!

Hello,

I want to thank you for your fantastic work. I've newly downloaded and installed ZMQ and all it's dependencies and done all the steps you have explained in your videos (regarding libraries, include folder and the settings in MT4). I have no problem with adding the expert to the MT4 charts and everything seems to work perfectly. When I open the Python file (DWX_ZeroMQ_Connector....py) after initializing the code I try to subscribe to the pair EURUSD as an example. Whenever I try to call the subscribed data using _zmq._Market_Data_DB.keys() (as you mentioned in your videos) I don't receive any real time data regarding the subsribed pair and I receive only the following response: dict_keys([]).
Generally it seems that I don't have any connection stablished between Python and the MT4 but I don't know, what can be the possible problem. Can you please help me?

regards,

Can't compile DWX_ZeroMQ_Server_v2.0.1_RC8.mq4

Hi,

When I try to compile it, it gives me this issue:

"'&' - parameter passed as reference, variable expected DWX_ZeroMQ_Server_v2.0.1_RC8.mq4 206 27"

The error is on line 206, on the instruction "InterpretZmqMessage(&pushSocket, components);"

Thanks in advance

NameError: name '_zmq' is not defined

I Think I Installed everything as it should be and I get the Error:

NameError: name '_zmq' is not defined

When I run code like:
_zmq.DWX_MTX_GET_ALL_OPEN_TRADES()

In the Spyder Kernel.

How can I fix that?

[BENCHED] [paduel/darwinex_ticks] ModuleNotFoundError Issue

I have tested your script in command line but I received this error. I have installed all modules python 2.7, pandas, and Darwin tick. Please, could you help me?

python -m darwinex_ticks EURGBP EURGBP USDJPY -u username -w passsword -n tickdata.darwinex.com -s "2018-10-08 10" -e "2018-10-08 12" -g


Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/darwinex_ticks/__main__.py", line 7, in <module>
    except ModuleNotFoundError:

Failed to import EXAMPLES.TEMPLATE.STRATEGIES.BASE.DWX_ZMQ_Strategy

D:\python\Python38\python.exe D:/python/DarwinexLabs/tools/dwx_zeromq_connector/v2.0.1/EXAMPLES/TEMPLATE/STRATEGIES/coin_flip_traders_v1.0.py
Traceback (most recent call last):
File "D:/python/DarwinexLabs/tools/dwx_zeromq_connector/v2.0.1/EXAMPLES/TEMPLATE/STRATEGIES/coin_flip_traders_v1.0.py", line 42, in
os.chdir(_path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'tools\dwx-zeromq-connector\v2.0.1\python'

Process finished with exit code 1

ValueError: DataFrame constructor not properly called!

The python runs (sort of) but I get this error :
ValueError: DataFrame constructor not properly called!

Exception in thread AUDNZD_Trader: Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner self.run() File "C:\ProgramData\Anaconda3\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "Z:/Forex/testpath/coinflip.py", line 185, in _trader_ 10) File "Z:\Forex\testpath\lib\DWX_ZMQ_Reporting.py", line 55, in _get_open_trades_ index=_response['_trades'].keys()) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py", line 422, in __init__ raise ValueError('DataFrame constructor not properly called!') ValueError: DataFrame constructor not properly called!

Full pastebin here https://pastebin.com/5504A05f

This is an example of the response data (using print statements:

_response= {'_action': 'OPEN_TRADES', '_trades': {96569338: {'_magic': 123456, '_symbol': 'GBPJPY', '_lots': 0.01, '_type': 1, '_open_price': 145.388, '_open_time': '2019.04.08 15:02:18', '_SL': 145.488, '_TP': 145.288, '_pnl': -0.46, '_comment': 'GBPJPY_Trader'}, 96569143: {'_magic': 123456, '_symbol': 'AUDNZD', '_lots': 0.01, '_type': 1, '_open_price': 1.05499, '_open_time': '2019.04.08 14:57:36', '_SL': 1.05599, '_TP': 1.05399, '_pnl': -0.14, '_comment': 'AUDNZD_Trader'}, 96569141: {'_magic': 123456, '_symbol': 'AUDUSD', '_lots': 0.01, '_type': 0, '_open_price': 0.71066, '_open_time': '2019.04.08 14:57:34', '_SL': 0.70966, '_TP': 0.71166, '_pnl': -0.03, '_comment': 'AUDUSD_Trader'}, 96569140: {'_magic': 123456, '_symbol': 'USDJPY', '_lots': 0.01, '_type': 1, '_open_price': 111.437, '_open_time': '2019.04.08 14:57:33', '_SL': 111.537, '_TP': 111.337, '_pnl': -0.26, '_comment': 'USDJPY_Trader'}, 96569139: {'_magic': 123456, '_symbol': 'GBPUSD', '_lots': 0.01, '_type': 1, '_open_price': 1.30538, '_open_time': '2019.04.08 14:57:32', '_SL': 1.30638, '_TP': 1.30438, '_pnl': 0.58, '_comment': 'GBPUSD_Trader'}, 96569130: {'_magic': 123456, '_symbol': 'EURUSD', '_lots': 0.01, '_type': 0, '_open_price': 1.12479, '_open_time': '2019.04.08 14:57:17', '_SL': 1.12379, '_TP': 1.12579, '_pnl': -0.28, '_comment': 'EURUSD_Trader'}, 96569107: {'_magic': 123456, '_symbol': 'EURCAD', '_lots': 0.01, '_type': 0, '_open_price': 1.50396, '_open_time': '2019.04.08 14:56:18', '_SL': 1.50296, '_TP': 1.50496, '_pnl': 0.1, '_comment': 'EURCAD_Trader'}, 96569106: {'_magic': 123456, '_symbol': 'NZDCHF', '_lots': 0.01, '_type': 0, '_open_price': 0.67343, '_open_time': '2019.04.08 14:56:17', '_SL': 0.67243, '_TP': 0.67443, '_pnl': 0.02, '_comment': 'NZDCHF_Trader'}}}

_response['_trades'].values()= dict_values([{'_magic': 123456, '_symbol': 'GBPJPY', '_lots': 0.01, '_type': 1, '_open_price': 145.388, '_open_time': '2019.04.08 15:02:18', '_SL': 145.488, '_TP': 145.288, '_pnl': -0.46, '_comment': 'GBPJPY_Trader'}, {'_magic': 123456, '_symbol': 'AUDNZD', '_lots': 0.01, '_type': 1, '_open_price': 1.05499, '_open_time': '2019.04.08 14:57:36', '_SL': 1.05599, '_TP': 1.05399, '_pnl': -0.14, '_comment': 'AUDNZD_Trader'}, {'_magic': 123456, '_symbol': 'AUDUSD', '_lots': 0.01, '_type': 0, '_open_price': 0.71066, '_open_time': '2019.04.08 14:57:34', '_SL': 0.70966, '_TP': 0.71166, '_pnl': -0.03, '_comment': 'AUDUSD_Trader'}, {'_magic': 123456, '_symbol': 'USDJPY', '_lots': 0.01, '_type': 1, '_open_price': 111.437, '_open_time': '2019.04.08 14:57:33', '_SL': 111.537, '_TP': 111.337, '_pnl': -0.26, '_comment': 'USDJPY_Trader'}, {'_magic': 123456, '_symbol': 'GBPUSD', '_lots': 0.01, '_type': 1, '_open_price': 1.30538, '_open_time': '2019.04.08 14:57:32', '_SL': 1.30638, '_TP': 1.30438, '_pnl': 0.58, '_comment': 'GBPUSD_Trader'}, {'_magic': 123456, '_symbol': 'EURUSD', '_lots': 0.01, '_type': 0, '_open_price': 1.12479, '_open_time': '2019.04.08 14:57:17', '_SL': 1.12379, '_TP': 1.12579, '_pnl': -0.28, '_comment': 'EURUSD_Trader'}, {'_magic': 123456, '_symbol': 'EURCAD', '_lots': 0.01, '_type': 0, '_open_price': 1.50396, '_open_time': '2019.04.08 14:56:18', '_SL': 1.50296, '_TP': 1.50496, '_pnl': 0.1, '_comment': 'EURCAD_Trader'}, {'_magic': 123456, '_symbol': 'NZDCHF', '_lots': 0.01, '_type': 0, '_open_price': 0.67343, '_open_time': '2019.04.08 14:56:17', '_SL': 0.67243, '_TP': 0.67443, '_pnl': 0.02, '_comment': 'NZDCHF_Trader'}])

_response['_trades'].keys()= dict_keys([96569338, 96569143, 96569141, 96569140, 96569139, 96569130, 96569107, 96569106])


DWX_ZMQ_Reporting():
`# -*- coding: utf-8 -*-
"""
    DWX_ZMQ_Reporting.py
    --
    @author: Darwinex Labs (www.darwinex.com)
    
    Copyright (c) 2019 onwards, Darwinex. All rights reserved.
    
    Licensed under the BSD 3-Clause License, you may not use this file except 
    in compliance with the License. 
    
    You may obtain a copy of the License at:    
    https://opensource.org/licenses/BSD-3-Clause
"""

from pandas import DataFrame, to_datetime
from time import sleep

class DWX_ZMQ_Reporting():
    
    def __init__(self, _zmq):
        self._zmq = _zmq
        
    ##########################################################################
    
    def _get_open_trades_(self, _trader='Trader_SYMBOL', 
                          _delay=0.1, _wbreak=10):
        
        # Reset data output
        self._zmq._set_response_(None)
        
        # Get open trades from MetaTrader
        self._zmq._DWX_MTX_GET_ALL_OPEN_TRADES_()

        # While loop start time reference            
        _ws = to_datetime('now')
        
        # While data not received, sleep until timeout
        while self._zmq._valid_response_('zmq') == False:
            
            sleep(_delay)
            
            if (to_datetime('now') - _ws).total_seconds() > (_delay * _wbreak):
                break
        
        # If data received, return DataFrame
        if self._zmq._valid_response_('zmq'):
            
            _response = self._zmq._get_response_()
            
            if ('_trades' in _response.keys()
                and len(_response['_trades']) > 0):
                
                _df = DataFrame(data=_response['_trades'].values(),
                                index=_response['_trades'].keys())
                return _df[_df['_comment'] == _trader]
            
        # Default
        return DataFrame()
    
    ##########################################################################
    

Sending and receiving basic strings.

Hi, I'm trying to use the HelloWorldServer.mq4 example from dingmaotu's GitHub with your sample Python code to test whether information is sent through the push pull socket. I think I've set up the various functions and libraries for MQL4 ZeroMQ properly. However, I get a TypeError because of a unicode string and get told to use "send_string" instead of "send". However, this doesn't send and receive "Hello World" either:

import zmq

Sample Commands for ZeroMQ MT4 EA

eurusd_buy_order = "TRADE|OPEN|0|EURUSD|0|50|50|Python-to-MT4"
eurusd_sell_order = "TRADE|OPEN|1|EURUSD|0|50|50|Python-to-MT4"
eurusd_closebuy_order = "TRADE|CLOSE|0|EURUSD|0|50|50|Python-to-MT4"
get_rates = "RATES|GBPUSD"

Sample Function for Client

def zeromq_mt4_ea_client():

# Create ZMQ Context
context = zmq.Context()

# Create REQ Socket
reqSocket = context.socket(zmq.REQ)
reqSocket.connect("tcp://localhost:5555")

# Create PULL Socket
pullSocket = context.socket(zmq.PULL)
pullSocket.connect("tcp://localhost:5556")

# Send RATES command to ZeroMQ MT4 EA
#remote_send(reqSocket, get_rates)
x= "Hello"
remote_send(reqSocket, x)   
# Send BUY EURUSD command to ZeroMQ MT4 EA
# remote_send(reqSocket, eurusd_buy_order)

# Send CLOSE EURUSD command to ZeroMQ MT4 EA. You'll need to append the 
# trade's ORDER ID to the end, as below for example:
# remote_send(reqSocket, eurusd_closebuy_order + "|" + "12345678")

# PULL from pullSocket
remote_pull(pullSocket)

Function to send commands to ZeroMQ MT4 EA

def remote_send(socket, data):

try:
    socket.send_string(data)
    msg = socket.recv_string(flags=0,encoding='utf-8')
    print(msg)
    
except zmq.Again as e:
    print("Waiting for PUSH from MetaTrader 4..")

Function to retrieve data from ZeroMQ MT4 EA

def remote_pull(socket):

try:
    msg = socket.recv_string(flags=zmq.NOBLOCK)
    print(msg)
    
except zmq.Again as e:
    print("Waiting for PUSH from MetaTrader 4..")

Run Tests

zeromq_mt4_ea_client()

TypeError: unicode not allowed, use send_string

good day

first off thank you for your contribution to this matter, unfortunately I am getting an error

File "zmq/backend/cython/socket.pyx", line 676, in zmq.backend.cython.socket.Socket.send

TypeError: unicode not allowed, use send_string

could you please help me

[Revision Ideas] DWX_ZeroMQ_Server_v2.0.1_RC8.mq4

Hi,

I created an 8GB RAM VM for this, which has the latest Windows 10 Enterprise , live MT4 and Python 3.7 32 bit (I suspect with 0mq there is no difference between python 32 bit and 64). The VM itself has given me no weirdness so far. With this new DWX I am getting 99% of the time problems, though they do not seem 100% reproducible. I got no messages at all in "Experts" once or twice, or I got just the Binding message, or I got pricings for a few ticks and then it was gone(not stopped or crashed, it just wasn't printing any more prices). Restarting the computer seems to take a long time to shut MT4 down, and on my current run I only got the Binding messages and decided to turn on the "Live trading" property of the EA, which seems to have crashed my MT4 (Not responding for 10 minutes or more).

Somewhere in the middle of all this the EA triggered Windows Firewall (do you want to allow...) to which I replied yes, of course. Sometimes turning the firewall off helps with such issues, but I also suspect the server could exit/crash more gracefully. I will probably try on Windows 7 later. From other comments it is clear previous versions run OK for some people, no comments yet on the new one.

Finally it is Friday and the ticks are few but not that few!

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.