I have started seeing error below while placing orders. Never got this before and orders always go through fine.
Kindly help fixing this, I have no clue. couple of question, request to respond those. Appreciate your help.
1. Do I call place_order function again while catching this exception in python "Except" block?
2. What is reason? Some issue in network connectivity (socket connection)? If yes, anything wrong in my code, which I may fix?
HTTPSConnectionPool(host='api.kite.trade', port=443): Max retries exceeded with url: /orders/regular (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.kite.trade', port=443): Max retries exceeded with url: /orders/200519003011420?order_id=200519003011420 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
Hi, Timeout exceptions are very common while dealing with HTTP calls. If it is a read request then you can retry but if it is a write request like order place, it is better to check orderbook before doing the retry otherwise you might end up placing multiple orders.
A timeout can happen because of issue with your ISP and AWS or AWS to our data center, or AWS to any of our servers internally or flawed internet connection in any of our nodes. It wouldn't be possible to detect exactly why and where it happened. If you encounter the timeout error while reading orderbook, positions, margins, or anything then you can add 1 or 2-sec delay and retry. The above error is not really kiteconnect issue but the python request library issue as mentioned here.
Or could be my network at home?
self.kite.order_history(order_id)[-1]["status"].find("COMPLETE") != -1):
Got below error while calling method above:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.kite.trade', port=443): Max retries exceeded with url: /orders/200519003011420?order_id=200519003011420 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
I would need to make my program failsafe or at least having good exception handling.
Appreciate any help from you on this.
Timeout exceptions are very common while dealing with HTTP calls. If it is a read request then you can retry but if it is a write request like order place, it is better to check orderbook before doing the retry otherwise you might end up placing multiple orders.
A timeout can happen because of issue with your ISP and AWS or AWS to our data center, or AWS to any of our servers internally or flawed internet connection in any of our nodes. It wouldn't be possible to detect exactly why and where it happened. If you encounter the timeout error while reading orderbook, positions, margins, or anything then you can add 1 or 2-sec delay and retry.
The above error is not really kiteconnect issue but the python request library issue as mentioned here.