public void CanAddAndGetAllInstrumentTypes() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; YieldCurveDefinitionDocument yieldCurveDefinitionDocument = GenerateDocument(); foreach (StripInstrumentType stripInstrumentType in Enum.GetValues(typeof(StripInstrumentType))) { var fixedIncomeStrip = new FixedIncomeStrip { ConventionName = "DEFAULT", CurveNodePointTime = Tenor.Day, InstrumentType = stripInstrumentType }; if (stripInstrumentType == StripInstrumentType.Future) { fixedIncomeStrip.NthFutureFromTenor = 12; } yieldCurveDefinitionDocument.YieldCurveDefinition.AddStrip(fixedIncomeStrip); } AssertRoundTrip(interpolatedYieldCurveDefinitionMaster, yieldCurveDefinitionDocument); } }
public void CanGet() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; Assert.NotNull(interpolatedYieldCurveDefinitionMaster); } }
public void CantGetMissing() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; Assert.Throws <DataNotFoundException>(() => interpolatedYieldCurveDefinitionMaster.Get(UniqueId.Create("InMemoryInterpolatedYieldCurveDefinition", long.MaxValue.ToString()))); } }
public void CantAddOrUpdate() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; var yieldCurveDefinitionDocument = GenerateDocument(); interpolatedYieldCurveDefinitionMaster.AddOrUpdate(yieldCurveDefinitionDocument); } }
public void CanAddAndGet() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; YieldCurveDefinitionDocument yieldCurveDefinitionDocument = GenerateDocument(); AssertRoundTrip(interpolatedYieldCurveDefinitionMaster, yieldCurveDefinitionDocument); } }
public void CantAddTwice() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; var yieldCurveDefinitionDocument = GenerateDocument(); interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument); var exception = Assert.Throws <ArgumentException>(() => interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument)); Assert.True(exception.Message.Contains("Duplicate definition")); } }
public void CanAdd() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; var yieldCurveDefinitionDocument = GenerateDocument(); var newDoc = interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument); Assert.True(ReferenceEquals(newDoc, yieldCurveDefinitionDocument)); Assert.True(ReferenceEquals(newDoc.YieldCurveDefinition, yieldCurveDefinitionDocument.YieldCurveDefinition)); Assert.NotNull(yieldCurveDefinitionDocument.UniqueId); } }
public void CanAddAndRemove() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; YieldCurveDefinitionDocument yieldCurveDefinitionDocument = GenerateDocument(); AssertRoundTrip(interpolatedYieldCurveDefinitionMaster, yieldCurveDefinitionDocument); interpolatedYieldCurveDefinitionMaster.Remove(yieldCurveDefinitionDocument.UniqueId); Assert.Throws <DataNotFoundException>(() => interpolatedYieldCurveDefinitionMaster.Get(yieldCurveDefinitionDocument.UniqueId)); } }
public void CanAddAndGetRegions() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; foreach (ExternalId region in new[] { null, new ExternalId("XX", "12"), new ExternalId("asd", "asd") }) { YieldCurveDefinitionDocument yieldCurveDefinitionDocument = GenerateDocument(); yieldCurveDefinitionDocument.YieldCurveDefinition.Region = region; AssertRoundTrip(interpolatedYieldCurveDefinitionMaster, yieldCurveDefinitionDocument); } } }
private static void AssertRoundTrip(InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster, YieldCurveDefinitionDocument yieldCurveDefinitionDocument) { interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument); YieldCurveDefinitionDocument roundtrippedDoc = interpolatedYieldCurveDefinitionMaster.Get(yieldCurveDefinitionDocument.UniqueId); YieldCurveDefinition roundTripped = roundtrippedDoc.YieldCurveDefinition; var yieldCurveDefinition = yieldCurveDefinitionDocument.YieldCurveDefinition; Assert.Equal(yieldCurveDefinition.Name, roundTripped.Name); Assert.Equal(yieldCurveDefinition.InterpolatorName, roundTripped.InterpolatorName); Assert.Equal(yieldCurveDefinition.Currency, roundTripped.Currency); Assert.Equal(roundTripped.Region, roundTripped.Region); Assert.True(roundTripped.Strips.SequenceEqual(roundTripped.Strips)); }