Skip to main content

ICICIDIRECT's breezeconnect strategies in python

Project description

Code for Option Greek Calculation on Option Chain : Click here

Important Note:

Breeze Strategies currently place market orders for execution and square-off. However, as per regulatory guidelines, market orders are not permitted, and such orders will be rejected.

LIVE python_strategies

Steps to install Strategy Library for LIVE

pip install breeze_strategies==1.0.25

Updating Library

pip install --upgrade breeze_strategies

code usage

#Import the library
from breeze_strategies import Strategies

#Configure the strategy using API Keys and set maxprofit/takeprofit level.

#Type 1
obj = Strategies(app_key = "your app key",
                 secret_key = "your secret key",
                 api_session = "your api session",
                 max_profit = "your max profit",
                 max_loss = "your max loss")



#Execute the strategy
obj.straddle(strategy_type = "long",
             stock_code = "NIFTY",
             strike_price = "18700",
             quantity = "50",
             expiry_date = "2023-06-29T06:00:00.000Z")

#Execute the strangle strategy
obj.strangle(strike_price_call = "18700",strike_price_put = "18300", strategy_type = "long",stock_code = "NIFTY", quantity = "50", expiry_date = "2023-06-29T06:00:00.000Z")

#Execute Single Leg
obj.single_leg(right = "Call", strategy_type = "short",stock_code = "NIFTY", strike_price = "18700", quantity = "50", expiry_date = "2023-06-29T06:00:00.000Z")


#Execute the Four leg strategy

#Nifty 
obj.four_leg(stock_code="NIFTY",
            quantity="25",
            expiry_date="2024-08-14T06:00:00.000Z",
            call_short_strike="24900",
            put_short_strike="23000",
            call_long_strike="24850",
            put_long_strike="23050"
            )

#BankNifty
obj.four_leg(stock_code="CNXBAN",
            quantity="15",
            expiry_date="2024-08-14T06:00:00.000Z",
            call_short_strike="52600",
            put_short_strike="47600",
            call_long_strike="52700",
            put_long_strike="47900"
            )


#SquareOff existing positions and exit the strategy of straddle
obj.stop() 

#SquareOff existing positions and exit the strategy of strangle
obj.stop_strategy(is_strangle = True) 

#SquareOff existing positions and exit the strategy In case of single_leg pass single_leg flag as True as mentioned below
obj.stop_strategy(single_leg = True)

#SquareOff existing positions and exit the strategy of Four Leg
obj.stop_strategy(is_FourLeg = True)

#Generate Profit & Loss report (this method will work for both straddle and strangle)
obj.get_pnl()

Note:

(i) If the maximum loss or maximum profit is not reached by the end of the day, the order will be carried over to the next day, and the maximum profit and maximum loss will no longer be monitored.

(ii) Ensure that the maximum profit is a positive value and the maximum loss is a negative value.

(iii) Verify that all parameters are entered correctly.

(iv) Kindly monitor the position on the website.

(v) Ensure a stable internet connection at all times.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

breeze_strategies-1.0.25.tar.gz (19.1 kB view details)

Uploaded Source

File details

Details for the file breeze_strategies-1.0.25.tar.gz.

File metadata

  • Download URL: breeze_strategies-1.0.25.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for breeze_strategies-1.0.25.tar.gz
Algorithm Hash digest
SHA256 a85632ec77e6a4c36ef6bf9b7ad33fc10d46fc05e615617805736c417108f493
MD5 799eec4fd55d10d4a8fb69aa606df1d8
BLAKE2b-256 6def4d918cfdc08afd3edcf4b284363d663cf4a6028f76d8cd9802742a5f21a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page