def GenerateFlows( self , tag , start , end , period , duration , pay_currency , pay_shift_method , accrual_basis , observables): try: flows = ppf.core.generate_flows( start=utils.to_ppf_date(start) , end=utils.to_ppf_date(end) , duration=eval("ppf.date_time."+duration) , period=period , pay_shift_method=eval(\ "ppf.date_time.shift_convention."+pay_shift_method) , pay_currency=pay_currency , accrual_basis=eval("ppf.date_time."+accrual_basis) , observables=TradeServer.retrieve(observables, 'observables')) TradeServer._flows[tag] = flows return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateLiborObservables( self , tag , start , end , roll_period , roll_duration , reset_period , reset_duration , reset_currency , reset_basis , reset_shift_method): try: observables = \ ppf.core.generate_libor_observables( start=utils.to_ppf_date(start) , end=utils.to_ppf_date(end) , roll_period=roll_period , roll_duration = eval("ppf.date_time."+roll_duration) , reset_period = reset_period , reset_duration = eval("ppf.date_time."+reset_duration) , tenor_period = reset_period , tenor_duration = eval("ppf.date_time."+reset_duration) , reset_currency=reset_currency , reset_basis = eval("ppf.date_time."+reset_basis) , reset_shift_method=eval( \ "ppf.date_time.shift_convention."+reset_shift_method) , reset_lag = 0) TradeServer._observables[tag] = observables return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateExerciseSchedule(self, tag, start, end, period, duration, shift_method): try: sched = \ ppf.core.generate_exercise_table( start = utils.to_ppf_date(start) , end = utils.to_ppf_date(end) , period = period , duration = eval("ppf.date_time."+duration) , shift_method = eval("ppf.date_time.shift_convention."+shift_method)) TradeServer._exercises[tag] = sched return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateAdjuvantTable( self , tag , items , tens , vals , start , roll_period , roll_duration , shift_method): try: import numpy adjuvants = \ ppf.core.generate_adjuvant_table( items[1:] , [int(t) for t in tens[1:]] , numpy.array([x[1:len(vals[0])] for x in vals[1:]]) , utils.to_ppf_date(start) , rol_period=roll_period , roll_duration=eval("ppf.date_time."+roll_duration) , shift_method=eval(\ "ppf.date_time.shift_convention."+shift_method)) TradeServer._adjuvants[tag] = adjuvants return tag except RuntimeError, e: utils.raise_com_exception(e)
def CreateEnvironment(self, tag, t): try: MarketServer._environments[tag] = \ ppf.market.environment(utils.to_ppf_date(t)) return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateFlows(self, tag, start, end, period, duration, pay_currency, pay_shift_method, accrual_basis, observables): try: flows = ppf.core.generate_flows( start=utils.to_ppf_date(start) , end=utils.to_ppf_date(end) , duration=eval("ppf.date_time."+duration) , period=period , pay_shift_method=eval(\ "ppf.date_time.shift_convention."+pay_shift_method) , pay_currency=pay_currency , accrual_basis=eval("ppf.date_time."+accrual_basis) , observables=TradeServer.retrieve(observables, 'observables')) TradeServer._flows[tag] = flows return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateFixedCouponObservables(self, tag, start, end, roll_period, roll_duration, reset_currency, coupon_shift_method, coupon_rate): try: observables = \ ppf.core.generate_fixed_coupon_observables( start=utils.to_ppf_date(start) , end=utils.to_ppf_date(end) , roll_period=roll_period , roll_duration=eval("ppf.date_time."+roll_duration) , reset_currency=reset_currency , coupon_shift_method= eval("ppf.date_time.shift_convention."+coupon_shift_method) , coupon_rate=coupon_rate) TradeServer._observables[tag] = observables return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateExerciseSchedule( self , tag , start , end , period , duration , shift_method): try: sched = \ ppf.core.generate_exercise_table( start = utils.to_ppf_date(start) , end = utils.to_ppf_date(end) , period = period , duration = eval("ppf.date_time."+duration) , shift_method = eval("ppf.date_time.shift_convention."+shift_method)) TradeServer._exercises[tag] = sched return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateFixedCouponObservables( self , tag , start , end , roll_period , roll_duration , reset_currency , coupon_shift_method , coupon_rate): try: observables = \ ppf.core.generate_fixed_coupon_observables( start=utils.to_ppf_date(start) , end=utils.to_ppf_date(end) , roll_period=roll_period , roll_duration=eval("ppf.date_time."+roll_duration) , reset_currency=reset_currency , coupon_shift_method= eval("ppf.date_time.shift_convention."+coupon_shift_method) , coupon_rate=coupon_rate) TradeServer._observables[tag] = observables return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateLiborObservables(self, tag, start, end, roll_period, roll_duration, reset_period, reset_duration, reset_currency, reset_basis, reset_shift_method): try: observables = \ ppf.core.generate_libor_observables( start=utils.to_ppf_date(start) , end=utils.to_ppf_date(end) , roll_period=roll_period , roll_duration = eval("ppf.date_time."+roll_duration) , reset_period = reset_period , reset_duration = eval("ppf.date_time."+reset_duration) , tenor_period = reset_period , tenor_duration = eval("ppf.date_time."+reset_duration) , reset_currency=reset_currency , reset_basis = eval("ppf.date_time."+reset_basis) , reset_shift_method=eval( \ "ppf.date_time.shift_convention."+reset_shift_method) , reset_lag = 0) TradeServer._observables[tag] = observables return tag except RuntimeError, e: utils.raise_com_exception(e)
def GenerateAdjuvantTable(self, tag, items, tens, vals, start, roll_period, roll_duration, shift_method): try: import numpy adjuvants = \ ppf.core.generate_adjuvant_table( items[1:] , [int(t) for t in tens[1:]] , numpy.array([x[1:len(vals[0])] for x in vals[1:]]) , utils.to_ppf_date(start) , rol_period=roll_period , roll_duration=eval("ppf.date_time."+roll_duration) , shift_method=eval(\ "ppf.date_time.shift_convention."+shift_method)) TradeServer._adjuvants[tag] = adjuvants return tag except RuntimeError, e: utils.raise_com_exception(e)