예제 #1
0
        public void NotifiesWhenSecurityAddedViaIndexer()
        {
            var manager = new UniverseManager();

            var universe = new FuncUniverse(CreateTradeBarConfig(), new UniverseSettings(Resolution.Minute, 2, true, false, TimeSpan.Zero), SecurityInitializer.Null,
                                            data => data.Select(x => x.Symbol)
                                            );

            manager.CollectionChanged += (sender, args) =>
            {
                if (args.NewItems.OfType <object>().Single() != universe)
                {
                    Assert.Fail("Expected args.NewItems to have exactly one element equal to universe");
                }
                else
                {
                    Assert.IsTrue(args.Action == NotifyCollectionChangedAction.Add);
                    Assert.Pass();
                }
            };

            manager[universe.Configuration.Symbol] = universe;
        }
예제 #2
0
 /// <summary>
 /// Sets the current universe selector for the algorithm. This will be executed on day changes
 /// </summary>
 /// <param name="coarse">Defines an initial coarse selection</param>
 public void SetUniverse(Func <IEnumerable <CoarseFundamental>, IEnumerable <Symbol> > coarse)
 {
     Universe = new FuncUniverse(coarse);
 }