When i fetch only ltp its give me error Too many Request but in documentation per second 25 requests limit

Request failed with status code 429
{“status”:“error”,“errors”:[{“errorCode”:“UDAPI10005”,“message”:“Too Many Request Sent”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI10005”,“property_path”:null,“invalid_value”:null}]}

The problem arises because you have exceeded the number of requests as outlined in the rate limiting section of the Upstox API documentation, which can be found at Rate Limits | Upstox Developer API. I suggest reviewing your code to ensure you’re not surpassing this limit.

If the issue persists even after this, please provide your client ID for a more detailed investigation.

Is their need time.Sleep(1) in my code

Avoid continuously hitting an API in a loop. It’s better to make requests only when you need the data. If you are dealing with market data, consider using a WebSocket, as suggested in the Upstox API documentation here: Upstox WebSocket API.

You are correct we should not continuously hit API in loop but there is no Websocket available for open positions. If you provide websocket to monitor PNL / price change in open position, we do not need to hit API in loop. This is most awaited feature that other brokers are providing.

Updating the websocket for PNL changes would require excessive and unnecessary effort. It’s advised to subscribe to the LTP of the symbol and then utilize the position API to obtain the average buy and sell prices. This method allows for the real-time calculation of PNL.

Let us know if this makes sense to you; we’re ready to assist with the formula if required. For those aiming to develop a comprehensive product, such adjustments are essential. Our goal is to supply all the necessary tools for users to create their applications or products.

Additionally, we’ve recently introduced updates for positions through the portfolio websocket. This feature provides updates on transactions related to your position (excluding PNL).

Yes this makes sense. Have implemented same. Can you provide API where we can create multiple orders at the same time. Like if we want to cancel Stop Loss order and create Limit order we need to call API multiple time. Or if we want to place order for multiple instruments then also we need to place multiple order.

@Jagdish_j_ptl The API for handling multiple orders is currently in our backlog. Although we don’t have an estimated arrival time for its release, we will inform you once its development commences and it becomes available.