public void CanRunSingleYesterdayCycleBatch() { IViewExecutionOptions req = ExecutionOptions.GetSingleCycle(DateTimeOffset.Now - TimeSpan.FromDays(1), new LiveMarketDataSpecification()); var runToCompletion = RunToCompletion(req); Assert.Equal(1, runToCompletion.Item1.Count()); Assert.Equal(1, runToCompletion.Item2.Count()); AssertApproximatelyEqual(req.ExecutionSequence.Next.ValuationTime, runToCompletion.Item2.Single().FullResult.ValuationTime); }
public void CanCombineSnapshots() { ViewDefinition vd = Context.ViewProcessor.ViewDefinitionRepository.GetViewDefinition(@"Demo Equity Option Test View"); var snapshotManager = Context.MarketDataSnapshotManager; Tuple <ManageableMarketDataSnapshot, ManageableMarketDataSnapshot> snaps; using (var proc = snapshotManager.CreateFromViewDefinition(vd.Name)) { var snapshot = proc.Snapshot; snaps = Halve(snapshot); snaps.Item1.Name = TestUtils.GetUniqueName(); snaps.Item2.Name = TestUtils.GetUniqueName(); Context.MarketDataSnapshotMaster.Add(new MarketDataSnapshotDocument(null, snaps.Item1)); Context.MarketDataSnapshotMaster.Add(new MarketDataSnapshotDocument(null, snaps.Item2)); } try { var snapOptions = ExecutionOptions.GetSingleCycle(new CombinedMarketDataSpecification(new UserMarketDataSpecification(snaps.Item2.UniqueId), new UserMarketDataSpecification(snaps.Item1.UniqueId))); var withSnapshot = GetFirstResult(snapOptions, vd.Name); var options = ExecutionOptions.SingleCycle; IViewComputationResultModel withoutSnapshot = GetFirstResult(options, vd.Name); var withoutCount = CountResults(withoutSnapshot); var withCount = CountResults(withSnapshot); if (withoutCount != withCount) { var withSpecs = new HashSet <ValueSpecification>(withSnapshot.AllResults.Select(r => r.ComputedValue.Specification)); var withoutSpecs = new HashSet <ValueSpecification>(withoutSnapshot.AllResults.Select(r => r.ComputedValue.Specification)); withoutSpecs.SymmetricExceptWith(withSpecs); Assert.True(false, string.Format("Running snapshot of {0} only had {1}, live had {2}", vd.Name, withCount, withoutCount)); } Assert.Equal(withoutCount, withCount); } finally { Context.MarketDataSnapshotMaster.Remove(snaps.Item1.UniqueId); Context.MarketDataSnapshotMaster.Remove(snaps.Item2.UniqueId); } }