Пример #1
0
        public override void Run()
        {
            Strategy metaStrategy = new Strategy(framework, "MetaStrategy");

            Instrument instrument1 = InstrumentManager.Instruments["CSCO"];
            Instrument instrument2 = InstrumentManager.Instruments["MSFT"];

            MyStrategy strategy = new MyStrategy(framework, "BuySell");

            strategy.Instruments.Add(instrument1);
            strategy.Instruments.Add(instrument2);

            VWAP_SellSide sellSideStrategy = new VWAP_SellSide(framework, "VWAP SellSide");

            strategy.ExecutionProvider = sellSideStrategy;
            strategy.DataProvider      = sellSideStrategy;

            DataSimulator.DateTime1 = new DateTime(2013, 12, 01);
            DataSimulator.DateTime2 = new DateTime(2013, 12, 31);

            BarFactory.Add(instrument1, BarType.Time, 60);
            BarFactory.Add(instrument2, BarType.Time, 60);

            metaStrategy.AddStrategy(strategy);
            metaStrategy.AddStrategy(sellSideStrategy);

            this.strategy = metaStrategy;

            StartStrategy();
        }
Пример #2
0
        public override void Run()
        {
            Instrument spreadInsturment = InstrumentManager.Get("NGF 01-15 vs NGG 02-15");

            // Add spread instrument if needed.
            if (spreadInsturment == null)
            {
                spreadInsturment = new Instrument(InstrumentType.Synthetic, "NGF 01-15 vs NGG 02-15");

                InstrumentManager.Add(spreadInsturment);
            }


            spreadInsturment.Legs.Clear();


            // Add legs for spread instrument if needed.
            if (spreadInsturment.Legs.Count == 0)
            {
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("NGF17after"), 1));
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("NGG17after"), 1));
            }


            // Main strategy.
            strategy = new Strategy(framework, "SpreadTrading");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");

            buySide.Instruments.Add(spreadInsturment);

            // Create SellSide strategy.
            SpreadSellSide sellSide = new SpreadSellSide(framework, "SellSide");

            sellSide.Global[SpreadSellSide.barSizeCode] = barSize;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider      = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Set DataSimulator's dates.
            DataSimulator.DateTime1 = new DateTime(2014, 11, 23);            // 1 day before real start
            DataSimulator.DateTime2 = new DateTime(2014, 11, 29);            // 1 day after real end

            BarFactory.Clear();

            // Run.
            StartStrategy();
        }
Пример #3
0
        public override void Run()
        {
            Instrument spreadInsturment = InstrumentManager.Get("AAPL vs MSFT");

            // Add spread instrument if needed.
            if (spreadInsturment == null)
            {
                spreadInsturment = new Instrument(InstrumentType.Stock, "AAPL vs MSFT");

                InstrumentManager.Add(spreadInsturment);
            }

            spreadInsturment.Legs.Clear();

            // Add legs for spread instrument if needed.
            if (spreadInsturment.Legs.Count == 0)
            {
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("AAPL"), 1));
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("MSFT"), -12));
            }

            // Main strategy.
            strategy = new Strategy(framework, "SpreadTrading");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");

            buySide.Instruments.Add(spreadInsturment);

            // Create SellSide strategy.
            SpreadSellSide sellSide = new SpreadSellSide(framework, "SellSide");

            sellSide.Global[SpreadSellSide.barSizeCode] = barSize;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider      = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Set DataSimulator's dates.
            DataSimulator.DateTime1 = new DateTime(2013, 01, 01);
            DataSimulator.DateTime2 = new DateTime(2013, 12, 31);

            // Add 1 minute bars (60 seconds) for spread instrument.
            BarFactory.Add(spreadInsturment, BarType.Time, barSize);

            // Run.
            StartStrategy();
        }
Пример #4
0
        public override void Run()
        {
            // Get synthetic trading instrument.
            Instrument instrument1 = InstrumentManager.Instruments["NQ"];

            // Init roll info - leg index, symbol and maturity date.
            List <RollInfo> rollInfo = new List <RollInfo>()
            {
                new RollInfo(0, "NQZ3", new DateTime(2013, 12, 20)),
                new RollInfo(1, "NQH4", new DateTime(2014, 03, 21)),
            };

            // Add legs.
            for (var i = 0; i < rollInfo.Count; i++)
            {
                instrument1.Legs.Add(new Leg(InstrumentManager.Instruments[rollInfo[i].Symbol]));
            }

            // Main strategy.
            strategy = new Strategy(framework, "Roll");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");

            buySide.Instruments.Add(instrument1);

            // Create SellSide strategy.
            RollSellSide sellSide = new RollSellSide(framework, "SellSide");

            sellSide.Global[RollSellSide.barSizeCode]  = barSize;
            sellSide.Global[RollSellSide.rollInfoCode] = rollInfo;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider      = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Set DataSimulator's dates.
            DataSimulator.DateTime1 = new DateTime(2013, 01, 01);
            DataSimulator.DateTime2 = new DateTime(2013, 12, 31);

            // Add 4 hours bars (14400 seconds) for ins1.
            BarFactory.Add(instrument1, BarType.Time, barSize);

            // Run.
            StartStrategy();
        }
        public void add_strategy_to_collection_expect_retrieval_as_version()
        {
            var searchStrategy = new MockStringSearch();

            Strategy.AddStrategy <IStringSearch>(searchStrategy, As.v1);
            Assert.AreEqual(searchStrategy, Strategy.For <IStringSearch>(As.v1));
        }
Пример #6
0
        public static void AssemblyInit(TestContext context)
        {
            // Forces the default registration of the IStringSearch Strategy //
            Strategy.AddStrategy <IStringSearch>(new StringSearch());

            Strategy.AddStrategy <ITree>(new Tree());
            Strategy.AddStrategy <IBranch>(new BranchA());
            Strategy.AddStrategy <ILeaf>(new LeafA());
        }
Пример #7
0
        public void using_tree_with_different_branch_expect_explicit_response()
        {
            Strategy.AddStrategy <ITree>(new Tree(), As.v2);
            // NOTE the BRANCH C use //
            Strategy.AddStrategy <IBranch>(new BranchC(), As.v2);
            Strategy.AddStrategy <ILeaf>(new LeafA(), As.v2);

            var response = Strategy.For <ITree>(As.v2).Navigate(As.v2);

            // Should be the default response because it was placed back into the Strategy //
            // after the TestInitialize //
            Assert.AreEqual("This is not the branch you are looking for...", response);
        }
Пример #8
0
        public void using_tree_with_leaf_C_expect_response()
        {
            Strategy.AddStrategy <ITree>(new Tree(), As.v1);
            Strategy.AddStrategy <IBranch>(new BranchA(), As.v1);
            // NOTE the BRANCH C use //
            Strategy.AddStrategy <ILeaf>(new LeafC(), As.v1);

            var response = Strategy.For <ITree>(As.v1).Navigate(As.v1);

            // this will be the "Read Leaf C" because of the injection //
            // of the LeafC strategy in this method //
            Assert.AreEqual("Read Leaf C", response);
        }
Пример #9
0
        public void string_search_implementation_expect_results()
        {
            // search for a string that is not properly cased //
            var  searchFor = "move Along";
            bool contains  = Strategy.For <IStringSearch>().HasWithin(searchFor, searchWithin);

            Assert.IsFalse(contains);

            //switch the strategy to case insensitive, to show the injection potential //
            Strategy.AddStrategy <IStringSearch>(new StringSearchCI(), As.v2);
            contains = Strategy.For <IStringSearch>(As.v2).HasWithin(searchFor, searchWithin);
            Assert.IsTrue(contains);

            // search for a string the is a partial //
            searchFor = "ident";
            contains  = Strategy.For <IStringSearch>().HasWithin(searchFor, searchWithin);
            Assert.IsTrue(contains);

            // search for a string that does not exist //
            searchFor = "?";
            contains  = Strategy.For <IStringSearch>().HasWithin(searchFor, searchWithin);
            Assert.IsFalse(contains);
        }
Пример #10
0
        public override void Run()
        {
            // Prepare running.
            Console.WriteLine("Prepare running in {0} mode...", StrategyManager.Mode);

            // Get spread instrument.
            Instrument spreadInsturment = InstrumentManager.Get("AAPL vs MSFT");

            // Add spread instrument if needed.
            if (spreadInsturment == null)
            {
                spreadInsturment = new Instrument(InstrumentType.Stock, "AAPL vs MSFT");
                InstrumentManager.Add(spreadInsturment);
            }

            // Add legs for spread instrument if needed.
            if (spreadInsturment.Legs.Count == 0)
            {
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("AAPL"), 1));
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("MSFT"), -1));
            }

            // Main strategy.
            strategy = new Strategy(framework, "SpreadTrading");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");

            buySide.Instruments.Add(spreadInsturment);

            // Create SellSide strategy.
            SpreadSellSide sellSide = new SpreadSellSide(framework, "SellSide");

            sellSide.Global[SpreadSellSide.barSizeCode] = barSize;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider      = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Get provider for realtime.
            Provider quantRouter = ProviderManager.Providers["QuantRouter"] as Provider;

            if (quantRouter.Status == ProviderStatus.Disconnected)
            {
                quantRouter.Connect();
            }

            if (StrategyManager.Mode == StrategyMode.Paper)
            {
                // Set QuantRouter as data provider.
                sellSide.DataProvider = quantRouter as IDataProvider;
            }
            else if (StrategyManager.Mode == StrategyMode.Live)
            {
                // Set QuantRouter as data and execution provider.
                sellSide.DataProvider      = quantRouter as IDataProvider;
                sellSide.ExecutionProvider = quantRouter as IExecutionProvider;
            }

            // Set null for event filter.
            EventManager.Filter = null;

            // Add 1 minute bars (60 seconds) for spread instrument.
            BarFactory.Add(spreadInsturment, BarType.Time, barSize);

            // Run.
            Console.WriteLine("Run in {0} mode.", StrategyManager.Mode);
            StartStrategy(StrategyManager.Mode);
        }
Пример #11
0
        public override void Run()
        {
            // Synthetic instrument.
            Instrument instrument1 = InstrumentManager.Instruments["NQ"];

            // Init roll info - leg index, symbol and maturity date.
            List <RollInfo> rollInfo = new List <RollInfo>()
            {
                new RollInfo(0, "NQZ3", new DateTime(2013, 12, 20)),
                new RollInfo(1, "NQH4", new DateTime(2014, 03, 21)),
            };

            // Add legs.
            for (var i = 0; i < rollInfo.Count; i++)
            {
                instrument1.Legs.Add(new Leg(InstrumentManager.Instruments[rollInfo[i].Symbol]));
            }

            // Main strategy.
            strategy = new Strategy(framework, "Roll");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");

            buySide.Instruments.Add(instrument1);

            // Create SellSide strategy.
            RollSellSide sellSide = new RollSellSide(framework, "SellSide");

            sellSide.Global[RollSellSide.barSizeCode]  = barSize;
            sellSide.Global[RollSellSide.rollInfoCode] = rollInfo;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider      = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Get provider for realtime.
            Provider quantRouter = framework.ProviderManager.Providers["QuantRouter"] as Provider;

            if (quantRouter.Status == ProviderStatus.Disconnected)
            {
                quantRouter.Connect();
            }

            if (StrategyManager.Mode == StrategyMode.Paper)
            {
                // Set QuantRouter as data provider.
                strategy.DataProvider = quantRouter as IDataProvider;
            }
            else if (StrategyManager.Mode == StrategyMode.Live)
            {
                // Set QuantRouter as data and execution provider.
                strategy.DataProvider      = quantRouter as IDataProvider;
                strategy.ExecutionProvider = quantRouter as IExecutionProvider;
            }

            BarFactory.Add(instrument1, BarType.Time, barSize);

            // Run.
            StartStrategy();
        }
Пример #12
0
        public override void Run()
        {
            // Prepare running.
            Console.WriteLine("Prepare running in {0} mode...", StrategyManager.Mode);

            // Get spread instrument.
            Instrument spreadInsturment = InstrumentManager.Get("AAPL vs MSFT");

            // Add spread instrument if needed.
            if (spreadInsturment == null)
            {
                spreadInsturment = new Instrument(InstrumentType.Stock, "AAPL vs MSFT");
                InstrumentManager.Add(spreadInsturment);
            }

            // Add legs for spread instrument if needed.
            if (spreadInsturment.Legs.Count == 0)
            {
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("AAPL"), 1));
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("MSFT"), -1));
            }

            // Main strategy.
            strategy = new Strategy(framework, "SpreadTrading");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");
            buySide.Instruments.Add(spreadInsturment);

            // Create SellSide strategy.
            SpreadSellSide sellSide = new SpreadSellSide(framework, "SellSide");
            sellSide.Global[SpreadSellSide.barSizeCode] = barSize;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Get provider for realtime.
            Provider quantRouter = ProviderManager.Providers["QuantRouter"] as Provider;

            if (quantRouter.Status == ProviderStatus.Disconnected)
                quantRouter.Connect();

            if (StrategyManager.Mode == StrategyMode.Paper)
            {
                // Set QuantRouter as data provider.
                sellSide.DataProvider = quantRouter as IDataProvider;
            }
            else if (StrategyManager.Mode == StrategyMode.Live)
            {
                // Set QuantRouter as data and execution provider.
                sellSide.DataProvider = quantRouter as IDataProvider;
                sellSide.ExecutionProvider = quantRouter as IExecutionProvider;
            }

            // Set null for event filter.
            EventManager.Filter = null;

            // Add 1 minute bars (60 seconds) for spread instrument.
            BarFactory.Add(spreadInsturment, BarType.Time, barSize);

            // Run.
            Console.WriteLine("Run in {0} mode.", StrategyManager.Mode);
            StartStrategy(StrategyManager.Mode);
        }
Пример #13
0
        public override void Run()
        {
            Instrument spreadInsturment = InstrumentManager.Get("AAPL vs MSFT");

            // Add spread instrument if needed.
            if (spreadInsturment == null)
            {
                spreadInsturment = new Instrument(InstrumentType.Stock, "AAPL vs MSFT");

                InstrumentManager.Add(spreadInsturment);
            }

            spreadInsturment.Legs.Clear();

            // Add legs for spread instrument if needed.
            if (spreadInsturment.Legs.Count == 0)
            {
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("AAPL"), 1));
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("MSFT"), -12));
            }

            // Main strategy.
            strategy = new Strategy(framework, "SpreadTrading");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");
            buySide.Instruments.Add(spreadInsturment);

            // Create SellSide strategy.
            SpreadSellSide sellSide = new SpreadSellSide(framework, "SellSide");
            sellSide.Global[SpreadSellSide.barSizeCode] = barSize;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Set DataSimulator's dates.
            DataSimulator.DateTime1 = new DateTime(2013, 01, 01);
            DataSimulator.DateTime2 = new DateTime(2013, 12, 31);

            // Add 1 minute bars (60 seconds) for spread instrument.
            BarFactory.Add(spreadInsturment, BarType.Time, barSize);

            // Run.
            StartStrategy();
        }
Пример #14
0
        public override void Run()
        {
            Strategy metaStrategy = new Strategy(framework, "MetaStrategy");

            Instrument instrument1 = InstrumentManager.Instruments["CSCO"];
            Instrument instrument2 = InstrumentManager.Instruments["MSFT"];

            MyStrategy strategy = new MyStrategy(framework, "BuySell");

            strategy.Instruments.Add(instrument1);
            strategy.Instruments.Add(instrument2);

            VWAP_SellSide sellSideStrategy = new VWAP_SellSide(framework, "VWAP SellSide");

            strategy.ExecutionProvider = sellSideStrategy;
            strategy.DataProvider = sellSideStrategy;

            DataSimulator.DateTime1 = new DateTime(2013, 12, 01);
            DataSimulator.DateTime2 = new DateTime(2013, 12, 31);

            BarFactory.Add(instrument1, BarType.Time, 60);
            BarFactory.Add(instrument2, BarType.Time, 60);

            metaStrategy.AddStrategy(strategy);
            metaStrategy.AddStrategy(sellSideStrategy);

            this.strategy = metaStrategy;

            StartStrategy();
        }
Пример #15
0
        public override void Run()
        {
            // Synthetic instrument.
            Instrument instrument1 = InstrumentManager.Instruments["NQ"];

            // Init roll info - leg index, symbol and maturity date.
            List<RollInfo> rollInfo = new List<RollInfo>()
            {
                new RollInfo(0, "NQZ3", new DateTime(2013, 12, 20)),
                new RollInfo(1, "NQH4", new DateTime(2014, 03, 21)),
            };

            // Add legs.
            for (var i = 0; i < rollInfo.Count; i++)
                instrument1.Legs.Add(new Leg(InstrumentManager.Instruments[rollInfo[i].Symbol]));

            // Main strategy.
            strategy = new Strategy(framework, "Roll");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");
            buySide.Instruments.Add(instrument1);

            // Create SellSide strategy.
            RollSellSide sellSide = new RollSellSide(framework, "SellSide");
            sellSide.Global[RollSellSide.barSizeCode] = barSize;
            sellSide.Global[RollSellSide.rollInfoCode] = rollInfo;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Get provider for realtime.
            Provider quantRouter = framework.ProviderManager.Providers["QuantRouter"] as Provider;

            if (quantRouter.Status == ProviderStatus.Disconnected)
                quantRouter.Connect();

            if (StrategyManager.Mode == StrategyMode.Paper)
            {
                // Set QuantRouter as data provider.
                strategy.DataProvider = quantRouter as IDataProvider;
            }
            else if (StrategyManager.Mode == StrategyMode.Live)
            {
                // Set QuantRouter as data and execution provider.
                strategy.DataProvider = quantRouter as IDataProvider;
                strategy.ExecutionProvider = quantRouter as IExecutionProvider;
            }

            BarFactory.Add(instrument1, BarType.Time, barSize);

            // Run.
            StartStrategy();
        }
Пример #16
0
        public override void Run()
        {
            // Get synthetic trading instrument.
            Instrument instrument1 = InstrumentManager.Instruments["NQ"];

            // Init roll info - leg index, symbol and maturity date.
            List<RollInfo> rollInfo = new List<RollInfo>()
            {
                new RollInfo(0, "NQZ3", new DateTime(2013, 12, 20)),
                new RollInfo(1, "NQH4", new DateTime(2014, 03, 21)),
            };

            // Add legs.
            for (var i = 0; i < rollInfo.Count; i++)
                instrument1.Legs.Add(new Leg(InstrumentManager.Instruments[rollInfo[i].Symbol]));

            // Main strategy.
            strategy = new Strategy(framework, "Roll");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");
            buySide.Instruments.Add(instrument1);

            // Create SellSide strategy.
            RollSellSide sellSide = new RollSellSide(framework, "SellSide");
            sellSide.Global[RollSellSide.barSizeCode] = barSize;
            sellSide.Global[RollSellSide.rollInfoCode] = rollInfo;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Set DataSimulator's dates.
            DataSimulator.DateTime1 = new DateTime(2013, 01, 01);
            DataSimulator.DateTime2 = new DateTime(2013, 12, 31);

            // Add 4 hours bars (14400 seconds) for ins1.
            BarFactory.Add(instrument1, BarType.Time, barSize);

            // Run.
            StartStrategy();
        }
 public void add_default_strategy_expect_exception_due_to_existing_registration()
 {
     // This is a BOMB, it go BOOM //
     Strategy.AddStrategy <IStringSearch>(new StringSearch(), As.Default);
 }
Пример #18
0
        public override void Run()
        {
            MulticoreOptimizer optimizer = new MulticoreOptimizer(this.framework);


            OptimizationUniverse universe = new OptimizationUniverse();

            for (decimal Delta = 1; Delta < 8; Delta++)
            {
                OptimizationParameterSet parameter = new OptimizationParameterSet();

                parameter.Add("Delta", Delta);

                universe.Add(parameter);
            }
            Instrument spreadInsturment = InstrumentManager.Get("*NG 01-15 vs *NG 02-15");

            // Add spread instrument if needed.
            if (spreadInsturment == null)
            {
                spreadInsturment = new Instrument(InstrumentType.Future, "*NG 01-15 vs *NG 02-15");

                InstrumentManager.Add(spreadInsturment);
            }

            spreadInsturment.Legs.Clear();

            // Add legs for spread instrument if needed.
            if (spreadInsturment.Legs.Count == 0)
            {
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("*NG 01-15"), 1));
                spreadInsturment.Legs.Add(new Leg(InstrumentManager.Get("*NG 02-15"), 1));
            }

            // Main strategy.
            strategy = new Strategy(framework, "SpreadTrading");

            // Create BuySide strategy and add trading instrument.
            MyStrategy buySide = new MyStrategy(framework, "BuySide");

            buySide.Instruments.Add(spreadInsturment);

            // Create SellSide strategy.
            SpreadSellSide sellSide = new SpreadSellSide(framework, "SellSide");

            //sellSide.Global[SpreadSellSide.barSizeCode] = barSize;

            // Set SellSide as data and execution provider for BuySide strategy.
            buySide.DataProvider      = sellSide;
            buySide.ExecutionProvider = sellSide;

            // Add strategies to main.
            strategy.AddStrategy(buySide);
            strategy.AddStrategy(sellSide);

            // Set DataSimulator's dates.
            DataSimulator.DateTime1 = new DateTime(2014, 11, 18);            // 1 day before real start
            DataSimulator.DateTime2 = new DateTime(2014, 12, 30);            // 1 day after real end

            InstrumentList instruments = new InstrumentList();

            instruments.Add(spreadInsturment);

            strategy.AddInstruments(instruments);

            //You can choose an optimization method from the "Optimizers" window
            //and observe the optimization results in the "Optimization Results" window.

            //Optimization can use either of two ways to declare parameters:

            //1. Optimization using [OptimizationParameter] atrributes from Strategy

            //Optimize(strategy);

            //2. Optimization via OptimizationUniverse
            optimizer.Optimize(strategy, universe);
        }