Short Straddle in Live
Python code to execution short staddle.
from quantplay.service import market
market.initialize_broker()
symbol = "NIFTY 50"
nifty_ltp = market.broker.get_ltp("NSE", symbol)
expiry_data = market.nearest_expiry(symbol, security_type="OPT")
atm_price = round(nifty_ltp/expiry_data['strike_gap'])*expiry_data['strike_gap']
pe_symbol = market.broker.option_symbol("NIFTY 50",
expiry_data["expiry_date"],
int(atm_price),
"PE")
ce_symbol = market.broker.option_symbol("NIFTY 50",
expiry_data["expiry_date"],
int(atm_price),
"CE")
market.broker.execute_order(tradingsymbol=pe_symbol,
exchange="NFO",
quantity=50,
order_type="MARKET",
transaction_type="SELL",
stoploss=0.5,
tag="straddle",
product="NRML")
market.broker.execute_order(tradingsymbol=ce_symbol,
exchange="NFO",
quantity=50,
order_type="MARKET",
transaction_type="SELL",
stoploss=0.5,
tag="straddle",
product="NRML")