INNER CODE UNIT · Python
get_strike
ldt9/PyOptionTrader · models/futures/short_strangle.py:228
def get_strike(self, delta=0.16, option_type='C', call_strike_rounding='up', put_strike_rounding='down'):
'''
Get the strike price for the option with the given delta
:param delta: delta of the option we want to order
:param option_type: type of option (call or put)
:param call_strike_rounding: rounding method for call strike
:param put_strike_rounding: rounding method for put strike
:return: the strike price of the desired option
'''
try:
optionToTrade = 0
for i in range(0, 1000):
option = pd.DataFrame()
if option_type == 'C':
option['Flag'] = ['c'] # 'c' for call
else: