# Definedge

OpenAlgo provides seamless integration with Definedge Securities, enabling you to connect your trading strategies with Definedge’s brokerage services. Follow this guide to set up your Definedge broker account with OpenAlgo.

**Prerequisites**

Before proceeding, ensure you have the following:

* An active Definedge Securities trading account.
* Access to [Definedge Securities Portal](https://myaccount.definedgesecurities.com/).
* OpenAlgo installed and configured on your local machine.

### Steps to Create the Definedge API Secret Key

#### 1. Login to Definedge Securities Portal

* Navigate to <https://myaccount.definedgesecurities.com/>.
* Enter your **UCC (Account ID)** and **password**.

<figure><img src="/files/UKysjXs1iL859HP0pCBs" alt=""><figcaption></figcaption></figure>

* Complete with OTP authentication send to your registered mobile and email ID.

<figure><img src="/files/j65xgmHPqVXCp3TLx3jG" alt=""><figcaption></figcaption></figure>

* This will take you to your dashboard.

#### 2. Access API Key Section

* From the dashboard, go to the **Account** section.
* Click on **Show my API Secret**.
* Here you will find your **API Token** and **API Secret**.

<figure><img src="/files/YAKqQYHkwYkMI1KxZppv" alt=""><figcaption></figcaption></figure>

**Configuring the .env File**&#x20;

The Definedge API Token is used as the API key and API Secrets as API Secret itself. Below is a sample configuration for the .env file     &#x20;

\#Definedge Broker Configuration

```
# Definedge Broker Configuration
BROKER_API_KEY = 'your_API_Token_here'
BROKER_API_SECRET = 'your_API_Secret_here' 
REDIRECT_URL = 'http://127.0.0.1:5000/definedge/callback' 
```

**Important Notes**

* Ensure that your **API Secret Key and API Token** are stored securely and is not shared publicly.
* The **REDIRECT\_URL** should match the one registered with your API application.

Follow these steps to integrate Definedge with OpenAlgo successfully. If you encounter any issues, refer to the Definedge API documentation for further assistance.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openalgo.in/connect-brokers/brokers/definedge.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
