Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
 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)
Example #8
0
 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)
Example #9
0
 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)
Example #10
0
 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)
Example #11
0
 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)
Example #12
0
 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)