What is a Backtest and What it is Not
Last year NSE put out a circular saying that algo platforms should not make claims about returns that their systems have generated: neither past returns nor promises of future returns.
Build and trade your strategy in live markets at zero cost with the most secure and simple to use API from ICICIdirect: Breeze. Create your own trading platforms, get access to historical data, and streaming OHLC to model your strategies accurately, or securely connect your favourite trading platforms! Breeze API has it all!
Absolutely zero brokerage in Futures and Options
No charges at all to connect your systems, create apps, or access historical data.
Breeze gives 3 years of second level LTP data. This allows clients to model their strategies more accurately.
Breeze gives streaming OHLC data so that strategies that are written around Historical OHLC data can be simply taken live without the need to changethe data handling functions.
Futures and Options historical data for making trading easier
Breeze has SSL + (App Key, Secret Key) encryption + Checksum encryption of the whole data package so that client data can never be revealed
for all your Options trades
for both buying and selling and has unlimited validity.
for Futures trading
Please note: For Equity Delivery (cash) and Margin Funding (MTF) segments, brokerage as per your subscribed plan shall be applicable
Last year NSE put out a circular saying that algo platforms should not make claims about returns that their systems have generated: neither past returns nor promises of future returns.
There are many ways to classify types of algorithms, and no matter which way you slice and dice them, there will always be a considerable overlap. Here we look at the types through an end-use based scenario, and not worry about overlaps, because even where they happen their implementation would be considerably different, and at the end of the day this blog is not so much about academic correctness as it is about showing what traders and investors can think of applying.
To start exploring the multiple features of Breeze API, one would need to enter certain parameters for a successful output.
You might have seen a few articles from our side highlighting the many use-cases of Breeze API. In our relentless pursuit of making you aware of the multi-fold ways of using the data, let us focus on charts as well. If you’re a trader or even a beginner in the field of markets, you must have seen technical charts of markets.
Suppose you have worked out a trading strategy which you believe should make good profits in the market. But before you run it in real time, wouldn’t you like to see all the unusual scenarios wherein your strategy might act up? This is typical of any critical product/process, which is tested under multiple scenarios to check the robustness of the system. Same applies to the universe of algorithmic trading.
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 One Time Passwords (OTP) that have to be generated once in the morning to login, and help in encrypting a communication session for each app separately. This key or token expires in 24 hours after generation or at midnight.
Of late, a plethora of trading APIs that facilitate automated trading have popped up in Indian market. One of the main benefits of using a Trading API to formulate your trading strategies is that it provides a way to test your strategy on historical data. Historical data helps traders do a scenario analysis for their strategies and backtest them, which is one of the most important steps in creating an automated trading system. Backtesting gives the traders a chance to optimise their portfolio and also indicate how their strategy might perform in the future, assuming market conditions do not change a lot.
With Breeze Zero, you can trade without any brokerage worries – nonstop F&O trading without a single penny of brokerage with Breeze API !
Here are some important points to keep in mind:
Offer is live since 7th Oct’23. To subscribe to the plan click here
The rate limit is 100 calls per minute and 5,000 calls per day
We currently have three SDKs
Yes, Breeze allows you to use Options Chain API, where in a single API call you can get entire chain with OHLC prices, Open Interest, Volume and much more and lets you filter the chain by expiry date, right or strike price
Breeze API is the next-gen Trading API from ICICIdirect with an array of unique features to provide you with a
competitive advantage. With the help of Breeze API you can, but not restricted to:
- Connect your trading system to our secure and super fast platform
- Backtest your trades with our data rich APIs
- Create and execute your strategies seamlessly
- Utilize our Trading APIs to get live feed and historical data of any listed instrument
- What’s more – there is ZERO brokerage cost when you trade via Breeze API in Futures & Options segments!
There is no cost or fees which customer needs to pay to access Breeze API or the data which we provide. All ICICIdirect customers can use Breeze API and create Apps free of all charges. What’s more – there is ZERO brokerage cost when you trade via Breeze API in Futures & Options segments!
After successfully registering your App on Breeze login page, the API key and Secret Key should be available in the view Apps section in the homepage. Generate a session token for the respective App. Plug all 3 App credentials (API key, Secret Key and Session Token) in the Breeze API endpoint and start using the API. Please refer to our articles to see the step wise process
At present, we have made available Stocks and Derivatives (F&O) trading through Breeze API. All the order types for the two segments are allowed.
There are no brokerage charges for Futures & Options trading via Breeze API. For Delivery (Cash) and MTF orders, charges as per your brokerage plan shall be applicable.
Currently, the rate limit for API is 75 per minute and 5000 calls in a day per user
At present, Breeze API is only available for Resident Indians and not for NRI customers.
Breeze is a Rest API and it supports various languages such as Javascript, Python, Csharp, Java etc
Breeze API has historical data for Futures and Options trading and at present support 3 years of data which can be used free of cost.
Breeze API is unique since it is created with the next gen technology supporting multiple languages for you to create your customized code. All the data and integration is offered at zero cost coupled with our extremely secure triple layer security to protect your data. What’s more – trading through Breeze API is also at ZERO brokerage charge!
Yes, you may. We have websockets available for live data feed of markets. Please refer to our SDK page to know more.
API i.e. Application Programming interface, is a software intermediary that allows two applications to talk to each other. Trading APIs allow you to get live market prices, execute orders in real time, and help manage your orders and positions.
Zero cost of integration, Create your own strategy to enter and exit the market, Get historical data and live market feeds, Connect to your trading platform with ease. Finally, ZERO trading cost for F&O segments.
Yes, it is available. Please click on https://pypi.org/project/breeze-connect/ to see the complete list of Python SDK methods available and how to use them
A basic level of programming knowledge is required to create strategies and use Breeze API.
You will have to use websockets to subscribe to live feeds of markets. Please click on
to see the complete list of Python SDK methods available, including websockets and how to use them.
Breeze has SSL + (App Key, Secret Key) encryption + Checksum encryption of the whole data package so no amount of sniffing or hacking can reveal client data to the wannabe hacker.
Please refer to our SDK page which lists all the SDK methods including websockets for usage. Please click on https://pypi.org/project/breeze-connect/ to see the complete list of Python SDK methods available and how to use them.
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 One Time Passwords (OTP) that have to be generated once in the morning to login, and help in encrypting a communication session for each app separately. This key or token expires in 24 hours after generation or at midnight
Yes, it is required as per SEBI regulations
Breeze API is available to all ICICIdirect customers. If you do not have a demat account with ICICI Securities you will have to create one.
You will have to create a strategy by writing a programming code using Breeze API endpoints and open source libraries. You can then deploy them in your personal laptop/desktop in a IDE (like Jupyter, Spyder). Where can I deploy strategies I have created? Strategies should be deployed in your personal desktop/laptop in an IDE (like Jupyter, Spyder, VS) using Breeze API endpoint.
Yes, you can check the live positions through get_postions() function of Breeze.
In order to connect to Breeze API, you need to have an account with ICICIdirect. Create your account here:
https://isecuat1.icicidirect.com/open-account/mobile
After this, visithttps://api.icicidirect.com/apiuser/home and login with your ICICIdirect credentials. Now, you can create your Apps and use all the features of Breeze API
Yes, with Breeze API users can easily fetch 1sec, 1min data for historical backtesting purposes.
Code:
breeze.get_historical_data_v2(interval="1second", from_date= "2023-01-02T07:00:00.000Z", to_date= "2023-01-03T07:00:15.000Z", stock_code="ITC", exchange_code="NSE", product_type="cash")
Yes, Breeze API allows trading in integration with a lot of third parties like Streak, GoCharting, 5nance, Quantman etc. You can login on their platform choosing ICICIdirect as broker and get started for enjoying third party features and Breeze API platform functionalities.
The TOTP option is live in ICICIdirect API login page. Users can enable it by visiting the settings option at homepage:
No, for an individual account only registered user is allowed to login. Every separate user needs to generate their App key and Secret key by their own login credentials.
No, Session key needs to be generated everyday manually according to SEBI guidelines. It is valid for 24 hours or until midnight.
Yes, make use of the following links:
With Breeze API, get a snapshot of the entire Option Chain of any stock code by just customizing the code below:
breeze.get_option_chain_quotes(stock_code="NIFTY", exchange_code="NFO", product_type="options", expiry_date="2022-12-25T06:00:00.000Z", right="call", strike_price="")
No, with Breeze API you get access to all the features like backtesting historical data, fetching live data via websockets etc absolutely free of cost
On subscribing to feeds, the callback is supposed to listen to any incoming data packets until the websocket is disconnected.
If we wish to stop feeds after a certain time , we can use time.sleep and then call unsubscribe_feeds .
#Connect to websocket
api.ws_connect()
# Callback to receive ticks. def on_ticks(ticks): print("Ticks: {}".format(ticks))
api.on_ticks = on_ticks
api.subscribe_feeds(stock_token="13.1!1050")
time.sleep(500)
api.unsubscribe_feeds(stock_token="13.1!1050")
To get the quotes of the mentioned stock code the following code can be customized:
breeze.get_quotes(stock_code="ICIBAN",
exchange_code="NFO",
expiry_date="2022-08-25T06:00:00.000Z",
product_type="futures",
right="others",
strike_price="0") Note: Please change exchange_code=“NFO” to get details about F&O
To get trade list of your account use the below code:
breeze.get_trade_list(from_date="2022-08-01T06:00:00.000Z",
to_date="2022-08-19T06:00:00.000Z",
exchange_code="NSE",
product_type="",
action="",
stock_code="")
Note: Please change exchange_code=“NFO” to get details about F&O
Sample code for using websockets:
from breeze_connect import BreezeConnect
# Initialize SDK breeze = BreezeConnect(api_key="your_api_key")
# Generate Session breeze.generate_session(api_secret="your_secret_key", session_token="your_api_session")
# Connect to websocket (it will connect to rate refresh server) breeze.ws_connect()
# Callback to receive ticks. def on_ticks(ticks): print("Ticks: {}".format(ticks))
# Assign the callbacks. breeze.on_ticks = on_ticks
# subscribe stocksfeeds breeze.subscribe_feeds(exchange_code="NFO", stock_code="ZEEENT", product_type="options", expiry_date="31-Mar-2022", strike_price="350", right="Call", get_exchange_quotes=True, get_market_depth=False
Sample code for modifying order:
breeze.modify_order(order_id="202208191100000001", exchange_code="NFO", order_type="limit", stoploss="0", quantity="250", price="290100", validity="day", disclosed_quantity="0", validity_date="2022-08-22T06:00:00.000Z")
Sample code for Squaring of Order:
breeze.square_off(exchange_code="NSE",
product="margin", stock_code="NIFTY", quantity="10", price="0", action="sell", order_type="market", validity="day", stoploss="0", disclosed_quantity="0", protection_percentage="", settlement_id="", cover_quantity="", open_quantity="", margin_amount="")
Sample code for fetching portfolio details: breeze.get_portfolio_holdings(exchange_code="NFO", from_date="2022-08-01T06:00:00.000Z", to_date="2022-08-19T06:00:00.000Z", stock_code="", portfolio_type="")
For setting funds:
breeze.set_funds(transaction_type="debit", amount="200", segment="Equity")
For getting funds: breeze.get_funds()
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. Name of the Compliance officer (broking): Ms. Mamta Shetty, Contact number: 022-40701022, E-mail address: complianceofficer@icicisecurities.com. Investments in securities market are subject to market risks, read all the related documents carefully before investing. 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. Investors should consult their financial advisers whether the product is suitable for them before taking any decision. The client shall not have any claim against I-Sec and/or its employees on account of any suspension, interruption, non-availability or malfunctioning of I-Sec system or service or non-execution of algo orders due to any link/system failure for any reason beyond I-Sec control. I-Sec reserves the right to pause, stop or call back any of the execution algos in case of any technical or mechanical exigency