Running open-api without Reactor in python

Created at 26 Apr 2023, 00:13
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MO

MoriFX

Joined 22.09.2017

Running open-api without Reactor in python
26 Apr 2023, 00:13


Hi guys,

I'm using ctrader-open-api library in Python without any problem.

How can I use related sample codes in my application without Reactor?

I want it to works like other APIs under normal functions.

Thanks for help


@MoriFX
Replies

tangducbao101
18 Jun 2023, 06:39 ( Updated at: 18 Jun 2023, 06:44 )

RE:

No, you cannot. I try using Python socket to send and recieve messages, it does not work, when I send ProtoOAAccountAuthReq, the ProtoOAAccountAuthRes cannot parse.

Even though I read the api code try rewrite it myself, you package the message twice, 1 for ProtoOAAccountAuthReq, 1 for ProtoMessage, then send to server, and recieve the paylload, unpack twice.

The openapipy code also does not add the 4 bytes len of the payload to message. Seem like the manual guide and api code are not consistent, also for the message. I notice that the openapipy has not been released new tag since last year, while the repo proto message was updated last week.

Now, I am looking for the way to run twisted/reactor once, I do not want it run forever.


@tangducbao101

tangducbao101
18 Jun 2023, 06:45

RE:

Do you find out other way?


@tangducbao101