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