def run_takeout_by_expiry(): event = TakeoutEvent('NBIX', 1) option_type = 'Call' option_type_2 = 'Put' strike = 1.0 expiries = [ dt.date(2018, 4, 20), dt.date(2018, 7, 20), dt.date(2018, 10, 20), dt.date(2019, 1, 20), dt.date(2019, 4, 20) ] # Preliminary Print Statements print("Ann. Takeout Prob: {:.1f}%, Premium: {:.1f}%".format( event.takeout_prob * 100, event.takeout_premium * 100)) for expiry in expiries: option = Option(option_type, strike, expiry) option2 = Option(option_type_2, strike, expiry) distribution = event.get_distribution(expiry) price = OptionPrice(distribution, option) price2 = OptionPrice(distribution, option2) straddle = price + price2 print( "T.O. by {:%m/%d/%Y}: {:.1f}%".format( expiry, distribution.distribution_df.loc["Takeout", "Prob"] * 100), "\n" * 0) print("Mean Move: {:.1f}%".format(distribution.mean_move * 100)) print("Straddle: {:.1f}%".format(straddle * 100), "\n" * 1)
def run3(): # Define Events event1 = TakeoutEvent('CLVS', 1) event2 = SysEvt_PresElection('CLVS', .02) event3 = SystematicEvent('CLVS', .1, 'Ph3_Data') event4 = SystematicEvent('CLVS', .05, 'Investor_Day') event5 = SystematicEvent('CLVS', .3, 'FDA_Approval') event6 = SystematicEvent('CLVS', .05, 'Q1_Earnings') event7 = SystematicEvent('CLVS', .05, 'Q2_Earnings') expiry = dt.date(2018, 5, 1) events = [event2, event3, event4] added_distribution = event1.get_distribution(expiry) for event in events: added_distribution += event.get_distribution() rprint(added_distribution.mean_move)
def run2(): expiry = dt.date(2018, 5, 1) event1 = TakeoutEvent('CLVS', 1) event2 = SysEvt_PresElection('CLVS', .02) event3 = SystematicEvent('CLVS', .1, 'Ph3_Data') event4 = SystematicEvent('CLVS', .05, 'Investor_Day') event5 = SystematicEvent('CLVS', .3, 'FDA Approval') distribution1 = event1.get_distribution(expiry) distribution2 = event2.get_distribution() distribution3 = event3.get_distribution() distribution4 = event4.get_distribution() distribution5 = event5.get_distribution() added_distribution = distribution1 + distribution2 + distribution3 + distribution4 + distribution5 print(added_distribution) print(added_distribution.distribution_df) rprint(distribution1.mean_move, distribution2.mean_move, distribution3.mean_move, distribution4.mean_move, distribution5.mean_move, added_distribution.mean_move)