예제 #1
0
        public void CanGetSnapshot()
        {
            RemoteMarketDataSnapshotter snapshotter = Context.ViewProcessor.MarketDataSnapshotter;

            RemoteViewCycleTests.WithViewCycle(
                delegate(ViewDefinitionCompiledArgs compiled, IViewCycle cycle, RemoteViewClient client)
            {
                var snapshot = snapshotter.CreateSnapshot(client, cycle);
                Assert.NotNull(snapshot);
            });
        }
예제 #2
0
        public void CanGetYieldCurveSpecs()
        {
            RemoteMarketDataSnapshotter snapshotter = Context.ViewProcessor.MarketDataSnapshotter;

            RemoteViewCycleTests.WithViewCycle(
                delegate(ViewDefinitionCompiledArgs compiled, IViewCycle cycle, RemoteViewClient client)
            {
                var snapshot = snapshotter.GetYieldCurveRequirements(client, cycle);
                Assert.NotNull(snapshot);
                Assert.NotEmpty(snapshot);
            });
        }
예제 #3
0
        public void UberView()
        {
            var      defn      = Context.ViewProcessor.ViewDefinitionRepository.GetViewDefinition("Mixed Instrument VaR View");
            UniqueId portfolio = defn.PortfolioIdentifier;

            var remoteAvailableOutputs = Context.RemoteAvailableOutputs;

            remoteAvailableOutputs.MaxNodes     = 2;
            remoteAvailableOutputs.MaxPositions = 2;

            var availableOutputs = remoteAvailableOutputs.GetPortfolioOutputs(portfolio);

            Assert.NotNull(availableOutputs);

            var valueNames = availableOutputs.SecurityTypes.ToDictionary(s => s, s => availableOutputs.GetPositionOutputs(s).Select(a => a.ValueName));

            foreach (var securityType in availableOutputs.SecurityTypes)
            {
                ICollection <AvailableOutput> positionOutputs = availableOutputs.GetPositionOutputs(securityType);
                foreach (var availableOutput in positionOutputs)
                {
                    Assert.Null(availableOutput.PortfolioNodeProperties);
                    Assert.True(new[] { securityType }.SequenceEqual(availableOutput.PositionProperties.Keys));
                    ValueProperties positionProperty = availableOutput.PositionProperties[securityType];
                    Assert.NotNull(positionProperty);
                    Assert.NotNull(positionProperty.GetValues("Function"));
                }
            }

            var viewCalculationConfiguration = GetDefaultCalculations(valueNames);
            var newDefn = new ViewDefinition(TestUtils.GetUniqueName(), portfolioIdentifier: portfolio, defaultCurrency: defn.DefaultCurrency, calculationConfigurationsByName: new Dictionary <string, ViewCalculationConfiguration> {
                { "Default", viewCalculationConfiguration }
            });

            using (var remoteClient = Context.CreateFinancialClient())
            {
                remoteClient.ViewDefinitionRepository.AddViewDefinition(new AddViewDefinitionRequest(newDefn));
                RemoteViewCycleTests.WithViewCycle(delegate(ViewDefinitionCompiledArgs comp, IViewCycle cycle, RemoteViewClient client)
                {
                    var allLiveData             = cycle.GetResultModel().AllLiveData;
                    var dependencyGraphExplorer = cycle.GetCompiledViewDefinition().GetDependencyGraphExplorer("Default");
                    var dependencyGraph         = dependencyGraphExplorer.GetWholeGraph();
                    var dependencyNodes         = dependencyGraph.DependencyNodes;
                    var valueSpecifications     = dependencyNodes.SelectMany(n => n.OutputValues).ToLookup(s => s).Select(g => g.Key).ToList();
                    Assert.NotEmpty(valueSpecifications);
                    var first = cycle.QueryComputationCaches(new ComputationCacheQuery("Default", valueSpecifications));
                    Assert.InRange(allLiveData.Count(), 1, valueSpecifications.Count);
                    Assert.InRange(first.Results.Count, allLiveData.Count() + 1, valueSpecifications.Count);
                }, defn.Name);
            }
        }