Beispiel #1
0
        private static UnderlyingAsset CreateSimpleFra(string marketInstrumentId)
        {
            var simpleFra = new SimpleFra();

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

            simpleFra.currency = new IdentifiedCurrency {
                Value = instrumentCurrency
            };
            string startTerm;
            string endTerm = slicedInstrumentId[3];

            if (endTerm != null)
            {
                startTerm = instrumentTerm;
                Period temp = PeriodHelper.Parse(endTerm);
                simpleFra.startTerm = PeriodHelper.Parse(startTerm);
                simpleFra.endTerm   = simpleFra.startTerm.Sum(temp);
            }
            else
            {
                string[] slicedTerm = instrumentTerm.Split("vxVX".ToCharArray());//TODO fix this for index tenors.
                startTerm           = slicedTerm[0];
                endTerm             = slicedTerm[1];
                simpleFra.startTerm = PeriodHelper.Parse(startTerm);
                simpleFra.endTerm   = PeriodHelper.Parse(endTerm);
            }
            simpleFra.instrumentId          = new[] { new InstrumentId() };
            simpleFra.instrumentId[0].Value = marketInstrumentId;
            return(simpleFra);
        }
Beispiel #2
0
        private static UnderlyingAsset CreateDeposit(string marketInstrumentId)
        {
            var deposit = new Deposit();

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

            deposit.currency = new IdentifiedCurrency {
                Value = instrumentCurrency
            };
            deposit.term                  = PeriodHelper.Parse(instrumentTerm);
            deposit.instrumentId          = new[] { new InstrumentId() };
            deposit.instrumentId[0].Value = marketInstrumentId;
            return(deposit);
        }
Beispiel #3
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);
        }
Beispiel #4
0
 public static Period FromYears(int years)
 {
     return(PeriodHelper.Parse(years + "Y"));
 }
Beispiel #5
0
 public static Period FromMonths(int months)
 {
     return(PeriodHelper.Parse(months + "M"));
 }
Beispiel #6
0
 public static Period FromWeeks(int weeks)
 {
     return(PeriodHelper.Parse(weeks + "W"));
 }
Beispiel #7
0
 public static Period FromDays(int days)
 {
     return(PeriodHelper.Parse(days + "D"));
 }