Exemplo n.º 1
0
 def set_market_data(self, market_data):
     super(CMQNormalCSO, self).set_market_data(market_data)
     if len(market_data) == 0:
         self.fwd_avg = 1.0
         self.df = 1.0
         return
     fwd_quotes = market_data['COMFwd'][self.fwd_index]
     for quote in fwd_quotes:
         if quote[0] == self.leg_a:
             self.fwd_a = quote[2]
             continue
         elif quote[0] == self.leg_b:
             self.fwd_b = quote[2]
             break
     volmark = cmq_crv_defn.lookup_vol_mark(self.fwd_index, market_data, self.end, \
                                                 vol_fields=['COMDV'+str(self.leg_diff)])
     self.ivol = volmark['COMDV' + str(self.leg_diff)]
     if self.need_disc and (self.end >= self.value_date):
         rate_quotes = market_data['IRCurve'][self.ccy.lower() + '_disc']
         tenors = [(quote[1] - self.value_date).days
                   for quote in rate_quotes]
         irates = [quote[2] for quote in rate_quotes]
         mode = cmq_curve.ForwardCurve.InterpMode.Linear
         rate_curve = cmq_curve.ForwardCurve.from_array(tenors,
                                                        irates,
                                                        interp_mode=mode)
         t_exp = (self.end - self.value_date).days
         self.df = np.exp(-rate_curve(t_exp) * t_exp / 365.0)
     else:
         self.df = 1.0
Exemplo n.º 2
0
 def set_market_data(self, market_data):
     super(CMQCommodEuOpt, self).set_market_data(market_data)
     if len(market_data) == 0:
         self.volmark = None
     else:
         self.volmark = cmq_crv_defn.lookup_vol_mark(self.fwd_index, market_data, self.end, \
                                                 vol_fields=cmq_crv_defn.COMVOL_fields)
Exemplo n.º 3
0
 def set_market_data(self, market_data):
     super(CMQMthlyAsian, self).set_market_data(market_data)
     if len(market_data) == 0:
         self.volmark = None
         return
     self.volmark = cmq_crv_defn.lookup_vol_mark(self.fwd_index, market_data, self.end, \
                                            vol_fields = cmq_crv_defn.COMVOL_fields)
Exemplo n.º 4
0
 def set_market_data(self, market_data):
     super(CMQCommodEuOpt, self).set_market_data(market_data)
     if len(market_data) == 0:
         self.fwd_avg = 1.0
         self.df = 1.0
         return
     fwd_quotes = market_data['COMFwd'][self.fwd_index]
     for quote in fwd_quotes:
         if quote[0] == self.contract:
             self.fwd_avg = quote[2]
             break
     self.volmark = cmq_crv_defn.lookup_vol_mark(self.fwd_index, market_data, self.end, \
                                                 vol_fields=cmq_crv_defn.COMVOL_fields)
     if self.need_disc and (self.end >= self.value_date):
         rate_quotes = market_data['IRCurve'][self.ccy.lower() + '_disc']
         tenors = [(quote[1] - self.value_date).days
                   for quote in rate_quotes]
         irates = [quote[2] for quote in rate_quotes]
         mode = cmq_curve.ForwardCurve.InterpMode.Linear
         rate_curve = cmq_curve.ForwardCurve.from_array(tenors,
                                                        irates,
                                                        interp_mode=mode)
         t_exp = (self.end - self.value_date).days
         self.df = np.exp(-rate_curve(t_exp) * t_exp / 365.0)
     else:
         self.df = 1.0
Exemplo n.º 5
0
 def set_market_data(self, market_data):
     super(CMQCommodEuOpt, self).set_market_data(market_data)
     if len(market_data) == 0:
         self.volmark = None
     else:
         self.volmark = cmq_crv_defn.lookup_vol_mark(self.fwd_index, market_data, self.end, \
                                                 vol_fields=cmq_crv_defn.COMVOL_fields)
 def set_market_data(self, market_data):
     super(CMQMthlyAsian, self).set_market_data(market_data)
     if len(market_data) == 0:
         self.volmark = None
         return
     self.volmark = cmq_crv_defn.lookup_vol_mark(self.fwd_index, market_data, self.end, \
                                            vol_fields = cmq_crv_defn.COMVOL_fields)
Exemplo n.º 7
0
 def set_market_data(self, market_data):
     super(CMQNormalCSO, self).set_market_data(market_data)
     if len(market_data) == 0:
         self.fwd_avg = 1.0
         self.df = 1.0
         return
     fwd_quotes = market_data['COMFwd'][self.fwd_index]
     for quote in fwd_quotes:
         if quote[0] == self.leg_a:
             self.fwd_a = quote[2]
             continue
         elif quote[0] == self.leg_b:
             self.fwd_b = quote[2]
             break
     volmark = cmq_crv_defn.lookup_vol_mark(self.fwd_index, market_data, self.end, \
                                                 vol_fields=['COMDV'+str(self.leg_diff)])
     self.ivol = volmark['COMDV'+str(self.leg_diff)]
     if self.need_disc:
         self.df = disc_factor(self.value_date, self.end, market_data['IRCurve'][self.ccy.lower() + '_disc'])
     else:
         self.df = 1.0