Is there a limit on calling https://api.kite.trade/portfolio/positions for calculating pnl

amandeep179018
I'm using the following code to get the position information

# URL for portfolio positions endpoint
url = f'https://api.kite.trade/portfolio/positions?api_key={api_k}&access_token={access_token}'

try:
# Make the HTTP GET request
response = requests.get(url, headers={"X-Kite-Version": "3", "Authorization": f"token {api_k}:{access_token}"})

# Check if the request was successful (status code 200)
if response.status_code == 200:
# Parse the JSON response
positions_data = response.json()

# Access specific information from the response
#net_positions = positions_data.get("data", {}).get("net", []) #P dont need the pnl contribution of holdings
day_positions = positions_data.get("data", {}).get("day", [])

day_positions contains the information about positions in "list of dictionary" form.

Since I'm using this to calculate pnl and plan on doing it every couple of seconds, I wanted to know that wether making this kind of request every second can cause some sort of error when the code runs for entire day?

Also, is there a limit for such requests example: kite.order() and kite.positions() ?

Thanks
  • rakeshr
    For end-points rate limit, go through the documentation here.
    Since I'm using this to calculate pnl and plan on doing it every couple of seconds,
    We don't recommend polling positions to calculate. This thread explains in detail.
Sign In or Register to comment.