Login Page - Create Account

Support Board


Date/Time: Wed, 24 Apr 2024 18:38:05 +0000



[User Discussion] - Python, DTC protocol and ZeroMQ

View Count: 2515

[2021-01-05 19:20:36]
User893396 - Posts: 38
Hello,

I am developing machine learning-based/data analysis algorithms in Python and I need my Python applications to communicate with Sierra Chart to send orders, retrieve data, etc...

This post recommends to use a async message brokers/framework like ZeroMQ to achieve this. I also see in the SC documentation that the DTC protocol is supposed to be used to send to communicate with external interfaces.

What is the difference exactly between ZeroMQ and the use of DTC protocol through a TCP/IP connection ? Are they completely different things and should both be used or only one is enough for my purpose?

Thanks and sorry for the noob question :)

By the way, if you are interested to join me on my projects and you have some experience in python, machine-learning or ACSIL feel free to PM me, I am looking for serious partners to team up with :)
Date Time Of Last Edit: 2021-01-05 19:46:45
[2021-01-14 07:49:52]
norvik_ - Posts: 106
Hi.
Forget about ZMQ. It has completely another sockets type which can be used only with the same one on the both sides, server and client. You can use only trivial TCP IP connection for working with DTC.
[2021-01-15 12:50:18]
User893396 - Posts: 38
Hey,
Thanks for your answer. It's strange though that the SC Admin who answered to the post didn't say it was unfeasible. Apparently the guy who posted this message managed to do something with ZeroMQ by implementing it between the code of custom studies in SC and external systems...
Anyway, I have enough on my plate with DTC currently :) The DTC protocol seems really well designed but despite the extensive documentation on SC, it is kind of hard to learn for not very experimented programmers... There is a lot of encoding-decoding involved even to send simple messages (see Queeq/pydtc). Have you developed a DTC client?
[2021-01-15 20:36:17]
norvik_ - Posts: 106
ZMQ was developed for extensive message exchange in high loaded distributed services, mostly for POSIX OS, and has some limitations.
There is similar library, very flexible, form Intel inc, but is commercial, with a price of secondhand spaceship :)
Really the best way for data exchange between processes on the single machine is IPC, is has near to zero overhead and is extremely fast , only two times slower then row intrinsic memset func. Very pity that we have no this with Sierra.

Yes, I had coded many times both, DTC server and client.

Happy coding!
Date Time Of Last Edit: 2021-01-16 07:45:05
[2021-01-18 06:10:40]
Flipper - Posts: 65
I have done a few implementations of using zmq to send stuff to python. Both as a send/receive type setup and just send. Once setup, which can take a bit of faffing around in C++, its a reasonable solution.

Though I would recommend trying to do most of your coding of features and trading system in the SC ACSIL. Far faster and a heap more robust.

even better if your python ML implementation has an equivalent C++ one use that and keep it all in C++.
[2021-12-08 15:50:55]
ycomp - Posts: 274
Hello Flipper, could you explain what needs to be done to set up ZeroMQ?

1) what C++ library did you use? cppzmq?

2) do I need to use libzmq.dll? does that go in the DATA folder?

3) how do you build the study to include the ZeroMQ header files? Analyze | Build won't let me add folders, just files

I need to communicate between instances of Sierra (1 Master, multiple slaves).. so I'm thinkg about Zero MQ, I've used it before in other languages and it was prettty good.
[2021-12-10 09:57:31]
User268846 - Posts: 17
Hey ycomp,

I suggest you get yourself a good c++ book. This will answer all your questions about how to do static and dynamic linking to your SC study dll.

If you want to run tensorflow models then you can link cppflow to your SC study dll without needing a tcp socket.

hope that helps
[2024-02-24 01:39:15]
Zorin - Posts: 18
how ... build the study to include the ZeroMQ header files? Analyze | Build won't let me add folders, just files


0. (VERY IMPORTANT). Make sure that you can compile a standalone CPP file which uses your desired library - making a simple EXE, for example - to verify & confirm that this library has been set up properly [and does what you actually want to :)) ]


A. Run Sierrachart Analyze/Build - from the menu. You'll get some errors.


B. Go to Siarrachart ACS_Source folder, find the VisualCCompile.Bat file there

It's the BAT file which builds your DLL
You need your include path in there, BUT: it's generated by SierraChart, and will be overwritten every time you compile your code)

C. COPY this file (VisualCCompile.Bat) under another name ("_n.bat", for example)


D. Add a SETCLOCAL at the beginning of that file [1st line]. It saves environment variables - google for the details


E. Modify the last line:

BEFORE the edit:
cl /Zc:wchar_t /GS /GL /W3 /O2 /Zc:inline -Id:\_zCsniff_c\asio_orig\include /D "NDEBUG" ... ...

AFTER the edit:
cl /Zc:wchar_t /GS /GL /W3 /O2 /Zc:inline -Id:\zLiBc\asio\include /D "NDEBUG" ... ...

Details:
https://stackoverflow.com/questions/31395929/visual-studio-compiler-how-to-specify-the-include-path-to-build-cpp


F. Run this new BAT file; compiler should see the HPP file now

G. Thank Sierra Engineering for their wonder-full, brilliant outstanding documentation how to use C++ compiler with Sierra.
Date Time Of Last Edit: 2024-02-24 01:40:13

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account