I used to be able to price an IRS like this:
def get_thb_legs(fixed_rate_pct:float=None, floating_spread_bps:float=None, receive_fixed:bool=True, notional_amount:float=100):
fixed_dir, float_dir = ('Received', 'Paid') if receive_fixed else ('Paid', 'Received')
fixed_leg = {
'legTag':'Fixed',
'direction':fixed_dir,
'interestType':'Fixed',
'notionalCcy':'THB',
'notionalAmount':notional_amount,
'interestPaymentFrequency':'SemiAnnual',
'interestCalculationMethod':'Dcb_Actual_365',
}
if fixed_rate_pct is not None:
fixed_leg['fixedRatePercent'] = fixed_rate_pct
float_leg = {
'legTag':'Floating',
'direction':float_dir,
'interestType':'Float',
'interestPaymentFrequency':'SemiAnnual',
'interestCalculationMethod':'Dcb_Actual_365',
'notionalCcy':'THB',
'notionalAmount':notional_amount,
'indexName':'THBFIX',
'indexTenor':'6M'
}
if floating_spread_bps is not None:
float_leg['spreadBp'] = floating_spread_bps
return [fixed_leg, float_leg]
return {
'fields': flds,
'universe': [{
'instrumentType': 'Swap',
'instrumentDefinition': {
'instrumentTag': instr_tag,
'startDate': start_date.strftime('%Y-%m-%d'),
'tenor': tenor,
'legs': legs,
#'settlementCcy': settlement_currency , could not get this to work.
}
}],
'pricingParameters': {
'valuationDate': valuation_date.strftime('%Y-%m-%d'),
'discounting_ccy': deal_currency,
'discounting_tenor': 'OIS'
},
'outputs': ['Data', 'Headers'],
}
But now I just get errors:
'Invalid market data input for interest rate curve. No curve points could be determined to build discount rate model.'
How can we price THB IRS ?