Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Quad, AndrewAMD, Imhotep, TipmyPip, Edgar_Herrera), 809 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ZeroMQ #477347
06/18/19 05:41
06/18/19 05:41
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Hi,

I create interface for ZeroMQ. Status is early alpha

install:
a) download libzmq.dll and put in zorro folder
b) install zorroZmq.h into include
c) zmq_client.c into Strategy

[Linked Image]

test server in python:
Code
import time
import zmq

context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:5555")

while True:
    #  Wait for next request from client
    message = socket.recv()
    print("Received request: %s" % message)

    #  Do some 'work'
    time.sleep(1)

    #  Send reply back to client
    socket.send(b"World")

Attached Files
libzmq.zip (134 downloads)
zorroZmq.h (204 downloads)
zmq_client.c (224 downloads)
Screenshot_96.png
Last edited by Grat; 06/18/19 05:44.
Re: ZeroMQ [Re: Grat] #478107
09/08/19 08:36
09/08/19 08:36
Joined: Nov 2015
Posts: 8
R
ricky_k Offline
Newbie
ricky_k  Offline
Newbie
R

Joined: Nov 2015
Posts: 8
Grat,

Nice work with the ZMQ interface.

Wondering what kinds of applications you'd use this for (or already have) besides a custom trading API?

ricky

Re: ZeroMQ [Re: Grat] #478452
10/23/19 20:04
10/23/19 20:04
Joined: Aug 2019
Posts: 22
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 22
wow, that's great. If you don't mind my asking, what is your reasoning for using ZMQ via Zorro?
I'm just getting into Zorro and Lite-C so I'm wondering if you've hit some upper limits of its capabilities.

Don't get me wrong, I think its great you can connect Jupyter Notebook with Zorro now.

If you didn't know, there is also a ZMQ EA created for MT4 that will bind MT4 and Python:
Don't get me wrong, I think its great there is an option via Zorro now.

Re: ZeroMQ [Re: Grat] #481855
11/09/20 11:16
11/09/20 11:16
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
I tried, I receive "Can't open libzmq.dll" and "Error 019: Empty function called!"

Re: ZeroMQ [Re: Grat] #487796
09/24/23 16:17
09/24/23 16:17
Joined: Feb 2022
Posts: 2
Stockholm Sweden
S
soulman3 Offline
Guest
soulman3  Offline
Guest
S

Joined: Feb 2022
Posts: 2
Stockholm Sweden
Do you mind sharing the source for the libzmq.dll? I also got the error that danatrader did... If we get this working it would be a great way to interface to python instead of the using files.

Re: ZeroMQ [Re: Grat] #487983
12/13/23 12:27
12/13/23 12:27
Joined: Sep 2017
Posts: 73
T
TipmyPip Online
Junior Member
TipmyPip  Online
Junior Member
T

Joined: Sep 2017
Posts: 73
Wow, that's great, Users can always find more complex ideas for Python exchange data with Zorro Trader, and develop very efficient code to trade dynamic strategies:

Code
#include <litec.h>
#include <trade.h>
#include <zmq.h>

// Declare ZeroMQ functions
void* zmq_ctx_new();
void* zmq_socket(void* context, int type);
int zmq_connect(void* socket, const char* endpoint);
int zmq_send(void* socket, const char* buf, int len, int flags);
int zmq_recv(void* socket, char* buf, int len, int flags);

void run() {
    // Initialize ZeroMQ context and socket
    void* context = zmq_ctx_new();
    void* requestor = zmq_socket(context, ZMQ_REQ);
    zmq_connect(requestor, "tcp://localhost:5555");

    while(algo(loop("EUR/USD", "USD/JPY"))) {
        // Prepare data to send (example: last 10 close prices)
        var data[10];
        int i;
        for(i = 0; i < 10; i++)
            data[i] = priceClose(i);

        // Send data to Python server
        zmq_send(requestor, (const char*)data, sizeof(data), 0);

        // Receive prediction from Python server
        char buffer[256];
        zmq_recv(requestor, buffer, sizeof(buffer), 0);

        // Process the received prediction for trading decisions
        // ...
    }

    // Close ZeroMQ socket and context
    // ...
}


ZorroTraderGPT - https://bit.ly/3Gbsm4S

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1