@property def takeout_event(self): return TakeoutEvent(self.stock, TakeoutParams.loc[self.stock, 'Bucket']) @property def events(self): return self.earnings_events + [self.takeout_event] event8_info = pd.read_excel('CLVS_RiskScenarios.xlsx', header=[0], index_col=[0, 1], sheet_name='Sub_States') idio = IdiosyncraticVol('CLVS', .05) takeout = TakeoutEvent('CLVS', 2) pres_elec = SysEvt_PresElection('CLVS', .02) earns_q2 = Earnings('CLVS', .05, dt.date(2018, 5, 15), 'Q2_2018') earns_q3 = Earnings('CLVS', .05, dt.date(2018, 8, 15), 'Q3_2018') earns_q4 = Earnings('CLVS', .05, dt.date(2018, 11, 15), 'Q4_2018') fda_meeting = Event('CLVS', .1, 'Q2_2018', 'FDA Meeting') data = Event('CLVS', Distribution(pd.read_csv('CLVS.csv')), 'Q2_2018', 'Ph3_Data') elagolix = ComplexEvent('CLVS', Distribution_MultiIndex(event8_info), dt.date(2018, 6, 1), 'Elagolix Approval') events = [ idio, takeout, pres_elec, earns_q2, earns_q3, earns_q4, fda_meeting, elagolix ] earnings = get_earnings_events('CLVS')
expiry4 = dt.date(2018, 8, 21) expiry5 = dt.date(2018, 9, 21) expiry6 = dt.date(2018, 10, 21) expiry6 = dt.date(2018, 11, 21) expiry6 = dt.date(2018, 12, 21) expiries = [expiry1, expiry2, expiry3, expiry4, expiry5, expiry6] expiries = [expiry1, expiry3, expiry5] expiries = [expiry3] # Define Events event8_info = pd.read_excel('CLVS_RiskScenarios.xlsx', header=[0], index_col=[0, 1], sheet_name='Sub_States') event0 = IdiosyncraticVol('CLVS', .15) event1 = SysEvt_PresElection('CLVS', .02, 'Q2_2018') event2 = Event('CLVS', .05, 'Q2_2018', 'Q2_Earnings') event3 = Event('CLVS', .05, 'Q3_2018', 'Q3_Earnings') event4 = Event('CLVS', .075, 'Q3_2018', 'Investor_Day') event5 = Event('CLVS', .1, 'Q2_2018', 'FDA_Approval') event6 = TakeoutEvent('CLVS', 2) event7 = Event('CLVS', Distribution(pd.read_csv('CLVS.csv')), 'Q2_2018', 'Ph3_Data') event8 = Event('CLVS', Distribution_MultiIndex(event8_info), 'Q3_2018', 'Elagolix_Approval') events = [event0, event1, event2, event3, event4, event5, event6] #events = [event0, event6] event0_bid = IdiosyncraticVol('CLVS', .125) event1_bid = SysEvt_PresElection('CLVS', .01, 'Q2_2018')
from Event_Module import IdiosyncraticVol import datetime as dt from Distribution_Module import Distribution, float_to_bs_distribution import numpy as np import pandas as pd event = IdiosyncraticVol('CLVS', .1) distribution = event.get_distribution(dt.date(2018,5,10)) print(distribution.mean_move, distribution.average_move, distribution.straddle) distribution.get_histogram() event_input_distribution = Distribution(event.event_input_distribution_df) print(event_input_distribution.mean_move, event_input_distribution.average_move, event_input_distribution.straddle) event_input_dist = event.event_input print(event_input_dist.mean_move, event_input_dist.average_move, event_input_dist.straddle) dist = float_to_bs_distribution(.5) print("HERE",dist.mean_move, dist.average_move, dist.straddle)
lambda event_grouping: get_total_mc_distribution( event_grouping, expiry), event_groupings)) #[get_histogram_from_array(mc_distribution) for mc_distribution in mc_distributions] #show_term_structure(mc_distributions) option_sheets = list( map( lambda dist: get_option_sheet_from_mc_distribution(dist, expiry). loc[:, ['IV']], mc_distributions)) return reduce( lambda x, y: pd.merge(x, y, left_index=True, right_index=True), option_sheets) # Define Events event0 = IdiosyncraticVol('CLVS', .2) event1 = SysEvt_PresElection('CLVS', .02, 'Q2_2018') event2 = Event('CLVS', .05, 'Q2_2018', 'Q2_Earnings') event3 = Event('CLVS', .05, 'Q3_2018', 'Q3_Earnings') event4 = Event('CLVS', .075, 'Q3_2018', 'Investor_Day') event5 = Event('CLVS', .1, 'Q2_2018', 'FDA_Approval') event6 = TakeoutEvent('CLVS', 1) event7 = Event('CLVS', Distribution(pd.read_csv('CLVS.csv')), 'Q2_2018', 'Ph3_Data') events = [event0, event1, event2, event3, event4, event5, event6, event7] # Define Expiries expiry1 = dt.date(2018, 4, 20) expiry2 = dt.date(2018, 5, 21) expiry3 = dt.date(2018, 7, 18)
def idio_vol(self): return IdiosyncraticVol(self.stock, .05)