loader2
Login OPEN ICICI 3-in-1 Account
  • Text Size
  • Text to Speech
  • Color Contrast
  • Pause Animations

Where to manually find list of stock codes for Breeze API

27 May 2022|
2 min read |
by ICICI Securities Team
Article Image

To start exploring the multiple features of Breeze API, one would need to enter certain parameters for a successful output. For example, in trying to download minute by minute historical data for Ashok Leyland’s stock price on NSE exchange for the 1st week of May, the code should like something like below:

# importing required libraries

from breeze_connect import BreezeConnect

import pandas as pd

 

# generating session through

isec = BreezeConnect(api_key="K%834G9%)2M9z75111V2dP")

isec.generate_session(api_secret="a69+y9097T9r279342xC513O82#ucU1a0",session_token="1117193")

 

# get historical data for Ashok Leyland

data = isec.get_historical_data(interval="1minute",

                            from_date= "2022-05-03T07:00:00.000Z",

                            to_date= "2022-05-06T18:00:00.000Z",

                            stock_code="ASHLEY",

                            exchange_code="NSE",

                            product_type="cash")

 

Please note that the api_key and api_secret are shown for demo purpose only. Users would need to enter their own api key and secret key, as can be seen in the view app section of Breeze Hompage. Refer to our articles on “How to register an App” and “How to generate the session key” to know about the starting process. The links for those are mentioned below:

  1. https://www.icicidirect.com/futures-and-options/api/breeze/article/introduction-to-trading-apis-and-how-to-start-using-breezeapi
  2. https://www.icicidirect.com/futures-and-options/api/breeze/article/what-is-a-session-key-and-how-to-generate-it-for-using-breezeapi

 

What inputs are allowed to go in parameters?

The key thing to note in the above code is that the parameters (like interval, to_date, from_date, stock_code, exchange_code and product_type) can take input in a specific format only. For instance, parameter ‘interval’ will accept “1minute” but not if you enter “1min” or “01m”. Even if you miss a double quote “at the end or start of the parameter, the code would throw an error. This is standard protocol of any programming language (python in this case) and we have to abide by this.

Now the next thing that one would like to know is how to get all the list of available inputs that go in these parameters. For example, at the time of writing this article the parameter “interval” can accept the following inputs:

“1minute” , “5minute” , “30minute” , “1day”

While we are building new capabilities for the Breeze API on a regular basis, make sure you check out our community for regular updates.

Link to Breeze Community:

https://community.icicidirect.com/api

Where to get the list of stock codes?

To get the parameter “stock_code” you will have to go to à

https://api.icicidirect.com/breezeapi/documents/index.html?python#instruments

You can download the Security Master file from the above link. It is generated/updated daily at 8:00 AM.

 

Above is a snapshot of how the .txt file looks from inside. If you want to search the stock code for a particular instrument, simply use “ctrl + f” to find the related instrument.

#Note: You can open the file in excel too, just that, you would need to use a delimiter “,” to separate the field values and create a dataset.

Notice the second column “Short Name” in the dataset. This corresponds to the stock code required in the input parameter of API endpoints.

So let’s say you want to download daily closing price for Reliance Industries Limited from NSE for the entire 2021 year. You should first look for Reliance Industries in the stock master file and on doing so should come across “RELIND” as the short name for Reliance Industries as listed on NSE.

The final code should look something like below:

# importing required libraries

from breeze_connect import BreezeConnect

import pandas as pd

 

# generating session through

isec = BreezeConnect(api_key="K%834G9%)2M9z75111V2dP")

isec.generate_session(api_secret="a69+y9097T9r279342xC513O82#ucU1a0",session_token="1117193")

 

# get historical data for Reliance Industries

data = isec.get_historical_data(interval="day",

                            from_date= "2021-01-01T07:00:00.000Z",

                            to_date= "2021-12-31T07:00:00.000Z",

                            stock_code="RELIND",

                            exchange_code="NSE",

                            product_type="cash") 

 

Similarly, you can look for stock codes for all the asset classes – equity, futures, options etc. using the respective master security file (example : NSE script master or FnO scrip master file) available on the same link as mentioned above on our documentation page à instruments section. 

For more information on Breeze API, please check out our homepage, which contains access to articles, videos and webinars for the same. The link for the same is mentioned below:

https://www.icicidirect.com/futures-and-options/api/breeze

Disclaimericon
Share
instagram facebook twitter linkedin mail whatsApp
Did you enjoy this article?

Related Articles

Recent Articles

View all

Understanding Contango in Commodity Markets

Understand contango in commodity trading, how futures prices differ from spot prices, and how financing, storage and insurance costs influence commodity pricing.

icon156 views icon1 minutes icon19 Oct 2026

Know Your Commodity Before You Trade: Copper

Copper is a widely used base metal known for its electrical and thermal conductivity, strength, ductility and corrosion resistance. It is used across electrical wiring, construction, machinery, power infrastructure and several industrial applications.

icon376 views icon2 minutes icon09 Oct 2026

Know your commodity before you trade - Natural Gas

Natural Gas is a widely traded energy commodity used for electricity generation, industrial activity, heating and other applications. Its prices can react sharply to weather, supply and demand, inventories, global energy markets and geopolitical developments.

icon637 views icon1 minutes icon30 Sep 2026

Download
iLearn application

Elevate Your Financial Knowledge with the
ICICI Direct iLearn App

Download
ICICI Direct app

Elevate Your Financial Knowledge with the
ICICI Direct iLearn App