loader2
Partner With Us NRI

Open Free Demat Account Online with ICICIDIRECT

How to Generate Session Key and Install SDK for Breeze API?

What is Breeze API?

Breeze API is the next-gen Trading API from ICICIdirect which has been built with a Customer-first mentality. We are the offering the widest range of data, unmatched in India alongside a robust and stable framework of processes to ensure data security and privacy

You need to login to on https://api.icicidirect.com/apiuser/home to save your App.

What is a Session Key?

A session key is a temporary key that is only used once, during one stretch of time, for encrypting and decrypting data. This is similar to a password that someone has to resets every time they login and helps in encrypting a communication session for each app separately. This key or token expires in 24 hours after generation or at midnight.

How can you generate your Session Key?

  • Login with your ICICIdirect Account on https://api.icicidirect.com/apiuser/home and then navigate to ‘View Apps’
  • Select the app for which you want to generate the Session Token and copy its API Key
  • Open a new tab, and switch to Developer Tools (on Chrome, Firefox, and Edge use the keyboard shortcut: Ctrl+Shift+I)
  • Open the URL: https://api.icicidirect.com/apiuser/login?api_key=your_public_key
  • Give ICICIdirect account credentials as usual and submit
  • In the Network Log table, find the resource with the same name as the redirect URL you gave when creating the app. For example, if you gave the redirect URL as https://127.0.0.1:9080/api, look for a row named “127.0.0.1”.Click the row and in the new split, click tab named “Payload”>”Form Data”>”API_Session”.

Against “API_Session” will be an alpha-numeric (could be only numbers or only alphabets) token. This is your Sesssion Key for that app.

What is an SDK?

SDK stands for software development kit or devkit for short. SDK tools will include a variety of things, including libraries, documentation, code samples, processes, and guides. These can be used by developers to integrate into the apps they want to create.

How can you install an SDK?

  • Install virtual environment package.
    (If you have already installed it then skip this step.)
    pip install virtualenv
  • Create and activate the environment.
    virtualenv -p python3 .
    source bin/activate
  • Install breeze-connect SDK  
    pip install breeze-connect

A few samples:

from breeze_connect import BreezeConnect

# Generate Session

isec = BreezeConnect(api_key="your_api_key")

isec.generate_session(api_secret="your_secret",

session_token="YOUR_SESSION_TOKEN_OBTAINED_FROM_LOGIN_PAGE_RESPONSE")

# Websocket

isec.ws_connect()

# subscribe stocks feeds

isec.subscribe_stock(exchange_code="", stock_code="", product_type="", strike_date="", strike_price="", right="", get_exchange_quotes=True, get_market_depth=True)

def on_ticks(ticks):

print("Ticks: {}".format(ticks))

isec.on_ticks = on_ticks

# unsubscribe stocks feeds

isec.unsubscribe_stock(exchange_code="", stock_code="",product_type="", strike_date="", strike_price="", right="", get_exchange_quotes=True, get_market_depth=True)

Please note that the stock symbols for websockets/live data are different from all other end points. The stock codes for this can be referenced from the Security Master file available at https://api.icicidirect.com/breezeapi/documents/index.html#instruments

What are the salient features of Breeze API are:

  1. Historical 1 Second Data: While everyone gives limited amount of Equity OHLC data, only Breeze gives 3 years of second level LTP data. This allows you to model your strategies more accurately and in the process backtest strategies far more accurately.
  2. Historical Derivatives Data: With 3 years of data, no other broker provides Futures or Options historical data for in-depth analysis
  3. Live Streaming OHLC: While everyone gives streaming LTP data, Breeze is the only one that gives streaming OHLC data so that strategies that are written around Historical OHLC data can be simply taken live without the need to change the data handling functions.
  4. Triple secure data: Breeze has SSL + (App Key, Secret Key) encryption + Checksum encryption of the whole data package so no amount of sniffing or hacking can reveal your data to the wannabe hacker. Breeze is the only retail API in India has this feature.

 

Disclaimer – ICICI Securities Ltd. (I-Sec). Registered office of I-Sec is at ICICI Securities Ltd. - ICICI Venture House, Appasaheb Marathe Marg, Prabhadevi, Mumbai - 400 025, India, Tel No : 022 - 6807 7100. I-Sec is a Member of National Stock Exchange of India Ltd (Member Code :07730), BSE Ltd (Member Code :103) and Member of Multi Commodity Exchange of India Ltd. (Member Code: 56250) and having SEBI registration no. INZ000183631. I-Sec is a SEBI registered with SEBI as a Research Analyst vide registration no. INH000000990. AMFI Regn. No.: ARN-0845. PFRDA registration numbers:  POP no -05092018. I-Sec acts as a Composite Corporate agent having registration number –CA0113. Name of the Compliance officer (broking): Mr. Anoop Goyal, Contact number: 022-40701000, E-mail address: complianceofficer@icicisecurities.com. Investment in securities market are subject to market risks, read all the related documents carefully before investing. The non-broking products / services like Mutual Funds, Insurance, FD/ Bonds, loans, PMS, Tax, Elocker, NPS, IPO, Research, Financial Learning, Investment Advisory etc. are not exchange traded products / services and ICICI Securities Ltd. is just acting as a distributor/ referral Agent of such products / services and all disputes with respect to the distribution activity would not have access to Exchange investor redressal or Arbitration mechanism.The contents herein above shall not be considered as an invitation or persuasion to trade or invest.  I-Sec and affiliates accept no liabilities for any loss or damage of any kind arising out of any actions taken in reliance thereon. The contents herein above are solely for informational purpose and may not be used or considered as an offer document or solicitation of offer to buy or sell or subscribe for securities or other financial instruments or any other product. Investors should consult their financial advisers whether the product is suitable for them before taking any decision. The contents herein mentioned are solely for informational and educational purpose.

Most Popular

  • 13 May 2022
  • ICICI Securities

The Five-Point Financial Planning Checklist For Your Family

Whether you just got married or planning to have a baby or have dependents, you should have financial plans for every stage in your life to ensure a secured future for your family members. Here are five things you can do financially for your family.   

  • 12 May 2022
  • ICICI Securities

What is a Zero Coupon Bond?

You get fixed returns in the form of interest until maturity when you invest in a bond. Zero-coupon bonds work a little differently. In this article, find out what zero-coupon bonds are, their advantages and whether you should invest in them. 

  • 12 May 2022
  • ICICI Securities

What are Cross Currency Pairs?

The forex market is the largest financial market globally. Currency trading is a lucrative and booming business. While most currencies trading happens in relation to the US Dollar, some don’t. That forms the basis of cross currency pairs. Here’s what you need to know about it. 

  • 12 May 2022
  • ICICI Securities

Investing principles from Benjamin Graham: The Father of Value Investing

Benjamin Graham was a British born economist, professor, and investor who taught at Columbia University. He was also a mentor to some of the most famous investors of the 20th century, including Irving Khan, John Templeton, & Warren Buffett. Buffett called him "the second most influential figure in his life, only after my father". 

  • 12 May 2022
  • ICICI Securities

How to Invest in Nifty 50?

The Nifty 50 is the benchmark index of the National Stock Exchange. It represents the 50 largest companies listed in India. Investing in the Nifty 50 can be a good idea for those looking to make index-linked returns. Here’s how you can invest in the index. 

  • 12 May 2022
  • ICICI Securities

Investment philosophy of Cathie Wood: The most powerful woman on Wall Street

Catherine Duddy Wood, also called Cathie Wood, is an investor who primarily invests in disruptive technologies and is the founder, chief executive officer, and chief investment officer of ARK Investment Management, LLC, an investment management firm mostly active in the United States.

  • 11 May 2022
  • ICICI Securities

How to Use Technology to Improve Your Finances

Technology has made life simpler for everyone. In the realm of personal finance, technology has streamlined many processes—from budgeting to automating your payments. On National Technology Day, let’s look at how technology has transformed our finances. 

  • 11 May 2022
  • ICICI Securities

How to Invest in your Every Goal with Mutual Funds?

Each of us is unique. We have different needs and goals in life. Some of us can ride along swinging markets, while some may need a relatively conservative investment tool. 

  • 11 May 2022
  • ICICI Securities

Four Reasons Why Entrepreneurs should Invest in Equity Mutual Funds

Equity mutual funds provide growth opportunities not just for individual investors but also for entrepreneurs and corporates. They make excellent investments for anyone looking for wealth creation. This article will give you four reasons why businesspeople should consider investing in equity mutual funds.