private void InterpretFuturesString(string instrumentString) { string identifier, type, currency, endTenor, settlementLag, floatPayFreq, floatFixingTenor, fwdTenor; DayRule dayRule; DayCount dayCount; CurveTenor curveTenor; string[] infoArray = instrumentString.Split(',').ToArray(); identifier = infoArray[0]; type = infoArray[1]; currency = infoArray[2]; endTenor = infoArray[3]; settlementLag = infoArray[4]; dayRule = StrToEnum.DayRuleConvert(infoArray[5]); floatPayFreq = infoArray[8]; floatFixingTenor = infoArray[9]; fwdTenor = infoArray[15]; dayCount = StrToEnum.DayCountConvert(infoArray[11]); DateTime startDate, endDate; try { startDate = Convert.ToDateTime(fwdTenor); endDate = DateHandling.AddTenorAdjust(startDate, floatPayFreq, dayRule); curveTenor = StrToEnum.CurveTenorFromSimpleTenor(floatPayFreq); Fra fra = new MasterThesis.Fra(AsOf, startDate, endDate, curveTenor, dayCount, dayRule, _defaultFixedRate, _defaultNotional, _defaultTradeSign); Futures[identifier] = new MasterThesis.Futures(fra, null); CurvePointMap[identifier] = fra.GetCurvePoint(); InstrumentTypeMap[identifier] = QuoteType.FuturesRate; InstrumentFormatTypeMap[identifier] = InstrumentFormatType.Futures; IdentifierStringMap[identifier] = instrumentString; } catch { // Ignore instrument } }
private void InterpretFraString(string instrumentString) { string identifier, type, currency, endTenor, settlementLag, floatPayFreq, floatFixingTenor, fwdTenor; DayRule dayRule; DayCount dayCount; CurveTenor curveTenor; string[] infoArray = instrumentString.Split(',').ToArray(); identifier = infoArray[0]; type = infoArray[1]; currency = infoArray[2]; endTenor = infoArray[3]; settlementLag = infoArray[4]; dayRule = StrToEnum.DayRuleConvert(infoArray[5]); floatPayFreq = infoArray[8]; floatFixingTenor = infoArray[9]; fwdTenor = infoArray[15]; dayCount = StrToEnum.DayCountConvert(infoArray[11]); if (type == "DEPOSIT") { //handle deposits - only used for LIBOR discounting. Not implemented } else { // handle FRA // Has to consider both FwdTenor and SettlementLag here.. curveTenor = StrToEnum.CurveTenorFromSimpleTenor(floatPayFreq); Fra fra = new MasterThesis.Fra(AsOf, fwdTenor, endTenor, curveTenor, dayCount, dayRule, _defaultFixedRate, _defaultNotional, _defaultTradeSign); Fras[identifier] = fra; CurvePointMap[identifier] = fra.GetCurvePoint(); InstrumentTypeMap[identifier] = QuoteType.FraRate; InstrumentFormatTypeMap[identifier] = InstrumentFormatType.Fras; IdentifierStringMap[identifier] = instrumentString; } }
public static Tenor GetLetterFromTenor(string tenor) { return(StrToEnum.TenorConvert(tenor.Right(1))); }
public static Tenor GetTenorFromTenor(string tenor) { return(StrToEnum.ConvertTenorLetter(tenor.Right(1))); }
private void InterpretSwapString(string instrumentString) { string identifier, type, currency, startTenor, endTenor, settlementLag, fixedFreq, floatFreq, referenceIndex; DayRule dayRule; DayCount floatDayCount, fixedDayCount; CurveTenor floatTenor, fixedTenor; string[] infoArray = instrumentString.Split(',').ToArray(); identifier = infoArray[0]; type = infoArray[1]; currency = infoArray[2]; startTenor = infoArray[3]; endTenor = infoArray[4]; settlementLag = infoArray[5]; dayRule = StrToEnum.DayRuleConvert(infoArray[6]); fixedFreq = infoArray[9]; floatFreq = infoArray[10]; referenceIndex = infoArray[12]; floatDayCount = StrToEnum.DayCountConvert(infoArray[14]); fixedDayCount = StrToEnum.DayCountConvert(infoArray[13]); floatTenor = StrToEnum.CurveTenorFromSimpleTenor(floatFreq); fixedTenor = StrToEnum.CurveTenorFromSimpleTenor(fixedFreq); DateTime startDate, endDate; // Make sure to get fwd starting stuff right here... if (DateHandling.StrIsConvertableToDate(startTenor)) { startDate = Convert.ToDateTime(startTenor); } else { startDate = DateHandling.AddTenorAdjust(AsOf, settlementLag, dayRule); } if (DateHandling.StrIsConvertableToDate(endTenor)) { endDate = Convert.ToDateTime(endTenor); } else { endDate = DateHandling.AddTenorAdjust(startDate, endTenor, dayRule); } try { if (referenceIndex == "EONIA") { // Handle OIS case // Error with endTenor here and string parsing // TEMPORARY //settlementLag = "0D"; //dayRule = DayRule.F; // This is a dirty hack to value deposits if (identifier == "EUREONON" || identifier == "EUREONTN") { Deposit deposit = new Deposit(AsOf, startTenor, endTenor, settlementLag, _defaultFixedRate, floatDayCount, dayRule, _defaultNotional, _defaultTradeSign); Deposits[identifier] = deposit; CurvePointMap[identifier] = deposit.GetCurvePoint(); InstrumentTypeMap[identifier] = QuoteType.Deposit; InstrumentFormatTypeMap[identifier] = InstrumentFormatType.Swaps; IdentifierStringMap[identifier] = instrumentString; } else { OisSwap oisSwap = new OisSwap(AsOf, startTenor, endTenor, settlementLag, fixedDayCount, floatDayCount, dayRule, _defaultNotional, _defaultFixedRate, _defaultTradeSign); OisSwaps[identifier] = oisSwap; CurvePointMap[identifier] = oisSwap.GetCurvePoint(); InstrumentTypeMap[identifier] = QuoteType.OisRate; InstrumentFormatTypeMap[identifier] = InstrumentFormatType.Swaps; IdentifierStringMap[identifier] = instrumentString; } } else { // Handle non-OIS case IrSwap swap = new IrSwap(AsOf, startDate, endDate, _defaultFixedRate, fixedTenor, floatTenor, fixedDayCount, floatDayCount, dayRule, dayRule, _defaultNotional, _defaultTradeSign, 0.0); IrSwaps[identifier] = swap; CurvePointMap[identifier] = swap.GetCurvePoint(); InstrumentTypeMap[identifier] = QuoteType.ParSwapRate; InstrumentFormatTypeMap[identifier] = InstrumentFormatType.Swaps; IdentifierStringMap[identifier] = instrumentString; } } catch { // Ignore instrument. } }