def __init__(self, pos_set): HedgeContext.__init__(self, pos_set) self.name = 'protective_put' # start profit self.pl.start_profit.price = self.calc_break_even() self.pl.start_profit.condition = '>' # start loss self.pl.start_loss.price = self.calc_break_even() self.pl.start_loss.condition = '<' # break even self.pl.break_even.price = self.calc_break_even() self.pl.break_even.condition = '==' # max profit self.pl.max_profit.amount = float('inf') self.pl.max_profit.limit = False self.pl.max_profit.price = float('inf') self.pl.max_profit.condition = '==' # max loss self.pl.max_loss.amount = self.calc_max_loss() self.pl.max_loss.limit = True self.pl.max_loss.price = float(self.pos_set.option.strike_price) self.pl.max_loss.condition = '<='
def __init__(self, pos_set): HedgeContext.__init__(self, pos_set) self.name = 'covered_call' # start profit self.pl.start_profit.price = self.calc_break_even() self.pl.start_profit.condition = '>' # start loss self.pl.start_loss.price = self.calc_break_even() self.pl.start_loss.condition = '<' # break even self.pl.break_even.price = self.calc_break_even() self.pl.break_even.condition = '==' # max profit self.pl.max_profit.amount = self.calc_max_profit() self.pl.max_profit.limit = True self.pl.max_profit.price = float(self.pos_set.option.strike_price) self.pl.max_profit.condition = '>=' # max loss self.pl.max_loss.amount = self.calc_max_loss() self.pl.max_loss.limit = True self.pl.max_loss.price = 0.0 self.pl.max_loss.condition = '=='