Timeout for all API requests

I'm currently using the KiteConnect Python client library to interact with the Kite API, and I'm interested in using the timeout parameter in some of the API function calls to specify the maximum amount of time to wait for a response from the server.

I've noticed that the orders() function accepts the timeout parameter, but I would like to know if this parameter is also accepted in other functions such as positions() and historical_data(). If yes, could you please provide an example of how to use the timeout parameter in each of these functions?

Also, I'm not sure whether the timeout parameter should be specified in seconds (e.g. 5) or milliseconds (e.g. 5000). Could you please clarify which unit of time the timeout parameter should be specified in?
  • sujith
    sujith edited March 2023
    You may refer to the documentation to know more about the initialization of kite connect object and usage of timeout parameter.
  • hyuga
    Thank you for your previous response regarding the timeout parameter in the KiteConnect Python client library.

    However, I have noticed that the documentation does not provide a detailed description of the usage of the timeout parameter for some of the frequent API calls such as orders(), positions(), and others that are commonly used in trading.

    Could you please provide more information or examples on how to use the timeout parameter for these frequent API calls, or update the documentation to include this information?
  • rakeshr
    Timeout settings in an HTTP client specify, not for each API call individually, but it applies to all API calls made by that client. You can assign a timeout value at the initialization of the Kite Connect client.
    kite = KiteConnect(api_key="your_api_key", access_token="your_access_token", timeout=30)
    Go through the official repo here.
Sign In or Register to comment.