Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 public static Period FromYears(int years)
 {
     return(PeriodHelper.Parse(years + "Y"));
 }
Exemplo n.º 5
0
 public static Period FromMonths(int months)
 {
     return(PeriodHelper.Parse(months + "M"));
 }
Exemplo n.º 6
0
 public static Period FromWeeks(int weeks)
 {
     return(PeriodHelper.Parse(weeks + "W"));
 }
Exemplo n.º 7
0
 public static Period FromDays(int days)
 {
     return(PeriodHelper.Parse(days + "D"));
 }