- Breeze API Python Client
- Regulatory Changes
- API Documentation
- Set Up Virtual Environment
- Installing Client
- API Usage
- Websocket Usage
- List Of APIs
- Version History
The official Python client library for the ICICI Securities trading APIs. BreezeConnect is a set of REST-like APIs that allows one to build a complete investment and trading platform. Following are some notable features of Breeze APIs:
- Execute orders in real time
- Manage Portfolio
- Access to 10 years of historical market data including 1 sec OHLCV
- Streaming live OHLC (websockets)
- Option Chain API
To install breeze strategies : Click here
- Orders must be placed only from the static IP address registered with ICICI Direct while procuring API key.
- Primary or secondary static IP provided by the client can be updated only once per week.
- Each client can have multiple API keys as per the circular, however for unregistered algos (Breeze API) the client is restricted to route orders via single API key.
- A maximum combined limit of 10 orders per second is allowed, which includes order placement, cancellation, modification, and square-off requests.
- Market orders are not permitted. Any order marked as a “market” order will instead be placed as an ‘aggressive limit order’ across Equity and F&O segments. For more information Aggressive Limit order
- Placement, modification, or cancelation of Margin and Option Plus orders via the Breeze API is prohibited.
You must install the virtualenv package via pip
pip install virtualenv
You should create breeze virtual environment via virtualenv
virtualenv -p python3 breeze_venv
And then, You can activate virtual environment via source
source breeze_venv/bin/activate
You can install the latest release via pip
pip install --upgrade breeze-connect
Or, You can also install the specific release version via pip
pip install breeze-connect==1.0.68
from breeze_connect import BreezeConnect
# Initialize SDK
breeze = BreezeConnect(api_key="your_api_key")
# Obtain your session key from https://api.icicidirect.com/apiuser/login?api_key=YOUR_API_KEY
# Incase your api-key has special characters(like +,=,!) then encode the api key before using in the url as shown below.
import urllib
print("https://api.icicidirect.com/apiuser/login?api_key="+urllib.parse.quote_plus("your_api_key"))
# Generate Session
breeze.generate_session(api_secret="your_secret_key",
session_token="your_api_session")
# Generate ISO8601 Date/DateTime String
import datetime
iso_date_string = datetime.datetime.strptime("28/02/2021","%d/%m/%Y").isoformat()[:10] + 'T05:30:00.000Z'
iso_date_time_string = datetime.datetime.strptime("28/02/2021 23:59:59","%d/%m/%Y %H:%M:%S").isoformat()[:19] + '.000Z'from breeze_connect import BreezeConnect
# Initialize SDK
breeze = BreezeConnect(api_key="your_api_key")
# Obtain your session key from https://api.icicidirect.com/apiuser/login?api_key=YOUR_API_KEY
# Incase your api-key has special characters(like +,=,!) then encode the api key before using in the url as shown below.
import urllib
print("https://api.icicidirect.com/apiuser/login?api_key="+urllib.parse.quote_plus("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 tick-by-tick data server)
breeze.ws_connect()
# Callback to receive ticks.
def on_ticks(ticks):
print("Ticks: {}".format(ticks))
# Assign the callbacks.
breeze.on_ticks = on_ticks
# ws_disconnect (it will disconnect from all actively connected servers)
breeze.ws_disconnect()breeze.subscribe_feeds(stock_token="4.1!2885",
interval="1minute")View Response
{'message': 'Stock 4.1!2885 subscribed successfully'}
Ticks: {'interval': '1minute', 'exchange_code': 'NSE', 'stock_code': 'RELIND', 'low': '1199.5', 'high': '1200.15', 'open': '1199.95', 'close': '1200.0', 'volume': '40752', 'datetime': '2025-02-12 10:04:00'}
Ticks: {'interval': '1minute', 'exchange_code': 'NSE', 'stock_code': 'RELIND', 'low': '1199.3', 'high': '1201.0', 'open': '1200.0', 'close': '1200.2', 'volume': '113253', 'datetime': '2025-02-12 10:05:00'}
For unsubscribe : breeze.unsubscribe_feeds(stock_token="4.1!2885", interval="1minute")
breeze.subscribe_feeds(stock_token="4.1!2885")View Response
{'message': 'Stock 4.1!2885 subscribed successfully'}
Ticks: {'symbol': '4.1!2885', 'open': 1219.45, 'last': 1209.05, 'high': 1226.9, 'low': 1193.35, 'change': -2.09, 'bPrice': 1209.05, 'bQty': 13, 'sPrice': 1209.35, 'sQty': 34, 'ltq': 1, 'avgPrice': 1208.86, 'quotes': 'Quotes Data', 'ttq': 10991550, 'totalBuyQt': 762919, 'totalSellQ': 619405, 'ttv': '1328.72C', 'trend': '', 'lowerCktLm': 1111.4, 'upperCktLm': 1358.3, 'ltt': 'Wed Feb 12 11:12:20 2025', 'close': 1234.85, 'exchange': 'NSE Equity', 'stock_name': 'RELIANCE INDUSTRIES'}
Ticks: {'symbol': '4.1!2885', 'open': 1219.45, 'last': 1209.05, 'high': 1226.9, 'low': 1193.35, 'change': -2.09, 'bPrice': 1209.05, 'bQty': 13, 'sPrice': 1209.35, 'sQty': 34, 'ltq': 1, 'avgPrice': 1208.86, 'quotes': 'Quotes Data', 'ttq': 10991550, 'totalBuyQt': 762919, 'totalSellQ': 619405, 'ttv': '1328.72C', 'trend': '', 'lowerCktLm': 1111.4, 'upperCktLm': 1358.3, 'ltt': 'Wed Feb 12 11:12:20 2025', 'close': 1234.85, 'exchange': 'NSE Equity', 'stock_name': 'RELIANCE INDUSTRIES'}
For unsubscribe : breeze.unsubscribe_feeds(stock_token="4.1!2885")
breeze.subscribe_feeds(exchange_code="NSE",
stock_code="NIFTY",
product_type="cash",
get_market_depth=False,
get_exchange_quotes=True)View Response
{'message': 'Stock NIFTY subscribed successfully'}
Ticks: {'symbol': '4.1!NIFTY 50', 'open': 24748.7, 'last': 25006.2, 'high': 25029.5, 'low': 24671.45, 'change': 1.03, 'bPrice': None, 'bQty': None, 'sPrice': None, 'sQty': None, 'ltq': None, 'avgPrice': None, 'quotes': 'Quotes Data', 'ttq': None, 'totalBuyQt': None, 'totalSellQ': None, 'ttv': None, 'trend': '+', 'lowerCktLm': None, 'upperCktLm': None, 'ltt': 'Fri Jun 6 15:10:48 2025', 'close': 24750.9, 'exchange': 'NSE Equity', 'stock_name': 'NIFTY 50'}
Ticks: {'symbol': '4.1!NIFTY 50', 'open': 24748.7, 'last': 25006.05, 'high': 25029.5, 'low': 24671.45, 'change': 1.03, 'bPrice': None, 'bQty': None, 'sPrice': None, 'sQty': None, 'ltq': None, 'avgPrice': None, 'quotes': 'Quotes Data', 'ttq': None, 'totalBuyQt': None, 'totalSellQ': None, 'ttv': None, 'trend': '-', 'lowerCktLm': None, 'upperCktLm': None, 'ltt': 'Fri Jun 6 15:10:48 2025', 'close': 24750.9, 'exchange': 'NSE Equity', 'stock_name': 'NIFTY 50'}
For unsubscribe : breeze.unsubscribe_feeds(exchange_code="NSE", stock_code="NIFTY", product_type="cash", get_market_depth=False, get_exchange_quotes=True)
breeze.subscribe_feeds(exchange_code= "NFO",
stock_code="NIFTY",
expiry_date="13-Feb-2025",
strike_price="23550",
right="call",
product_type="options",
get_market_depth=False ,
get_exchange_quotes=True,
interval="1minute")View Response
{'message': 'Stock NIFTY subscribed successfully'}
Ticks: {'interval': '1minute', 'exchange_code': 'NFO', 'stock_code': 'NIFTY', 'expiry_date': '13-Feb-2025', 'strike_price': '23550.0', 'right_type': 'CE', 'low': '7.4', 'high': '8.25', 'open': '7.55', 'close': '8.2', 'volume': '354975', 'oi': '4763100', 'datetime': '2025-02-12 12:10:00'}
Ticks: {'interval': '1minute', 'exchange_code': 'NFO', 'stock_code': 'NIFTY', 'expiry_date': '13-Feb-2025', 'strike_price': '23550.0', 'right_type': 'CE', 'low': '7.75', 'high': '8.85', 'open': '8.2', 'close': '7.8', 'volume': '412950', 'oi': '4763100', 'datetime': '2025-02-12 12:11:00'}
For unsubscribe : breeze.unsubscribe_feeds(exchange_code= "NFO", stock_code="NIFTY", expiry_date="13-Feb-2025", strike_price="23550", right="call", product_type="options", get_market_depth=False , get_exchange_quotes=True, interval="1minute")
breeze.subscribe_feeds(exchange_code= "NFO",
stock_code="NIFTY",
expiry_date="13-Feb-2025",
strike_price="23550",
right="call",
product_type="options",
get_market_depth=False ,
get_exchange_quotes=True)View Response
{'message': 'Stock NIFTY subscribed successfully'}
Ticks: {'symbol': '4.1!51219', 'open': 11.4, 'last': 8.5, 'high': 11.4, 'low': 3.1, 'change': -28.27, 'bPrice': 8.5, 'bQty': 9300, 'sPrice': 8.6, 'sQty': 8700, 'ltq': 75, 'avgPrice': 5.41, 'quotes': 'Quotes Data', 'OI': 4763100, 'CHNGOI': None, 'ttq': 70816125, 'totalBuyQt': 1974300, 'totalSellQ': 548625, 'ttv': '38.31C', 'trend': '', 'lowerCktLm': 0.05, 'upperCktLm': 39.15, 'ltt': 'Wed Feb 12 12:12:55 2025', 'close': 11.85, 'exchange': 'NSE Futures & Options', 'stock_name': 'NIFTY 50', 'product_type': 'Options', 'expiry_date': '13-Feb-2025', 'strike_price': '23550', 'right': 'Call'}
Ticks: {'symbol': '4.1!51219', 'open': 11.4, 'last': 8.5, 'high': 11.4, 'low': 3.1, 'change': -28.27, 'bPrice': 8.4, 'bQty': 14475, 'sPrice': 8.5, 'sQty': 6750, 'ltq': 75, 'avgPrice': 5.41, 'quotes': 'Quotes Data', 'OI': 4763100, 'CHNGOI': None, 'ttq': 70818150, 'totalBuyQt': 1962375, 'totalSellQ': 558750, 'ttv': '38.31C', 'trend': '', 'lowerCktLm': 0.05, 'upperCktLm': 39.15, 'ltt': 'Wed Feb 12 12:12:54 2025', 'close': 11.85, 'exchange': 'NSE Futures & Options', 'stock_name': 'NIFTY 50', 'product_type': 'Options', 'expiry_date': '13-Feb-2025', 'strike_price': '23550', 'right': 'Call'}
For unsubscribe : breeze.unsubscribe_feeds(exchange_code= "NFO", stock_code="NIFTY", expiry_date="13-Feb-2025", strike_price="23550", right="call", product_type="options", get_market_depth=False , get_exchange_quotes=True)
breeze.subscribe_feeds(exchange_code= "NFO",
stock_code="NIFTY",
expiry_date="13-Feb-2025",
strike_price="23550",
right="call",
product_type="options",
get_market_depth=True ,
get_exchange_quotes=False)View Response
{'message': 'Stock NIFTY subscribed successfully'}
Ticks: {'symbol': '4.2!51219', 'time': 'Wed Feb 12 12:16:18 2025', 'depth': [{'BestBuyRate-1': 7.25, 'BestBuyQty-1': 8475, 'BuyNoOfOrders-1': 17, 'BuyFlag-1': '', 'BestSellRate-1': 7.3, 'BestSellQty-1': 4350, 'SellNoOfOrders-1': 7, 'SellFlag-1': ''}, {'BestBuyRate-2': 7.2, 'BestBuyQty-2': 9675, 'BuyNoOfOrders-2': 17, 'BuyFlag-2': '', 'BestSellRate-2': 7.35, 'BestSellQty-2': 6900, 'SellNoOfOrders-2': 13, 'SellFlag-2': ''}, {'BestBuyRate-3': 7.15, 'BestBuyQty-3': 4800, 'BuyNoOfOrders-3': 10, 'BuyFlag-3': '', 'BestSellRate-3': 7.4, 'BestSellQty-3': 11700, 'SellNoOfOrders-3': 21, 'SellFlag-3': ''}, {'BestBuyRate-4': 7.1, 'BestBuyQty-4': 12825, 'BuyNoOfOrders-4': 19, 'BuyFlag-4': '', 'BestSellRate-4': 7.45, 'BestSellQty-4': 9300, 'SellNoOfOrders-4': 15, 'SellFlag-4': ''}, {'BestBuyRate-5': 7.05, 'BestBuyQty-5': 6300, 'BuyNoOfOrders-5': 9, 'BuyFlag-5': '', 'BestSellRate-5': 7.5, 'BestSellQty-5': 13200, 'SellNoOfOrders-5': 20, 'SellFlag-5': ''}], 'quotes': 'Market Depth', 'stock_name': 'NIFTY 50', 'product_type': 'Options', 'expiry_date': '13-Feb-2025', 'strike_price': '23550', 'right': 'Call'}
Ticks: {'symbol': '4.2!51219', 'time': 'Wed Feb 12 12:16:19 2025', 'depth': [{'BestBuyRate-1': 7.3, 'BestBuyQty-1': 10950, 'BuyNoOfOrders-1': 22, 'BuyFlag-1': '', 'BestSellRate-1': 7.35, 'BestSellQty-1': 3150, 'SellNoOfOrders-1': 3, 'SellFlag-1': ''}, {'BestBuyRate-2': 7.25, 'BestBuyQty-2': 9675, 'BuyNoOfOrders-2': 17, 'BuyFlag-2': '', 'BestSellRate-2': 7.4, 'BestSellQty-2': 10050, 'SellNoOfOrders-2': 18, 'SellFlag-2': ''}, {'BestBuyRate-3': 7.2, 'BestBuyQty-3': 7275, 'BuyNoOfOrders-3': 14, 'BuyFlag-3': '', 'BestSellRate-3': 7.45, 'BestSellQty-3': 12300, 'SellNoOfOrders-3': 19, 'SellFlag-3': ''}, {'BestBuyRate-4': 7.15, 'BestBuyQty-4': 4050, 'BuyNoOfOrders-4': 8, 'BuyFlag-4': '', 'BestSellRate-4': 7.5, 'BestSellQty-4': 15000, 'SellNoOfOrders-4': 21, 'SellFlag-4': ''}, {'BestBuyRate-5': 7.1, 'BestBuyQty-5': 12975, 'BuyNoOfOrders-5': 20, 'BuyFlag-5': '', 'BestSellRate-5': 7.55, 'BestSellQty-5': 6150, 'SellNoOfOrders-5': 12, 'SellFlag-5': ''}], 'quotes': 'Market Depth', 'stock_name': 'NIFTY 50', 'product_type': 'Options', 'expiry_date': '13-Feb-2025', 'strike_price': '23550', 'right': 'Call'}
For unsubscribe : breeze.unsubscribe_feeds(exchange_code= "NFO", stock_code="NIFTY", expiry_date="13-Feb-2025", strike_price="23550", right="call", product_type="options", get_market_depth=True , get_exchange_quotes=False)
breeze.subscribe_feeds(exchange_code= "BFO",
stock_code="BSESEN",
expiry_date="18-Feb-2025",
strike_price="78200",
right="call",
product_type="options",
get_market_depth=False,
get_exchange_quotes=True,
interval="1minute")View Response
{'message': 'Stock BSESEN subscribed successfully'}
Ticks: {'interval': '1minute', 'exchange_code': 'BFO', 'stock_code': 'BSESEN', 'expiry_date': '18-Feb-2025', 'strike_price': '78200.0', 'right_type': 'CE', 'low': '83.6', 'high': '89.6', 'open': '89.6', 'close': '83.8', 'volume': '4420', 'oi': '0', 'datetime': '2025-02-12 12:54:00'}
Ticks: {'interval': '1minute', 'exchange_code': 'BFO', 'stock_code': 'BSESEN', 'expiry_date': '18-Feb-2025', 'strike_price': '78200.0', 'right_type': 'CE', 'low': '82.0', 'high': '86.0', 'open': '82.0', 'close': '84.2', 'volume': '3200', 'oi': '0', 'datetime': '2025-02-12 12:55:00'}
For unsubscribe : breeze.unsubscribe_feeds(exchange_code= "BFO", stock_code="BSESEN", expiry_date="18-Feb-2025", strike_price="78200", right="call", product_type="options", get_market_depth=False, get_exchange_quotes=True, interval="1minute)
breeze.subscribe_feeds(exchange_code= "BFO",
stock_code="BSESEN",
expiry_date="18-Feb-2025",
strike_price="78200",
right="call",
product_type="options",
get_market_depth=False,
get_exchange_quotes=True)View Response
{'message': 'Stock BSESEN subscribed successfully'}
Ticks: {'symbol': '8.1!844663', 'open': 96, 'last': 98, 'high': 105.8, 'low': 35.25, 'change': -2.05, 'bPrice': 96.8, 'bQty': 40, 'sPrice': 97.25, 'sQty': 120, 'ltq': 20, 'avgPrice': 61.87, 'quotes': 'Quotes Data', 'OI': 37020, 'CHNGOI': 12880, 'ttq': 809940, 'totalBuyQt': 30800, 'totalSellQ': 12360, 'ttv': 6338.74, 'trend': '', 'lowerCktLm': 0.05, 'upperCktLm': 505.8, 'ltt': 'Wed Feb 12 12:53:33 2025', 'close': 100.05}
Ticks: {'symbol': '8.1!844663', 'open': 96, 'last': 98, 'high': 105.8, 'low': 35.25, 'change': -2.05, 'bPrice': 96.8, 'bQty': 40, 'sPrice': 97.25, 'sQty': 120, 'ltq': 20, 'avgPrice': 61.87, 'quotes': 'Quotes Data', 'OI': 37020, 'CHNGOI': 12880, 'ttq': 809940, 'totalBuyQt': 30800, 'totalSellQ': 12360, 'ttv': 6338.74, 'trend': '', 'lowerCktLm': 0.05, 'upperCktLm': 505.8, 'ltt': 'Wed Feb 12 12:53:33 2025', 'close': 100.05}
For unsubscribe : breeze.unsubscribe_feeds(exchange_code= "BFO", stock_code="BSESEN", expiry_date="18-Feb-2025", strike_price="78200", right="call", product_type="options", get_market_depth=False, get_exchange_quotes=True)
breeze.subscribe_feeds(exchange_code= "BFO",
stock_code="BSESEN",
expiry_date="18-Feb-2025",
strike_price="78200",
right="call",
product_type="options",
get_market_depth=True ,
get_exchange_quotes=False )View Response
{'message': 'Stock BSESEN subscribed successfully'}
Ticks: {'symbol': '8.2!844663', 'time': 'Wed Feb 12 12:49:50 2025', 'depth': [{'BestBuyRate-1': 87.3, 'BestBuyQty-1': 20, 'BuyNoOfOrders-1': 1, 'BestSellRate-1': 87.8, 'BestSellQty-1': 20, 'SellNoOfOrders-1': 1}, {'BestBuyRate-2': 87.25, 'BestBuyQty-2': 480, 'BuyNoOfOrders-2': 4, 'BestSellRate-2': 87.85, 'BestSellQty-2': 100, 'SellNoOfOrders-2': 2}, {'BestBuyRate-3': 87.2, 'BestBuyQty-3': 520, 'BuyNoOfOrders-3': 2, 'BestSellRate-3': 87.9, 'BestSellQty-3': 500, 'SellNoOfOrders-3': 3}, {'BestBuyRate-4': 87.05, 'BestBuyQty-4': 20, 'BuyNoOfOrders-4': 1, 'BestSellRate-4': 88, 'BestSellQty-4': 100, 'SellNoOfOrders-4': 2}, {'BestBuyRate-5': 86.9, 'BestBuyQty-5': 80, 'BuyNoOfOrders-5': 1, 'BestSellRate-5': 88.1, 'BestSellQty-5': 200, 'SellNoOfOrders-5': 2}], 'quotes': 'Market Depth'}
Ticks: {'symbol': '8.2!844663', 'time': 'Wed Feb 12 12:49:50 2025', 'depth': [{'BestBuyRate-1': 87.3, 'BestBuyQty-1': 20, 'BuyNoOfOrders-1': 1, 'BestSellRate-1': 87.8, 'BestSellQty-1': 20, 'SellNoOfOrders-1': 1}, {'BestBuyRate-2': 87.25, 'BestBuyQty-2': 480, 'BuyNoOfOrders-2': 4, 'BestSellRate-2': 87.85, 'BestSellQty-2': 100, 'SellNoOfOrders-2': 2}, {'BestBuyRate-3': 87.2, 'BestBuyQty-3': 520, 'BuyNoOfOrders-3': 2, 'BestSellRate-3': 87.9, 'BestSellQty-3': 500, 'SellNoOfOrders-3': 3}, {'BestBuyRate-4': 87.05, 'BestBuyQty-4': 20, 'BuyNoOfOrders-4': 1, 'BestSellRate-4': 88, 'BestSellQty-4': 100, 'SellNoOfOrders-4': 2}, {'BestBuyRate-5': 86.9, 'BestBuyQty-5': 80, 'BuyNoOfOrders-5': 1, 'BestSellRate-5': 88.1, 'BestSellQty-5': 200, 'SellNoOfOrders-5': 2}], 'quotes': 'Market Depth'}
For unsubscribe : breeze.unsubscribe_feeds(exchange_code= "BFO", stock_code="BSESEN", expiry_date="18-Feb-2025", strike_price="78200", right="call", product_type="options", get_market_depth=True , get_exchange_quotes=False )
breeze.subscribe_feeds(stock_token="one_click_fno")View Response
Ticks: {'strategy_date': '2025-02-07 14:29:29', 'modification_date': '2025-02-07 14:29:29', 'portfolio_id': '133444', 'call_action': 'Call Initiated', 'portfolio_name': 'Index Long Call', 'exchange_code': 'NFO', 'product_type': 'options', 'underlying': 'NIFTY ', 'expiry_date': '2025-02-13 00:00:00', 'option_type': 'call', 'strike_price': '23450', 'action': 'buy', 'recommended_price_from': '175', 'recommended_price_to': '178', 'minimum_lot_quantity': '75', 'last_traded_price': '181.45', 'best_bid_price': '181.5', 'best_offer_price': '181.9', 'last_traded_quantity': '23461.65', 'target_price': '240', 'expected_profit_per_lot': '4762.5', 'stop_loss_price': '144.9', 'expected_loss_per_lot': '2370', 'total_margin': '13350', 'leg_no': '1', 'status': 'active'}
Ticks: {'strategy_date': '2025-02-07 14:43:07', 'modification_date': '2025-02-07 14:43:07', 'portfolio_id': '133451', 'call_action': 'Call Initiated', 'portfolio_name': 'Weekly Future Short', 'exchange_code': 'NFO', 'product_type': 'futures', 'underlying': 'INFEDG', 'expiry_date': '2025-02-27 00:00:00', 'option_type': 'others', 'strike_price': '0', 'action': 'sell', 'recommended_price_from': '7830', 'recommended_price_to': '7860', 'minimum_lot_quantity': '75', 'last_traded_price': '7826.45', 'best_bid_price': '7825.4', 'best_offer_price': '7831', 'last_traded_quantity': '7806.65', 'target_price': '7400', 'expected_profit_per_lot': '33375', 'stop_loss_price': '8100.1', 'expected_loss_per_lot': '19132.5', 'total_margin': '133131.2', 'leg_no': '1', 'status': 'active'}
For unsubscribe : breeze.unsubscribe_feeds(stock_token = "one_click_fno")
breeze.subscribe_feeds(stock_token="i_click_2_gain") View Response
{'message': 'i_click_2_gain streaming subscribed successfully.'}
Tick Data: {'stock_name': 'MAHINDRA & MAHINDRA LIMITED(MAHMAH)Margin-Buy', 'stock_code': 'MAHMAH', 'action_type': 'buy', 'expiry_date': '', 'strike_price': '', 'option_type': '', 'stock_description': 'Margin', 'recommended_price_and_date': '3065-3068,2025-01-02 08:55:02', 'recommended_price_from': '3065', 'recommended_price_to': '3068', 'recommended_date': '2025-01-02 08:55:02', 'target_price': '3098', 'sltp_price': '3050', 'part_profit_percentage': '0,0', 'profit_price': '0', 'exit_price': '0', 'recommended_update': ' ', 'iclick_status': 'open', 'subscription_type': 'iclick_2_gain '}
Tick Data: {'stock_name': 'POWER FINANCE CORPORATION LTD(POWFIN)Margin-Buy', 'stock_code': 'POWFIN', 'action_type': 'buy', 'expiry_date': '', 'strike_price': '', 'option_type': '', 'stock_description': 'Margin', 'recommended_price_and_date': '450-451,2025-01-02 09:37:01', 'recommended_price_from': '450', 'recommended_price_to': '451', 'recommended_date': '2025-01-02 09:37:01', 'target_price': '456', 'sltp_price': '447', 'part_profit_percentage': '0,0', 'profit_price': '0', 'exit_price': '0', 'recommended_update': ' ', 'iclick_status': 'open', 'subscription_type': 'iclick_2_gain'}
For unsubscribe : breeze.unsubscribe_feeds(stock_token = "i_click_2_gain")
breeze.subscribe_feeds(stock_token=['4.1!3499','4.1!2885'])View Response
{'message': "Stock ['4.1!3499', '4.1!2885'] subscribed successfully"}
Ticks: {'symbol': '4.1!3499', 'open': 146.79, 'last': 148.32, 'high': 149.49, 'low': 146.2, 'change': 1.52, 'bPrice': 148.3, 'bQty': 2880, 'sPrice': 148.32, 'sQty': 5480, 'ltq': 20, 'avgPrice': 148.23, 'quotes': 'Quotes Data', 'ttq': 21831757, 'totalBuyQt': 2187011, 'totalSellQ': 3921071, 'ttv': '323.61C', 'trend': '', 'lowerCktLm': 131.49, 'upperCktLm': 160.71, 'ltt': 'Thu Mar 6 09:56:18 2025', 'close': 146.1, 'exchange': 'NSE Equity', 'stock_name': 'TATA STEEL LIMITED'}
Ticks: {'symbol': '4.1!2885', 'open': 1197, 'last': 1189.05, 'high': 1200.5, 'low': 1185.15, 'change': 1.16, 'bPrice': 1189.05, 'bQty': 92, 'sPrice': 1189.2, 'sQty': 175, 'ltq': 308, 'avgPrice': 1194.59, 'quotes': 'Quotes Data', 'ttq': 4073591, 'totalBuyQt': 512163, 'totalSellQ': 661691, 'ttv': '486.63C', 'trend': '', 'lowerCktLm': 1058.05, 'upperCktLm': 1293.15, 'ltt': 'Thu Mar 6 09:56:19 2025', 'close': 1175.6, 'exchange': 'NSE Equity', 'stock_name': 'RELIANCE INDUSTRIES'}
Ticks: {'symbol': '4.1!3499', 'open': 146.79, 'last': 148.32, 'high': 149.49, 'low': 146.2, 'change': 1.52, 'bPrice': 148.3, 'bQty': 2880, 'sPrice': 148.32, 'sQty': 5480, 'ltq': 20, 'avgPrice': 148.23, 'quotes': 'Quotes Data', 'ttq': 21831757, 'totalBuyQt': 2187011, 'totalSellQ': 3921071, 'ttv': '323.61C', 'trend': '', 'lowerCktLm': 131.49, 'upperCktLm': 160.71, 'ltt': 'Thu Mar 6 09:56:19 2025', 'close': 146.1, 'exchange': 'NSE Equity', 'stock_name': 'TATA STEEL LIMITED'}
Ticks: {'symbol': '4.1!2885', 'open': 1197, 'last': 1189.2, 'high': 1200.5, 'low': 1185.15, 'change': 1.16, 'bPrice': 1189.05, 'bQty': 223, 'sPrice': 1189.2, 'sQty': 262, 'ltq': 2, 'avgPrice': 1194.58, 'quotes': 'Quotes Data', 'ttq': 4073999, 'totalBuyQt': 515067, 'totalSellQ': 662343, 'ttv': '486.67C', 'trend': '', 'lowerCktLm': 1058.05, 'upperCktLm': 1293.15, 'ltt': 'Thu Mar 6 09:56:19 2025', 'close': 1175.6, 'exchange': 'NSE Equity', 'stock_name': 'RELIANCE INDUSTRIES'}
For unsubscribe : breeze.unsubscribe_feeds(stock_token=['4.1!3499','4.1!2885'])
breeze.subscribe_feeds(get_order_notification=True)View Response
{'message': 'Order Notification subscribed successfully'}For unsubscribe : breeze.unsubscribe_feeds(get_order_notification=True)
- Examples for stock_token are "4.1!38071" or "1.1!500780".
- Template for stock_token : X.Y!
- X : exchange code
- Y : Market Level data
- Token : ISEC stock code
- Value of X can be :
- 1 for BSE(equity)
- 2 for BFO OHLC Data
- 4 for NSE
- 4 for NFO
- 8 for BFO live Data
- Value of Y can be :
- 1 for Exchange Quote data
- 2 for Market Depth data
- Token number can be obtained via get_names() function or downloading master security file via https://api.icicidirect.com/breezeapi/documents/index.html#instruments
- Exchange_code must be
- BSE
- NSE
- BFO
- NFO
- Stock Code Validation: The stock_code field cannot be left empty. Valid examples include "WIPRO" or "ZEEENT".
- Product_type Requirements: Acceptable values are 'Futures', 'Options', or a non-empty string. For exchanges NFO, this field must not be left empty.
- Expiry_date Format: Should be in DD-MMM-YYYY format (e.g., 01-Jan-2022), and cannot be empty for NFO exchanges.
- Strike_price Format: Must be a float value represented as a string or remain empty. For Options under product_type, this field must not be empty.
- Right Field Requirements: Acceptable values are 'Put', 'Call', or an empty string. For Options, this field cannot be left empty.
- get_exchange_quotes and get_market_depth Validation: At least one must be set to True. Both can be True, but both cannot be False.
- OHLCV Streaming Interval: The interval field cannot be empty and must be one of the following values: "1second", "1minute", "5minute", or "30minute".
As per regulatory requirements, market orders are not supported via Breeze API.
Any order marked as a "market" order will instead be placed as an aggressive limit order across Equity and F&O segments.
To increase the probability of execution, the system determines order price using the following logic:
- The Last Traded Price (LTP) is used as the base.
A price range is calculated based on a percentage of LTP for each segment:
| Segment | Percentage Range |
|---|---|
| Equity | 3% above and below LTP |
| Futures | 1.5% above and below LTP |
| Options | 10% above and below LTP |
A minimum difference of 5 points for options and 0.05 for future and equity is ensured (even if the calculated percentage-based result is less than 5/0.05 for the respective segments)|
The final order price must fall within the exchange-defined DPR (Daily Price Range).
- Buy Orders → Placed at a higher price but within DPR limits.
- Sell Orders → Placed at a lower price, but within DPR limits.
LTP: 100
Step 1: Calculate 10% Range
- 10% of 100 = 10
- Range = 100 plus and minus 10 = 90 to 110
Step 2: Check Minimum Difference
- Difference = 10 which is greater than minimum difference of 5, so no change needed
Step 3: Compare with DPR Range
- DPR Range = 95 to 105
- AThe calculated range (90–110) goes beyond DPR limits
Step 4: Final Price
→ For Buy: We choose the higher price, but cannot exceed DPR upper limit
→ Buy Order = 105
→ For Sell: We choose the lower price, but cannot go below DPR lower limit
→ Sell Order = 95
LTP: 40
Step 1: Calculate 10% Range
- 10% of 40 = 4
- Range = 40 plus or minus 4 = 36 to 44
Step 2: Check Minimum Difference
- Difference = 4 (which is less than minimum 5)
- So, we apply minimum difference of 5
Step 3: Adjust Prices using minimum difference
- Buy Price = 40 + 5 = 45
- Sell Price = 40 - 5 = 35
Step 4: Compare with DPR Range
- DPR Range = 34 to 46
- Both 45 and 35 fall within this range
Step 5: Final Price
- Buy Order = 45
- Sell Order = 35
- get_customer_details
- get_demat_holdings
- get_funds
- set_funds
- get_historical_data
- get_historical_data_v2
- get_margin
- place_order
- order_detail
- order_list
- cancel_order
- modify_order
- get_portfolio_holding
- get_portfolio_position
- get_quotes
- get_option_chain_quotes
- square_off
- get_trade_list
- get_trade_detail
- get_names
- preview_order
- limit_calculator
- margin_calculator
- gtt_three_leg_place_order
- gtt_three_leg_modify_order
- gtt_three_leg_cancel_order
- gtt_single_leg_place_order
- gtt_single_leg_modify_order
- gtt_single_leg_cancel_order
- gtt_order_book
breeze.get_customer_details(api_session="your_api_session") View API Response
{
"Success": {
"exg_trade_date": {
"NSE": "04-Feb-2025",
"BSE": "04-Feb-2025",
"FNO": "04-Feb-2025",
"NDX": "12-Feb-2025"
},
"exg_status": {
"NSE": "O",
"BSE": "O",
"FNO": "Y",
"NDX": "X"
},
"segments_allowed": {
"Trading": "Y",
"Equity": "Y",
"Derivatives": "Y",
"Currency": "Z"
},
"idirect_userid": "XY604721",
"session_token": "SNjhweuihjndmsbdhjqgy*",
"idirect_user_name": "JOHN SMITH",
"idirect_ORD_TYP": "N",
"idirect_lastlogin_time": "04-Feb-2025 15:07:17",
"mf_holding_mode_popup_flg": "N",
"commodity_exchange_status": "Y",
"commodity_trade_date": "04-Feb-2025",
"commodity_allowed": "O"
},
"Status": 200,
"Error": null
}
Back to Index
breeze.get_demat_holdings()View API Response
{'Success':
[{'stock_code': 'UNITEC',
'stock_ISIN': 'INE694A01020',
'quantity': '1',
'demat_total_bulk_quantity': '1',
'demat_avail_quantity': '0',
'blocked_quantity': '0',
'demat_allocated_quantity': '1'
}],
'Status': 200,
'Error': None}
Back to Index
breeze.get_funds()View API Response
{'Success':
{'bank_account': '123456789012',
'total_bank_balance': 800000000.0,
'allocated_equity': 200000000.0,
'allocated_fno': 200000000.0,
'allocated_commodity': 200000000.0,
'allocated_currency': 200000000.0,
'block_by_trade_equity': 0.0,
'block_by_trade_fno': 12500000.53,
'block_by_trade_commodity': 0.0,
'block_by_trade_currency': 0.0,
'block_by_trade_balance': 15500000,
'unallocated_balance': '87500000'},
'Status': 200,
'Error': None}
Back to Index
breeze.set_funds(transaction_type="debit",
amount="200",
segment="Equity")View API Response
{'Success': {'status': 'Success'},
'Status': 200, 'Error': None}
- For adding fund, transaction_type="credit", amount="200", segment="Equity".
- Segment can be Equity, FNO, Commodity
breeze.get_historical_data(interval="1minute",
from_date= "2025-02-03T09:21:00.000Z",
to_date= "2025-02-03T09:21:00.000Z",
stock_code="NIFTY",
exchange_code="NFO",
product_type="futures",
expiry_date="2025-02-27T07:00:00.000Z",
right="others",
strike_price="0") View API Response
{'Success': [
{'datetime': '2025-02-03 09:21:00',
'stock_code': 'NIFTY',
'exchange_code': 'NFO',
'product_type': 'Futures',
'expiry_date': '27-FEB-25',
'right': 'Others',
'strike_price': '0',
'open': '23346.6',
'high': '23350.9',
'low': '23338.6',
'close': '23338.6',
'volume': '81600',
'open_interest': '17543475',
'count': 6},
{'datetime': '2025-02-03 09:22:00',
'stock_code': 'NIFTY',
'exchange_code': 'NFO',
'product_type': 'Futures',
'expiry_date': '27-FEB-25',
'right': 'Others',
'strike_price': '0',
'open': '23338.3',
'high': '23347.95',
'low': '23337.1',
'close': '23342',
'volume': '56025',
'open_interest': '17543475',
'count': 7}],
'Status': 200,
'Error': None}
- The historical data provided does not account for corporate adjusted data.
Back to Index
breeze.get_historical_data(interval="1minute",
from_date= "2025-02-03T09:20:00.000Z",
to_date= "2025-02-03T09:22:00.000Z",
stock_code="RELIND",
exchange_code="NSE",
product_type="cash")View API Response
{'Success': [
{'datetime': '2025-02-03 09:21:00',
'stock_code': 'RELIND',
'exchange_code': 'NSE',
'product_type': None,
'expiry_date': None,
'right': None,
'strike_price': None,
'open': '1249.85',
'high': '1250.75',
'low': '1248.95',
'close': '1249.95',
'volume': '1951',
'open_interest': None,
'count': 7},
{'datetime': '2025-02-03 09:22:00',
'stock_code': 'RELIND',
'exchange_code': 'NSE',
'product_type': None,
'expiry_date': None,
'right': None,
'strike_price': None,
'open': '1249.75',
'high': '1250.5',
'low': '1247.95',
'close': '1249',
'volume': '1810',
'open_interest': None,
'count': 8}],
'Status': 200,
'Error': None}
- The historical data provided does not account for corporate adjusted data.
Back to Index
breeze.get_historical_data(interval="1minute",
from_date= "2025-02-03T09:20:00.000Z",
to_date= "2025-02-03T09:22:00.000Z",
stock_code="NIFTY",
exchange_code="NFO",
product_type="options",
expiry_date="2025-02-06T07:00:00.000Z",
right="call",
strike_price="23200")View API Response
{'Success': [
{'datetime': '2025-02-03 09:21:00',
'stock_code': 'NIFTY',
'exchange_code': 'NFO',
'product_type': 'Options',
'expiry_date': '06-FEB-25',
'right': 'Call',
'strike_price': '23200',
'open': '201.15',
'high': '203.9',
'low': '195.5',
'close': '197.55',
'volume': '304575',
'open_interest': '2435175',
'count': 6},
{'datetime': '2025-02-03 09:22:00',
'stock_code': 'NIFTY',
'exchange_code': 'NFO',
'product_type': 'Options',
'expiry_date': '06-FEB-25',
'right': 'Call',
'strike_price': '23200',
'open': '196.85',
'high': '201.8',
'low': '196.5',
'close': '200.3',
'volume': '249000',
'open_interest': '2435175',
'count': 7}],
'Status': 200,
'Error': None}
- Get Historical Data for specific stock-code by mentioned interval either as "1minute", "5minute", "30minute" or as "1day"
- The historical data provided does not account for corporate adjusted data.
breeze.get_historical_data_v2(interval="1minute",
from_date= "2025-02-03T09:21:00.000Z",
to_date= "2025-02-03T09:21:00.000Z",
stock_code="NIFTY",
exchange_code="NFO",
product_type="futures",
expiry_date="2025-02-27T07:00:00.000Z",
right="others",
strike_price="0") View API Response
{'Error': None,
'Status': 200,
'Success': [{'close': 23338.6,
'datetime': '2025-02-03 09:21:00',
'exchange_code': 'NFO',
'expiry_date': '27-FEB-2025',
'high': 23352.15,
'low': 23337.95,
'open': 23348.0,
'open_interest': 17543475,
'product_type': 'Futures',
'stock_code': 'NIFTY',
'volume': 88800}]}
- Product Type historical data v2 should be "futures", "options","cash"
- Interval should be "1minute", "5minute", "30minute" or "1day"
- The historical data provided does not account for corporate adjusted data.
breeze.get_historical_data_v2(interval="1minute",
from_date= "2025-02-03T09:20:00.000Z",
to_date= "2025-02-03T09:22:00.000Z",
stock_code="RELIND",
exchange_code="NSE",
product_type="cash")View API Response
{'Error': None,
'Status': 200,
'Success': [{'close': 1250.0,
'datetime': '2025-02-03 09:20:00',
'exchange_code': 'NSE',
'high': 1250.9,
'low': 1248.2,
'open': 1248.2,
'stock_code': 'RELIND',
'volume': 47317},
{'close': 1249.15,
'datetime': '2025-02-03 09:21:00',
'exchange_code': 'NSE',
'high': 1250.5,
'low': 1248.95,
'open': 1250.0,
'stock_code': 'RELIND',
'volume': 54277},
{'close': 1248.9,
'datetime': '2025-02-03 09:22:00',
'exchange_code': 'NSE',
'high': 1249.7,
'low': 1247.95,
'open': 1248.95,
'stock_code': 'RELIND',
'volume': 38527}]}
- The historical data provided does not account for corporate adjusted data.
Back to Index
breeze.get_historical_data_v2(interval="1minute",
from_date= "2025-02-03T09:20:00.000Z",
to_date= "2025-02-03T09:21:00.000Z",
stock_code="NIFTY",
exchange_code="NFO",
product_type="options",
expiry_date="2025-02-06T07:00:00.000Z",
right="call",
strike_price="23200")View API Response
{'Error': None,
'Status': 200,
'Success': [{'close': 201.85,
'datetime': '2025-02-03 09:20:00',
'exchange_code': 'NFO',
'expiry_date': '06-FEB-2025',
'high': 208.1,
'low': 201.8,
'open': 206.75,
'open_interest': 2203575,
'product_type': 'Options',
'right': 'Call',
'stock_code': 'NIFTY',
'strike_price': 23200.0,
'volume': 207825},
{'close': 197.55,
'datetime': '2025-02-03 09:21:00',
'exchange_code': 'NFO',
'expiry_date': '06-FEB-2025',
'high': 203.9,
'low': 195.5,
'open': 200.45,
'open_interest': 2435175,
'product_type': 'Options',
'right': 'Call',
'stock_code': 'NIFTY',
'strike_price': 23200.0,
'volume': 342450}]}
- Get Historical Data (version 2) for specific stock-code by mentioning interval either as "1second","1minute", "5minute", "30minute" or as "1day".
- Maximum candle intervals in one single request is 1000
- The historical data provided does not account for corporate adjusted data.
Back to Index
breeze.get_margin(exchange_code="NSE")View API Response
{'Success': {'limit_list': [],
'cash_limit': 1000000.00,
'amount_allocated': 100000.00,
'block_by_trade': 0.0,
'isec_margin': 0.0},
'Status': 200,
'Error': None}
- Please change exchange_code=“NFO” to get F&O margin details
Back to Index
breeze.place_order(stock_code="NIFTY",
exchange_code="NFO",
product="futures",
action="buy",
order_type="limit",
stoploss="0",
quantity="75",
price="23700",
validity="day",
validity_date="2022-08-22T06:00:00.000Z",
disclosed_quantity="0",
expiry_date="2025-02-27T06:00:00.000Z",
right="others",
strike_price="0",
user_remark="Test")View API Response
{'Success':
{'order_id': '202502051400001234',
'message': 'Successfully Placed the order',
'user_remark': ''},
'Status': 200,
'Error': None}
- Order Type should be "limit"
- The validity_date parameter has no impact on the order execution and even if you pass it while placing the order, it will be excluded from order processing.
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", placing market orders through the Breeze API is not permitted. You are required to place limit orders instead of market order but any order marked as a “market” order will instead be placed as an ‘aggressive limit order’ across Equity and F&O segments. For more information Aggressive Limit order
breeze.place_order(stock_code="NIFTY",
exchange_code="NFO",
product="options",
action="buy",
order_type="limit",
stoploss="",
quantity="75",
price="0.20",
validity="day",
validity_date="2025-02-05T06:00:00.000Z",
disclosed_quantity="0",
expiry_date="2025-02-27T06:00:00.000Z",
right="call",
strike_price="24800")View API Response
{'Success': {'order_id': '202502051400001234',
'message': 'Successfully Placed the order',
'user_remark': ''},
'Status': 200,
'Error': None}
- Order Type should be "limit"
- The validity_date parameter has no impact on the order execution and even if you pass it while placing the order, it will be excluded from order processing.
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", placing market orders through the Breeze API is not permitted. You are required to place limit orders instead of market orders but any order marked as a “market” order will instead be placed as an ‘aggressive limit order’ across Equity and F&O segments. For more information Aggressive Limit order
Back to Index
breeze.place_order(stock_code="ITC",
exchange_code="NSE",
product="cash",
action="buy",
order_type="limit",
stoploss="",
quantity="1",
price="420",
validity="day"
)View API Response
{'Success':
{'order_id': '20250205N30001234',
'message': 'Equity CASH Order placed successfully through RI reference no 20250205N300001234',
'user_remark': None},
'Status': 200,
'Error': None}
- The validity_date parameter has no impact on the order execution and even if you pass it while placing the order, it will be excluded from order processing.
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", placing market orders through the Breeze API is not permitted. You are required to place limit orders instead of market orders but any order marked as a “market” order will instead be placed as an ‘aggressive limit order’ across Equity and F&O segments. For more information Aggressive Limit order
Back to Index
breeze.get_order_detail(exchange_code="NSE",
order_id="20250205N300001234")View API Response
{'Success': [
{'order_id': '20250205N300001234',
'exchange_order_id': None,
'exchange_code': 'NSE',
'stock_code': 'ITC',
'product_type': 'Cash',
'action': 'Buy',
'order_type': 'Limit',
'stoploss': '0.00',
'quantity': '1',
'price': '420.00',
'validity': 'Day',
'disclosed_quantity': '0',
'expiry_date': None,
'right': None,
'strike_price': 0.0,
'average_price': '0',
'cancelled_quantity': '0',
'pending_quantity': '1',
'status': 'Ordered',
'user_remark': '',
'order_datetime': '05-Feb-2025 09:26',
'parent_order_id': None,
'modification_number': None,
'exchange_acknowledgement_date': None,
'SLTP_price': None,
'exchange_acknowledge_number': None,
'initial_limit': None,
'intial_sltp': None,
'LTP': None,
'limit_offset': None,
'mbc_flag': None,
'cutoff_price': None,
'validity_date': ''}],
'Status': 200,
'Error': None}
- Please change exchange_code=“NFO” to get details about F&O
breeze.get_order_list(exchange_code="NSE",
from_date="2025-02-05T10:00:00.000Z",
to_date="2025-02-05T10:00:00.000Z")View API Response
{'Success': [
{'order_id': '20250205N300001234',
'exchange_order_id': None,
'exchange_code': 'NSE',
'stock_code': 'ITC',
'product_type': 'Cash',
'action': 'Buy',
'order_type': 'Limit',
'stoploss': '0.00',
'quantity': '1',
'price': '420.00',
'validity': 'Day',
'disclosed_quantity': '0',
'expiry_date': None,
'right': None,
'strike_price': 0.0,
'average_price': '0',
'cancelled_quantity': '0',
'pending_quantity': '1',
'status': 'Ordered',
'user_remark': '',
'order_datetime': '05-Feb-2025 09:26',
'parent_order_id': None,
'modification_number': None,
'exchange_acknowledgement_date': None,
'SLTP_price': None,
'exchange_acknowledge_number': None,
'initial_limit': None,
'intial_sltp': None,
'LTP': None,
'limit_offset': None,
'mbc_flag': None,
'cutoff_price': None,
'validity_date': ''}],
'Status': 200,
'Error': None}
- Please change exchange_code=“NFO” to get details about F&O
breeze.cancel_order(exchange_code="NSE",
order_id="20250205N300001234")View API Response
{'Success':
{'order_id': '20250205N300001234',
'message': 'Your Order Canceled successfully.'},
'Status': 200,
'Error': None}
Back to Index
breeze.modify_order(order_id="202502051400012345",
exchange_code="NFO",
order_type="limit",
stoploss="0",
quantity="75",
price="0.30",
validity="day",
disclosed_quantity="0",
validity_date="2025-08-22T06:00:00.000Z")View API Response
{'Success':
{'message': 'Successfully Modified the order',
'order_id': '202502051400012345'},
'Status': 200,
'Error': None}
- The validity_date parameter has no impact on the modification of the order and even if you pass it while modifying the order, it will be excluded from order modification processing.
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", modifying to market orders through the Breeze API is not permitted. You are required to modify to limit orders instead of market orders but any order marked as a “market” order will instead be modified as an ‘aggressive limit order’ across Equity and F&O segments. For more information Aggressive Limit order
Back to Index
breeze.get_portfolio_holdings(exchange_code="NFO",
from_date="2024-08-01T06:00:00.000Z",
to_date="2024-09-19T06:00:00.000Z",
stock_code="",
portfolio_type="")View API Response
{'Success':[
{'stock_code': 'NIFTY',
'exchange_code': 'NFO',
'quantity': '0',
'average_price': '0',
'booked_profit_loss': None,
'current_market_price': '0',
'change_percentage': None,
'answer_flag': None,
'product_type': 'Options',
'expiry_date': '01-Aug-2024',
'strike_price': '25200',
'right': 'Call',
'category_index_per_stock':'I',
'action': 'NA',
'realized_profit': '-349.26',
'unrealized_profit': '0',
'open_position_value': '0',
'portfolio_charges': '5.51'}],
'Status': 200,
'Error': None}
- Please change exchange_code=“NSE” to get Equity Portfolio Holdings
breeze.get_portfolio_positions()View API Response
{'Success': [{'segment': 'fno',
'product_type': 'Options',
'exchange_code': 'NFO',
'stock_code': 'NIFTY',
'expiry_date': '27-Feb-2025',
'strike_price': '24800',
'right': 'Call',
'action': 'NA',
'quantity': '0',
'average_price': '0',
'settlement_id': None,
'margin_amount': None,
'ltp': '29.95',
'price': '28.85',
'stock_index_indicator': 'Index',
'cover_quantity': '0',
'stoploss_trigger': '0',
'stoploss': None,
'take_profit': None,
'available_margin': None,
'squareoff_mode': None,
'mtf_sell_quantity': None,
'mtf_net_amount_payable': None,
'mtf_expiry_date': None,
'order_id': '',
'cover_order_flow': None,
'cover_order_executed_quantity': None,
'pledge_status': None,
'pnl': None,
'underlying': 'NIFTY',
'order_segment_code': None}],
'Status': 200,
'Error': None}
Back to Index
breeze.get_quotes(stock_code="NIFTY",
exchange_code="NFO",
expiry_date="2025-02-27T06:00:00.000Z",
product_type="futures",
right="others",
strike_price="0")View API Response
{'Success': [{'exchange_code': 'NFO',
'product_type': 'Future',
'stock_code': 'NIFTY',
'expiry_date': '27-Feb-2025',
'right': '*',
'strike_price': 0.0,
'ltp': 23832.85,
'ltt': '05-Feb-2025 09:36:56',
'best_bid_price': 23832.0,
'best_bid_quantity': '1500',
'best_offer_price': 23833.8,
'best_offer_quantity': '150',
'open': 23825.0,
'high': 23840.6,
'low': 23808.0,
'previous_close': 23785.4,
'ltp_percent_change': 0.2,
'upper_circuit': 26163.95,
'lower_circuit': 21406.9,
'total_quantity_traded': '623325',
'spot_price': '23783.7'}],
'Status': 200,
'Error': None}
- For equity, exchange_code = "NSE", expiry_date = "", product_type = "cash", right="", strike_price=""
- For options, exchange_code = "NFO", expiry_date = "27-Feb-2025", product_type = "options", right="call/put", strike_price="24000"
breeze.get_option_chain_quotes(stock_code="ICIBAN",
exchange_code="NFO",
product_type="options",
right="call",
expiry_date="2025-08-28T06:00:00.000Z")View API Response
{'Success': [{'exchange_code': 'NFO',
'product_type': 'Options',
'stock_code': 'ICIBAN',
'expiry_date': '28-Aug-2025',
'right': 'Call',
'strike_price': 760.0,
'ltp': 0.0,
'ltt': '',
'best_bid_price': 0.0,
'best_bid_quantity': '0',
'best_offer_price': 0.0,
'best_offer_quantity': '0',
'open': 0.0,
'high': 0.0,
'low': 0.0,
'previous_close': 0.0,
'ltp_percent_change': 0.0,
'upper_circuit': 712.4,
'lower_circuit': 613.0,
'total_quantity_traded': '0',
'spot_price': '1424.4',
'ltq': '0',
'open_interest': 0.0,
'chnge_oi': 0.0,
'total_buy_qty': '0',
'total_sell_qty': '0'},
{'exchange_code': 'NFO',
'product_type': 'Options',
'stock_code': 'ICIBAN',
'expiry_date': '28-Aug-2025',
'right': 'Call',
'strike_price': 780.0,
'ltp': 0.0,
'ltt': '',
'best_bid_price': 0.0,
'best_bid_quantity': '0',
'best_offer_price': 0.0,
'best_offer_quantity': '0',
'open': 0.0,
'high': 0.0,
'low': 0.0,
'previous_close': 0.0,
'ltp_percent_change': 0.0,
'upper_circuit': 692.45,
'lower_circuit': 593.05,
'total_quantity_traded': '0',
'spot_price': '1424.4',
'ltq': '0',
'open_interest': 0.0,
'chnge_oi': 0.0,
'total_buy_qty': '0',
'total_sell_qty': '0'}], 'Status': 200, 'Error': None}
- Get option-chain of mentioned stock-code for product-type Options where atleast 2 input is required out of expiry-date, right and strike-price
breeze.get_option_chain_quotes(stock_code="ICIBAN",
exchange_code="NFO",
product_type="options",
right="put",
expiry_date="2025-08-28T06:00:00.000Z")View API Response
{'Success': [{'exchange_code': 'NFO',
'product_type': 'Options',
'stock_code': 'ICIBAN',
'expiry_date': '28-Aug-2025',
'right': 'Put',
'strike_price': 760.0,
'ltp': 0.0,
'ltt': '',
'best_bid_price': 0.0,
'best_bid_quantity': '0',
'best_offer_price': 0.0,
'best_offer_quantity': '0',
'open': 0.0,
'high': 0.0,
'low': 0.0,
'previous_close': 0.0,
'ltp_percent_change': 0.0,
'upper_circuit': 20.05,
'lower_circuit': 0.05,
'total_quantity_traded': '0',
'spot_price': '1430.1',
'ltq': '0',
'open_interest': 0.0,
'chnge_oi': 0.0,
'total_buy_qty': '0',
'total_sell_qty': '0'},
{'exchange_code': 'NFO',
'product_type': 'Options',
'stock_code': 'ICIBAN',
'expiry_date': '28-Aug-2025',
'right': 'Put',
'strike_price': 780.0,
'ltp': 0.0,
'ltt': '',
'best_bid_price': 0.0,
'best_bid_quantity': '0',
'best_offer_price': 0.0,
'best_offer_quantity': '0',
'open': 0.0,
'high': 0.0,
'low': 0.0,
'previous_close': 0.0,
'ltp_percent_change': 0.0,
'upper_circuit': 20.05,
'lower_circuit': 0.05,
'total_quantity_traded': '0',
'spot_price': '1430.1',
'ltq': '0',
'open_interest': 0.0,
'chnge_oi': 0.0,
'total_buy_qty': '0',
'total_sell_qty': '0'}], 'Status': 200, 'Error': None}
- Get option-chain of mentioned stock-code for product-type Options where atleast 2 input is required out of expiry-date, right and strike-price
Back to Index
breeze.square_off(exchange_code="NFO",
product="options",
stock_code="NIFTY",
expiry_date="2025-02-27T06:00:00.000Z",
right="Call",
strike_price="24000",
action="sell",
order_type="market",
validity="day",
stoploss="0",
quantity="75",
price="0",
validity_date="2025-02-05T06:00:00.000Z",
trade_password="",
disclosed_quantity="0")View API Response
{'Success':
{'order_id': '202502052500001234',
'message': 'Successfully Placed the order',
'indicator': '0'},
'Status': 200,
'Error': None}
- The validity_date parameter has no impact on the square off order execution and even if you pass it while squaring off the position, it will be excluded from square off order processing.
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", squaring off orders to market orders through the Breeze API is not permitted. You are required to place limit or stoploss order instead of market orders but any order marked as a “market” order will instead be placed as an ‘aggressive limit order’ across Equity and F&O segments. For more information Aggressive Limit order
Back to Index
breeze.square_off(exchange_code="NFO",
product="futures",
stock_code="NIFTY",
expiry_date="2025-02-27T06:00:00.000Z",
action="sell",
order_type="market",
validity="day",
stoploss="0",
quantity="75",
price="0",
validity_date="2025-02-27T06:00:00.000Z",
trade_password="",
disclosed_quantity="0")View API Response
{'Success': {'order_id': '202502052500001234',
'message': 'Successfully Placed the order',
'indicator': '0'},
'Status': 200,
'Error': None}
- The validity_date parameter has no impact on the square off order execution and even if you pass it while squaring off the position, it will be excluded from square off order processing.
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", squaring off orders to market orders through the Breeze API is not permitted. You are required to place limit or stoploss order instead of market orders but any order marked as a “market” order will instead be placed as an ‘aggressive limit order’ across Equity and F&O segments. For more information Aggressive Limit order
Back to Index
breeze.get_trade_list(from_date="2025-02-05T06:00:00.000Z",
to_date="2025-02-05T06:00:00.000Z",
exchange_code="NSE",
product_type="",
action="",
stock_code="")View API Response
{'Success': [{'book_type': 'Trade-Book',
'trade_date': '05-Feb-2025',
'stock_code': 'ITC',
'action': 'Buy',
'quantity': '1',
'average_cost': '452.20',
'brokerage_amount': '0.00',
'product_type': 'Margin',
'exchange_code': 'NSE',
'order_id': '20250205N300012345',
'segment': 'M',
'settlement_code': '2025027',
'dp_id': 'IN1234566',
'client_id': '12345678',
'ltp': '451.95',
'eatm_withheld_amount': '0.00',
'cash_withheld_amount': '0.00',
'total_taxes': '0.00',
'order_type': 'Market',
'expiry_date': None,
'right': None,
'strike_price': None},
{'book_type': 'Trade-Book',
'trade_date': '05-Feb-2025',
'stock_code': 'ITC',
'action': 'Sell',
'quantity': '1',
'average_cost': '452.55',
'brokerage_amount': '0.00',
'product_type': 'Margin',
'exchange_code': 'NSE',
'order_id': '20250205N300012345',
'segment': 'M',
'settlement_code': '2025012',
'dp_id': 'IN1234566',
'client_id': '12345678',
'ltp': '451.95',
'eatm_withheld_amount': '0.00',
'cash_withheld_amount': '0.00',
'total_taxes': '0.00',
'order_type': 'Market',
'expiry_date': None,
'right': None,
'strike_price': None}],
'Status': 200,
'Error': None}
- Please change exchange_code=“NFO” to get details about F&O
breeze.get_trade_detail(exchange_code="NSE",
order_id="20250205N300012345")View API Response
{'Success': [{'settlement_id': '1234567',
'exchange_trade_id': '123456789',
'executed_quantity': '1',
'action': 'B',
'total_transaction_cost': '0',
'brokerage_amount': '0',
'taxes': '0',
'eatm_withheld_amount': '0',
'cash_withheld_amount': '0',
'execution_price': '452.2',
'stock_code': 'ITC',
'exchange_code': 'NSE',
'trade_id': '2025/1234/12345678',
'exchange_trade_time': '05-Feb-2025 10:41:24'}],
'Status': 200,
'Error': None}
- Please change exchange_code=“NFO” to get details about F&O
breeze.get_names(exchange_code = 'NSE',stock_code = 'TATASTEEL')View API Response
{'exchange_code': 'NSE',
'exchange_stock_code': 'TATASTEEL',
'isec_stock_code': 'TATSTE',
'isec_token': '3499',
'company name': 'TATA STEEL LIMITED',
'isec_token_level1': '4.1!3499',
'isec_token_level2': '4.2!3499'}
- Use this method to find ICICI specific stock codes / token
breeze.preview_order(stock_code = "ITC",
exchange_code = "NSE",
product = "margin",
order_type = "limit",
price = "440",
action = "buy",
quantity = "1",
specialflag = "N")View API Response
{'Success': {'brokerage': 0.31,
'exchange_turnover_charges': 0.01,
'stamp_duty': 0.07,
'stt': 0.44,
'sebi_charges': 0.0,
'gst': 0.06,
'total_turnover_and_sebi_charges': 0.01,
'total_other_charges': 0.58,
'total_brokerage': 0.89},
'Status': 200,
'Error': None}
Back to Index
breeze.limit_calculator(strike_price="24000",
product_type = "options",
expiry_date = "06-Feb-2025",
underlying = "NIFTY",
exchange_code = "NFO",
order_flow = "Buy",
stop_loss_trigger = "8",
option_type = "Call",
source_flag = "P",
limit_rate = "7.5",
order_reference = "",
available_quantity = "",
market_type = "limit",
fresh_order_limit = "10.95")View API Response
{'Success':
{'available_quantity': '0',
'action_id': '0',
'order_margin': '0',
'limit_rate': '16'},
'Status': 200,
'Error': None}
Back to Index
breeze.margin_calculator([{
"strike_price": "0",
"quantity": "30",
"right": "others",
"product": "futures",
"action": "buy",
"price": "49500",
"expiry_date": "27-Feb-2025",
"stock_code": "CNXBAN",
"cover_order_flow": "N",
"fresh_order_type": "N",
"cover_limit_rate": "0",
"cover_sltp_price": "0",
"fresh_limit_rate": "0",
"open_quantity": "0"
},
{
"strike_price": "50000",
"quantity": "30",
"right": "Call",
"product": "options",
"action": "buy",
"price": "1150",
"expiry_date": "27-Feb-2025",
"stock_code": "CNXBAN",
"cover_order_flow": "N",
"fresh_order_type": "N",
"cover_limit_rate": "0",
"cover_sltp_price": "0",
"fresh_limit_rate": "0",
"open_quantity": "0"
},
{
"strike_price": "0",
"quantity": "75",
"right": "others",
"product": "futures",
"action": "buy",
"price": "23400",
"expiry_date": "27-Feb-2025",
"stock_code": "NIFTY",
"cover_order_flow": "N",
"fresh_order_type": "N",
"cover_limit_rate": "0",
"cover_sltp_price": "0",
"fresh_limit_rate": "0",
"open_quantity": "0"
},
{
"strike_price": "23400",
"quantity": "75",
"right": "call",
"product": "options",
"action": "buy",
"price": "577",
"expiry_date": "27-Feb-2025",
"stock_code": "NIFTY",
"cover_order_flow": "sell",
"fresh_order_type": "limit",
"cover_limit_rate": "0",
"cover_sltp_price": "0",
"fresh_limit_rate": "0",
"open_quantity": "0"
}],exchange_code = "NFO")View API Response
{'Success': {'margin_calulation': [{'strike_price': '0',
'quantity': '30',
'right': 'Others',
'product': 'Futures',
'action': 'Buy',
'price': '49500',
'expiry_date': '27-Feb-2025',
'stock_code': 'CNXBAN'},
{'strike_price': '50000',
'quantity': '30',
'right': 'Call',
'product': 'Options',
'action': 'Buy',
'price': '1150',
'expiry_date': '27-Feb-2025',
'stock_code': 'CNXBAN'},
{'strike_price': '0',
'quantity': '75',
'right': 'Others',
'product': 'Futures',
'action': 'Buy',
'price': '23400',
'expiry_date': '27-Feb-2025',
'stock_code': 'NIFTY '},
{'strike_price': '23400',
'quantity': '75',
'right': 'Call',
'product': 'Options',
'action': 'Buy',
'price': '577',
'expiry_date': '27-Feb-2025',
'stock_code': 'NIFTY '}],
'non_span_margin_required': '0',
'order_value': '493011.26',
'order_margin': '0',
'trade_margin': None,
'block_trade_margin': '0',
'span_margin_required': '493011.26'},
'Status': 200,
'Error': None}
Back to Index
breeze.gtt_three_leg_place_order(exchange_code ="NFO",
stock_code="NIFTY",
product="options",
quantity = "75",
expiry_date="2025-02-06T06:00:00.00Z",
right = "call",
strike_price = "24000",
gtt_type="cover_oco",
fresh_order_action="buy",
fresh_order_price="8",
fresh_order_type="limit",
index_or_stock="index",
trade_date="2025-02-05T06:00:00.00Z",
order_details=[
{
"gtt_leg_type" : "target",
"action" : "sell",
"limit_price" : "15",
"trigger_price" : "14.50"
},
{
"gtt_leg_type" : "stoploss",
"action" : "sell",
"limit_price" : "7",
"trigger_price" : "7.5"
},
])View API Response
{'Success':
{'gtt_order_id': '2025020500001234',
'message': 'Your GTT Order Request Placed Successfully'},
'Status': 200,
'Error': None}
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", placing market orders through the Breeze API is not permitted. You are required to place limit orders instead of market orders.
Back to Index
breeze.gtt_three_leg_modify_order(exchange_code = "NFO",
gtt_order_id = "2025020500001234",
gtt_type ="oco",
order_details = [
{
"gtt_leg_type" : "target",
"action" : "sell",
"limit_price" : "12",
"trigger_price" : "11.50"
},
{
"gtt_leg_type" : "stoploss",
"action" : "sell",
"limit_price" : "4",
"trigger_price" : "5"
}])View API Response
{'Success':
{'gtt_order_id': '2025020500001234',
'message': 'Order Modified Successfully'},
'Status': 200,
'Error': None}
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", modifying market orders through the Breeze API is not permitted. You are required to modify limit orders instead of market orders.
Back to Index
breeze.gtt_three_leg_cancel_order(exchange_code = "NFO",
gtt_order_id = "2025020500001234")View API Response
{'Success':
{'gtt_order_id': '2025020500001234',
'message': 'Your request for order cancellation successfully submitted !'},
'Status': 200,
'Error': None}
Back to Index
breeze.gtt_single_leg_place_order(exchange_code ="NFO",
stock_code="NIFTY",
product="options",
quantity = "75",
expiry_date="2025-02-06T06:00:00.00Z",
right = "call",
strike_price = "24000",
gtt_type="single",
index_or_stock="index",
trade_date="2025-02-05T06:00:00.00Z",
order_details=[
{
"action" : "buy",
"limit_price" : "7",
"trigger_price" : "8"
}])View API Response
{'Success':
{'gtt_order_id': '2025020500001234',
'message': 'Your GTT Order Request Placed Successfully'},
'Status': 200,
'Error': None}
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", placing market orders through the Breeze API is not permitted. You are required to place limit orders instead of market orders.
Back to Index
breeze.gtt_single_leg_modify_order(exchange_code="NFO",
gtt_order_id="2025020500001234",
gtt_type="single",
order_details=[
{
"action": "buy",
"limit_price": "6",
"trigger_price": "7"
}])View API Response
{'Success':
{'gtt_order_id': '2025020500001234',
'message': 'Order Modified Successfully'},
'Status': 200,
'Error': None}
- As per SEBI circular, "Safer participation of retail investors in Algorithmic trading", modifying market orders through the Breeze API is not permitted. You are required to modify limit orders instead of market orders.
Back to Index
breeze.gtt_single_leg_cancel_order(exchange_code = "NFO",
gtt_order_id = "2025011500003608")View API Response
{'Success':
{'gtt_order_id': '2025020500001234',
'message': 'Your request for order cancellation successfully submitted !'},
'Status': 200,
'Error': None}Back to Index
breeze.gtt_order_book(exchange_code ="NFO",
from_date = "2025-02-05T06:00:00.00Z",
to_date = "2025-02-05T06:00:00.00Z")View API Response
{'Success': [{'order_details': [{'gtt_leg_type': None,
'action': 'Buy',
'trigger_price': 7.0,
'limit_price': 6.0,
'status': 'Cancelled',
'gtt_order_id': '2025020500001234'}],
'exchange_code': 'NFO',
'product_type': 'Options',
'stock_code': 'NIFTY',
'expiry_date': '06-Feb-2025',
'strike_price': 24000.0,
'right': 'Call',
'quantity': 75,
'index_or_stock': 'Index',
'gtt_type': 'Single',
'fresh_order_id': None,
'order_datetime': '05-FEB-2025 11:19:32'},
{'order_details': [{'gtt_leg_type': 'Target',
'action': 'Sell',
'trigger_price': 11.5,
'limit_price': 12.0,
'status': 'Cancelled',
'gtt_order_id': '2025020500001234'},
{'gtt_leg_type': 'Stoploss',
'action': 'Sell',
'trigger_price': 5.0,
'limit_price': 4.0,
'status': 'Cancelled',
'gtt_order_id': '2025020500001234'}],
'exchange_code': 'NFO',
'product_type': 'Options',
'stock_code': 'NIFTY',
'expiry_date': '06-Feb-2025',
'strike_price': 24000.0,
'right': 'Call',
'quantity': 75,
'index_or_stock': 'Index',
'gtt_type': 'Cover OCO',
'fresh_order_id': '202502052500001234',
'order_datetime': '05-FEB-2025 11:14:38'}],
'Status': 200,
'Error': None}
Back to Index
- Version 1.0.57: BFO integration
- Version 1.0.58: GIFT NIFTY integration
- Version 1.0.60: GTT integration
- Version 1.0.61: README.md file updation
- Version 1.0.62: API USAGE addition
- Version 1.0.65: Master file Switch
- Version 1.0.68: Aggressive Limit Order