I have developed an automated trading system using kitepyconnect and I am facing too many problems with the API.
Errors that I recieved. 1. While requesting for open orders/position/modifying orders. sometimes when I make any one of above requests my code ends up giving an error saying 'Gateway timed out'. Is this related to internet connection? There's no way that my code can loose internet connection because I run my codes in a linux server which has 24/7 internet connection.
2. When open orders request is made Sometimes When my code requests for open orders it ends up giving an error saying 'Invalid response format'. When and why will this error come? and how can I overcome this?
Errors which I didn't receive.
Since the product we are developing is an automated trading system we need to make sure that every order we place is accepted by zerodha. Sometimes zerodha may reject the order we place because of reasons like less margin,Invalid quantity/price etc.. We need to inform such things to our clients in an automated way like sending automatic e-mails or sms.
1. We tried to place orders with invalid quantity/price/inavlid order type our codes ended up giving errors like 'invalid quantity'/Inavlid order type.
2. We placed a higher quantity order when we had a very less margin. Order got rejected and API didn't send any errors or exception. It should have sent an exception. Later when we logged into kite and checked the order status was rejected with a rejection reason saying ' kiteconnect.exceptions.DataException: Invalid response format'. Why didn't my code recieve the same rejection reason? Do I have to look somewhere else for such rejection messages?
3. At 09:42IST today I placed a buy order on instrument NIFTY16JUN8200CE. The order got rejected and the API didn't send any exception or error message. Later when I logged into kite I got to know the order is been rejected and the rejection reason was like 'error user/user_target not logged in'. I really don't know why did it happen. I thought it may be is because of access/request token. After sometime I ran the same piece of code with the same access token I used earlier and zerodha accepted my order. Why when will such error come? How can I overcome it?