Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
handle_data timeout issue

I have algorithm that does heavy computations in handle_data and this results in timeout exception sometimes. Is there a way in API to catch the timeout exception and exit gracefully?

1 response

Hi Pavy,

I don't have time now to work up an example, but you can use a "timer" in your code, which would be checked periodically. If a time limit is exceeded (e.g. dt > 40 seconds), then exit handle_data. I don't think there is a way to avoid the hard crash if the max. 50 second limit is exceeded. Would someone from Quantopian confirm?

There really should be a way for users to handle the error, in my opinion. Perhaps a soft error at 45 seconds and a fatal error at 50 seconds?

Grant