Twisted-timeout in OpenApiPy

Created at 30 Mar 2022, 11:25
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

money-maker-money-taker

Joined 25.03.2022

Twisted-timeout in OpenApiPy
30 Mar 2022, 11:25


Hello in the Python version of the Open API I get always the following error of twisted. This creates other errors like not getting back a response of response of an order or blocking the thread.

My question is what did this error mean and how can I prefent this. 

 

Message Error:  [Failure instance: Traceback: <class 'twisted.internet.defer.TimeoutError'>: (5, 'Deferred')
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:586:timeItOut
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:742:cancel
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:701:errback
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:764:_startRunCallbacks
--- <exception caught here> ---
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:858:_runCallbacks
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:595:convertCancelled
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:252:_cancelledToTimedOutError
]
 


@money-maker-money-taker
Replies

amusleh
31 Mar 2022, 09:54

Hi,

This error occurs when your deferred is timed out, if the client doesn't receive a response for your request in 5 seconds (you can change it by passing responseTimeoutInSeconds to Send method) the returned deferred will be timed out.

The cause of this issue can be invalid request, and you have to check for incoming error message after your request by listening to error message types, there are several error messages that server can return, please check the Open API documentation.


@amusleh

sacha.berthelon
28 Dec 2024, 09:43 ( Updated at: 30 Dec 2024, 07:15 )

RE: Twisted-timeout in OpenApiPy

amusleh said: 

Hi,

This error occurs when your deferred is timed out, if the client doesn't receive a response for your request in 5 seconds (you can change it by passing responseTimeoutInSeconds to Send method) the returned deferred will be timed out.

The cause of this issue can be invalid request, and you have to check for incoming error message after your request by listening to error message types, there are several error messages that server can return, please check the Open API documentation.

I do have the exact same issue, 

I try to get info about the account positions and the account infos each second, and it work perfectly but after let's say 1 minute or so I begin to experience the same issue, 

Having an error for almost every call making it impossible to track effectively my differents accounts. 

Do you know why ? Is this because of the  the limits ? But I saw that I had the right to do 50 non historical requests and I am only performing 4 of them each seconds. Or maybe this is because I am in sandbox ? 

full error : 

Message Error [2] :  [Failure instance: Traceback: <class 'twisted.internet.defer.TimeoutError'>: (5, 'Deferred')
C:\Users\sacha\AppData\Local\Programs\Python\Python311\Lib\site-packages\twisted\internet\defer.py:1088:_runCallbacks
C:\Users\sacha\AppData\Local\Programs\Python\Python311\Lib\site-packages\twisted\internet\defer.py:820:convertCancelled
C:\Users\sacha\AppData\Local\Programs\Python\Python311\Lib\site-packages\twisted\internet\defer.py:297:_cancelledToTimedOutError
]

 

I can put my full code if asked but here is the main part**

 

I hope someone already did encounter something like that and know why is this happenning, 

Best regards,

Sacha


@sacha.berthelon