Python API OnTrade and OnTransaction equivalent function

 
The MQL5 architecture application is event-based, i.e., the EA is a client waiting for server signal of a tick, time, trade or transaction event . So, the code is organized to wake and respond well defined events in a self coordinated chuncks of code. 
Well, how can I get the equivalent behavior on Python environment with metatrader5 API? For example, is there OnTrade() or OnTransaction() equivalent interrupt function or I need to develop a polling based calls to server asking the states of an order, position, etc.? 
My initial tests are not efficient enough (and robust enough!) to secure the states of transactions.
Could someone comment about that? 
 
Carlos Camargo:
The archThe MQL5 architecture application is event-based, i.e., the EA is a client waiting for server signal of a tick, time, trade or transaction event . So, the code is organized to wake and respond well defined events in a self coordinated chuncks of code. 
Well, how can I get the equivalent behavior on Python environment with metatrader5 API? For example, is there OnTrade() or OnTransaction() equivalent interrupt function or I need to develop a polling based calls to server asking the states of an order, position, etc.? 
My initial tests are not efficient enough (and robust enough!) to secure the states of transactions.
Could someone comment about that? 

No, the Python API is not event driven because the MetaTrader 5 terminal is acting as a "service" (via named pipe) and the Python code is polling it for information.

If you want event driven and compiled code as fast as C/C++, then use MQL5.

 
Fernando Carreiro #:

No, the Python API is not event driven because the MetaTrader 5 terminal is acting as a "service" (via named pipe) and the Python code is polling it for information.

If you want event driven and compiled code as fast as C/C++, then use MQL5.

Dear @Fernando Carreiro , thank you for your comment.

I am familiar with the properties of MQL5, but the Python environment is tempting because it offers a wide range of tools and packages for data analysis, machine learning, and statistics. This is significantly more comprehensive than what is available in MQL5. Additionally, Python offers event-driven resources, such as the asyncio module and support for threads. I hope that MetaQuotes will consider these advantages when developing the next generation of Python integration.

 
Carlos Camargo #: Dear @Fernando Carreiro , thank you for your comment.I am familiar with the properties of MQL5, but the Python environment is tempting because it offers a wide range of tools and packages for data analysis, machine learning, and statistics. This is significantly more comprehensive than what is available in MQL5. Additionally, Python offers event-driven resources, such as the asyncio module and support for threads. I hope that MetaQuotes will consider these advantages when developing the next generation of Python integration.

I doubt that they will further develop the Python API, given that they have been focusing on adding more capabilities to MQL such as Matrix and Vector Methods and ONNX models.

There has been no further development of the Python API for many years now.

There will always be MQL in the future, but I am not so certain about the Python API.