Idirect-Tech / Breeze-Python-SDK

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

How can we place Basket Order #127

Open vineetvermait opened 2 months ago

vineetvermait commented 2 months ago

I want to do Option Strategy Trading, I am using python Breeze API

the document does not show how I can place Basket Order

Idirect-Tech commented 2 months ago

Dear Vineet,

Thankyou for showing interest in Breeze API.

On API level, directly Basket order feature is not integrated but through code you can execute basket of orders.

[E29CF836]

Thanks & Regards,

Hiten Solanki,

Team Breeze API,

ICICI Securities


From: Vineet Verma @.> Sent: Sunday, August 18, 2024 11:26 PM To: Idirect-Tech/Breeze-Python-SDK @.> Cc: Subscribed @.***> Subject: [Idirect-Tech/Breeze-Python-SDK] How can we place Basket Order (Issue #127)

CAUTION: This email originated from outside the organization! Do not click links, open attachments or reply, unless you recognize the sender's email address! Use 'Report suspicious Email' button in the toolbar to report Phishing mails. Beware!

I want to do Option Strategy Trading, I am using python Breeze API

the document does not show how I can place Basket Order

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-Python-SDK/issues/127, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ43LYZIRIOPXXWM556TZSDN3RAVCNFSM6AAAAABMWRUJUGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3TEMBYGA4TGOI. 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).

vineetvermait commented 2 months ago

Hi hiten

can u share a sample code for the same

Idirect-Tech commented 2 months ago

Dear Vineet,

Thankyou for showing interest in Breeze API.

This code development will take time and will update you once it gets developed.

[E29CF836]

Thanks & Regards,

Hiten Solanki,

Team Breeze API,

ICICI Securities


From: Vineet Verma @.> Sent: Monday, August 19, 2024 2:35 PM To: Idirect-Tech/Breeze-Python-SDK @.> Cc: BREEZEAPI @.>; Comment @.> Subject: Re: [Idirect-Tech/Breeze-Python-SDK] How can we place Basket Order (Issue #127)

CAUTION: This email originated from outside the organization! Do not click links, open attachments or reply, unless you recognize the sender's email address! Use 'Report suspicious Email' button in the toolbar to report Phishing mails. Beware!

Hi hiten

can u share a sample code for the same

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-Python-SDK/issues/127#issuecomment-2296054012, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ47DC2B3UCQVOXUBXK3ZSGYL7AVCNFSM6AAAAABMWRUJUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWGA2TIMBRGI. You are receiving this because you commented.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).

karanag commented 1 month ago

Hi, Following up on this.. If we place sell order and stoploss order together for the same position, it asks for more limit. How can we work around this? The goal is to either hit the sell or stoploss whichever is achieved first and then cancel the other

Idirect-Tech commented 1 month ago

Dear Karan,

The best solution is to place conditional order it means when fresh order gets execute then only place stoploss order.

Please refer below sample code for the same and kindly modify the code according to your requirements.

data = []

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

breeze.ws_connect()

Callback to receive ticks.

def on_ticks(ticks):

global Order_ID
data.append(ticks)
orderid= int(ticks.get('orderReference'))
ordered_quant = int(ticks.get('orderTotalQuantity'))
executedQuantity = int(ticks. get("executedQuantity"))
orderStatus = ticks.get('orderStatus')
#print(orderStatus)
#print(f"order_place_id :{Order_ID}")
print(f"orderid : {orderid} | ordered_quant : {ordered_quant} | orderStatus : {orderStatus}")
if orderid == Order_ID and ordered_quant == executedQuantity and orderStatus == "Executed":
    print(ltp)
    print("Squaring Off")
else:

    print(f"{orderid} is in Ordered State")
    #print(data)

Assign the callbacks.

breeze.on_ticks = on_ticks breeze.subscribe_feeds(get_order_notification=True)

Order_place = breeze.place_order(stock_code="NIFTY", exchange_code="NFO", product="options", action="buy", order_type="limit", stoploss="", quantity="25", price="1", validity="day", validity_date="2024-09-05T06:00:00.000Z", disclosed_quantity="0", expiry_date="2024-09-12T06:00:00.000Z", right="call", strike_price="25000") Order_ID = int(Order_place["Success"]["order_id"])

print(Order_ID)

Note : Kindly test it with smaller quantities and if results are coming as per your requirements then only deploy with bigger quantities.

[E29CF836]

Thanks & Regards,

Hiten Solanki,

Team Breeze API,

ICICI Securities


From: karanag @.> Sent: Thursday, September 26, 2024 11:10 AM To: Idirect-Tech/Breeze-Python-SDK @.> Cc: BREEZEAPI @.>; Comment @.> Subject: Re: [Idirect-Tech/Breeze-Python-SDK] How can we place Basket Order (Issue #127)

CAUTION: This email originated from outside the organization! Do not click links, open attachments or reply, unless you recognize the sender's email address! Use 'Report suspicious Email' button in the toolbar to report Phishing mails. Beware!

Hi, Following up on this.. If we place sell order and stoploss order together for the same position, it asks for more limit. How can we work around this? The goal is to either hit the sell or stoploss whichever is achieved first and then cancel the other

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-Python-SDK/issues/127#issuecomment-2375983391, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ46O4B7CKNBMDQ4AIUTZYOM4PAVCNFSM6AAAAABMWRUJUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZVHE4DGMZZGE. You are receiving this because you commented.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).