Пример #1
0
        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
            }
        }
Пример #2
0
        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;
            }
        }