Kotak Securities

Kotak Securities is a prominent Indian stock broker offering services on major Indian stock exchanges, including NSE, BSE, and MCX. Known for its comprehensive financial services and advanced trading solutions, Kotak Securities provides a robust platform for traders and investors. By leveraging Kotak's Trading APIs, developers and algo traders can seamlessly integrate their trading strategies with the OpenAlgo platform.

For developers and algo traders looking to use the Kotak API, the integration process generally involves the following steps:

Step-by-Step Integration

Step 1: Prepare Your Trading Credentials

Ensure you have your Kotak Securities Trading User ID and Password ready.

Step 2: Register for API Access

  1. Enter your API credentials.

  2. Upon successful login, you will be presented with terms and conditions. Accept them to complete the registration.

  3. You will receive a new set of Username and Password via email, specifically for the API web portal.

Step 3: Access the API Web Portal

  1. Using the credentials received via email, log in to the API web portal through the link provided in the email.

Step 4: Navigate to Applications

  1. Once logged in to the Kotak Developer Portal (API Manager), click on the "Applications" tab located on the top navigation bar.

Step 5: Select the Default Application

  1. Click on the "Default Application" that is already created. Do not create a new application.

Step 6: Generate OAuth2 Token

  1. In the left-hand sidebar, click on "OAuth2 Token" under "Production Keys".

  2. Locate the fields for Consumer Key and Access Token. To make the Access Token perpetual, set the validity period to -2.

Step 7: Generate Access Token

  1. Click the "GENERATE ACCESS TOKEN" button.

  2. Enter -2 as the validity period and click "Generate".

  3. The updated access token will be displayed. This token will also be reflected on the webpage.

Setting Expiry for Access Token

  1. Set the expiry by inserting a long value, e.g., 36000000000000, in the key configuration fields and press update.

Retrieve API Credentials:

  • Copy the generated access token, which will serve as your API Secret.

  • Copy the Consumer key , which will be your API Key.

Configuration:

Set up your environment variables in a .env file for Kotak's API:

BROKER_API_KEY = 'your_kotak_consumer_key'
BROKER_API_SECRET = 'your_kotak_access_token'
REDIRECT_URL = 'http://127.0.0.1:5000/kotak/callback'

Integrating with the Kotak API opens up new possibilities for implementing automated and algorithmic trading strategies. It provides developers and traders with a robust platform to access market opportunities efficiently and effectively. To fully leverage the capabilities of the Kotak API, it is essential to follow best practices for API integration. This includes careful management of API rate limits, secure handling of API keys, and thorough error handling and logging. These practices help ensure a dependable and optimal trading experience using Kotak's advanced technological infrastructure.

Last updated