Example #1
0
        private static UnderlyingAsset CreateSimpleIRSwap(string marketInstrumentId)
        {
            var simpleIRSwap = new SimpleIRSwap();

            string[] slicedInstrumentId = marketInstrumentId.Split('-');
            string   instrumentCurrency = slicedInstrumentId[0];
            string   instrumentTerm     = slicedInstrumentId[2];


            simpleIRSwap.currency = new IdentifiedCurrency {
                Value = instrumentCurrency
            };
            simpleIRSwap.term = PeriodHelper.Parse(instrumentTerm);

            simpleIRSwap.instrumentId          = new[] { new InstrumentId() };
            simpleIRSwap.instrumentId[0].Value = marketInstrumentId;


            return(simpleIRSwap);
        }
Example #2
0
        public static RateIndex Parse(string instrumentId,
                                      string floatingRateIndex,
                                      string currency,
                                      string dayCountFraction,
                                      string paymentFrequency,
                                      string term)
        {
            var rateIndex = new RateIndex
            {
                currency = new IdentifiedCurrency()
                {
                    Value = currency
                },
                dayCountFraction  = DayCountFractionHelper.Parse(dayCountFraction),
                floatingRateIndex = FloatingRateIndexHelper.Parse(floatingRateIndex),
                id               = instrumentId,
                instrumentId     = InstrumentIdArrayHelper.Parse(instrumentId),
                paymentFrequency = PeriodHelper.Parse(paymentFrequency),
                term             = PeriodHelper.Parse(term)
            };

            return(rateIndex);
        }
Example #3
0
 public static Period FromYears(int years)
 {
     return(PeriodHelper.Parse(years + "Y"));
 }
Example #4
0
 public static Period FromMonths(int months)
 {
     return(PeriodHelper.Parse(months + "M"));
 }
Example #5
0
 public static Period FromWeeks(int weeks)
 {
     return(PeriodHelper.Parse(weeks + "W"));
 }
Example #6
0
 public static Period FromDays(int days)
 {
     return(PeriodHelper.Parse(days + "D"));
 }