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);
     }
 }
コード例 #5
0
 private MarketDataSnapshotProcessor(ManageableMarketDataSnapshot snapshot, RemoteEngineContext remoteEngineContext, SnapshotLiveDataStreamInvalidater liveDataStream)
 {
     _snapshot                 = snapshot;
     _financialClient          = remoteEngineContext.CreateFinancialClient();
     _marketDataSnapshotMaster = _financialClient.MarketDataSnapshotMaster;
     _liveDataStream           = liveDataStream;
     _temporarySnapshotUid     = new Lazy <UniqueId>(() => _marketDataSnapshotMaster.Add(new MarketDataSnapshotDocument(null, GetShallowCloneSnapshot())).UniqueId);
     _snapshotDataStream       = new Lazy <SnapshotDataStreamInvalidater>(() => new SnapshotDataStreamInvalidater(_liveDataStream, remoteEngineContext, _temporarySnapshotUid.Value));
 }
コード例 #6
0
        public SnapshotDataStreamInvalidater(SnapshotLiveDataStreamInvalidater liveStream, RemoteEngineContext remoteEngineContext, UniqueId snapshotId)
        {
            _liveStream               = liveStream;
            _remoteEngineContext      = remoteEngineContext;
            _snapshotId               = snapshotId;
            _financialClient          = remoteEngineContext.CreateFinancialClient();
            _liveStream.GraphChanged += OnGraphChanged;

            _constructedEvent.Set();
        }
        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);
            }
        }
コード例 #10
0
        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));
            }
        }
コード例 #11
0
        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);
                }
            }
        }