Idirect-Tech / Breeze-Python-SDK

The official Python client library for the ICICI Securities trading APIs
MIT License
60 stars 30 forks source link

Multi stream subscription #36

Closed tatiyabichhoo closed 1 year ago

tatiyabichhoo commented 1 year ago

Is there a method/way to subscribe to candle stick streaming data for multiple stocks and option. Methods given in examples only covers single stock and that only for option. Please give example to add multiple stock for streaming. For example : we should be able to subscribe to RELIANCE, TCS AND NIFTY FUT for 1 min candle stick streaming data.

Idirect-Tech commented 1 year ago

Dear,

Please find the below code to subscribe multiple feeds.

import time from breeze_connect import BreezeConnect from datetime import datetime, timedelta key_api = "" key_secret = "" key_session = "" breeze = BreezeConnect(api_key=key_api) breeze.generate_session(api_secret=key_secret, session_token=key_session)

Connect to websocket(it will connect to tick-by-tick data server)

breeze.ws_connect()

Callback to receive ticks.

def on_ticks(ticks): data.append(ticks) print("Ticks: {}".format(ticks))

Assign the callbacks.

breeze.on_ticks = on_ticks

breeze.subscribe_feeds(stock_token=['4.1!42692','4.1!35014'])

For more details, please follow the below documentation.

https://api.icicidirect.com/breezeapi/documents/index.html#candle-data-live-streamliveohlcv

https://traderweb.icicidirect.com/Content/File/txtFile/ScripFile/StockScriptNew.csv

[E29CF836]

Thanks & Regards,

Amrit Mohanty,

API & Algo Products,

Derivatives, EPG

ICICI Securities


From: tatiyabichhoo @.> Sent: Friday, July 14, 2023 3:38 PM To: Idirect-Tech/Breeze-Python-SDK @.> Cc: Subscribed @.***> Subject: [Idirect-Tech/Breeze-Python-SDK] Multi stream subscription (Issue #36)

External Email Warning: Use 'Report suspicious Email' button to report Phishing mails. Do not click on any attachment or links/URL in this email unless sender is reliable.

Is there a method/way to subscribe to candle stick streaming data for multiple stocks and option. Methods given in examples only covers single stock and that only for option. Please give example to add multiple stock for streaming. For example : we should be able to subscribe to RELIANCE, TCS AND NIFTY FUT for 1 min candle stick streaming data.

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-Python-SDK/issues/36, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ43RSBP4AEAD6GHUUHDXQELAJANCNFSM6AAAAAA2KD2CHA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Print this mail only if absolutely necessary. Save Paper. Save Trees." "The information contained in this e-mail and any attachments to this message are intended for the exclusive use of the intended recipient and may contain proprietary, confidential or legally privileged information. If you are not the intended recipient, please note that you are not authorised to disseminate, distribute or copy this e-mail or any parts of it or act upon/rely on the contents of this e-mail in any manner. Please notify the sender immediately by e-mail and destroy all copies of this e-mail and any attachments. Please also note that ICICI Bank or its subsidiaries and associated companies, (collectively "ICICI Group"), are unable to exercise control or ensure the integrity of/over the contents of the information contained in e-mail transmissions and that any views expressed in this e-mail are not endorsed by/binding on the ICICI Group unless the sender does so expressly with due authority of ICICI Group. Before opening any attachments please check them for viruses and defects and please note that ICICI Group accepts no liability or responsibility for any damage caused by any virus that may be transmitted by this email. Any unauthorized use of this email or any attachment(s) may be treated as infringement of right(s) including right of privacy under the applicable laws of India including Information and Technology Act, 2000. Thank you for your cooperation. Regulatory Disclosures are available on https://www.icicisecurities.com (for institutional business) and www.icicidirect.com (for retail business).

Idirect-Tech commented 1 year ago

Dear,

Please find the below code to subscribe multiple feeds.

import time from breeze_connect import BreezeConnect from datetime import datetime, timedelta key_api = "" key_secret = "" key_session = "" breeze = BreezeConnect(api_key=key_api) breeze.generate_session(api_secret=key_secret, session_token=key_session)

Connect to websocket(it will connect to tick-by-tick data server)

breeze.ws_connect()

Callback to receive ticks.

def on_ticks(ticks): data.append(ticks) print("Ticks: {}".format(ticks))

Assign the callbacks.

breeze.on_ticks = on_ticks

breeze.subscribe_feeds(stock_token=['4.1!42692','4.1!35014'])

For more details, please follow the below documentation.

https://api.icicidirect.com/breezeapi/documents/index.html#candle-data-live-streamliveohlcv

https://traderweb.icicidirect.com/Content/File/txtFile/ScripFile/StockScriptNew.csv

[E29CF836]

Thanks & Regards,

Amrit Mohanty,

API & Algo Products,

Derivatives, EPG

ICICI Securities


From: Amrit Mohanty /EPG/ISEC/NAVI MUMBAI @.> Sent: Monday, July 17, 2023 11:10 AM To: Idirect-Tech/Breeze-Python-SDK @.>; Idirect-Tech/Breeze-Python-SDK @.> Cc: Subscribed @.> Subject: Re: [Idirect-Tech/Breeze-Python-SDK] Multi stream subscription (Issue #36)

Dear,

Please find the below code to subscribe multiple feeds.

import time from breeze_connect import BreezeConnect from datetime import datetime, timedelta key_api = "" key_secret = "" key_session = "" breeze = BreezeConnect(api_key=key_api) breeze.generate_session(api_secret=key_secret, session_token=key_session)

Connect to websocket(it will connect to tick-by-tick data server)

breeze.ws_connect()

Callback to receive ticks.

def on_ticks(ticks): data.append(ticks) print("Ticks: {}".format(ticks))

Assign the callbacks.

breeze.on_ticks = on_ticks

breeze.subscribe_feeds(stock_token=['4.1!42692','4.1!35014'])

For more details, please follow the below documentation.

https://api.icicidirect.com/breezeapi/documents/index.html#candle-data-live-streamliveohlcv

https://traderweb.icicidirect.com/Content/File/txtFile/ScripFile/StockScriptNew.csv

[E29CF836]

Thanks & Regards,

Amrit Mohanty,

API & Algo Products,

Derivatives, EPG

ICICI Securities


From: tatiyabichhoo @.> Sent: Friday, July 14, 2023 3:38 PM To: Idirect-Tech/Breeze-Python-SDK @.> Cc: Subscribed @.***> Subject: [Idirect-Tech/Breeze-Python-SDK] Multi stream subscription (Issue #36)

External Email Warning: Use 'Report suspicious Email' button to report Phishing mails. Do not click on any attachment or links/URL in this email unless sender is reliable.

Is there a method/way to subscribe to candle stick streaming data for multiple stocks and option. Methods given in examples only covers single stock and that only for option. Please give example to add multiple stock for streaming. For example : we should be able to subscribe to RELIANCE, TCS AND NIFTY FUT for 1 min candle stick streaming data.

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-Python-SDK/issues/36, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ43RSBP4AEAD6GHUUHDXQELAJANCNFSM6AAAAAA2KD2CHA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Print this mail only if absolutely necessary. Save Paper. Save Trees." "The information contained in this e-mail and any attachments to this message are intended for the exclusive use of the intended recipient and may contain proprietary, confidential or legally privileged information. If you are not the intended recipient, please note that you are not authorised to disseminate, distribute or copy this e-mail or any parts of it or act upon/rely on the contents of this e-mail in any manner. Please notify the sender immediately by e-mail and destroy all copies of this e-mail and any attachments. Please also note that ICICI Bank or its subsidiaries and associated companies, (collectively "ICICI Group"), are unable to exercise control or ensure the integrity of/over the contents of the information contained in e-mail transmissions and that any views expressed in this e-mail are not endorsed by/binding on the ICICI Group unless the sender does so expressly with due authority of ICICI Group. Before opening any attachments please check them for viruses and defects and please note that ICICI Group accepts no liability or responsibility for any damage caused by any virus that may be transmitted by this email. Any unauthorized use of this email or any attachment(s) may be treated as infringement of right(s) including right of privacy under the applicable laws of India including Information and Technology Act, 2000. Thank you for your cooperation. Regulatory Disclosures are available on https://www.icicisecurities.com (for institutional business) and www.icicidirect.com (for retail business).

ShrikantOneture commented 1 year ago

closing the issue