Example #1
0
        public Report Evaluate( IEnumerable<StockHandle> stocks, DateTime dateUnderAnalysis )
        {
            // XXX: system is only created to get the name for the report
            var system = myTradingSystemBuilder();
            var report = new BackTestingReport( system.Name, dateUnderAnalysis );
            var lockObj = new object();

            Parallel.ForEach( stocks, stock =>
            {
                using ( PerfMon.Profile( "Evaluating stock: {0}", stock.Isin ) )
                {
                    lock ( lockObj )
                    {
                        system = myTradingSystemBuilder();
                    }

                    var systemResult = system.Evaluate( stock, dateUnderAnalysis );
                    var tradingResult = PerformBackTesting( systemResult );

                    lock ( lockObj )
                    {
                        report.AddResult( tradingResult );
                    }
                }
            } );

            return report;
        }
Example #2
0
        public Report Evaluate(IEnumerable <StockHandle> stocks, DateTime dateUnderAnalysis)
        {
            // XXX: system is only created to get the name for the report
            var system  = myTradingSystemBuilder();
            var report  = new BackTestingReport(system.Name, dateUnderAnalysis);
            var lockObj = new object();

            Parallel.ForEach(stocks, stock =>
            {
                using (PerfMon.Profile("Evaluating stock: {0}", stock.Isin))
                {
                    lock ( lockObj )
                    {
                        system = myTradingSystemBuilder();
                    }

                    var systemResult  = system.Evaluate(stock, dateUnderAnalysis);
                    var tradingResult = PerformBackTesting(systemResult);

                    lock ( lockObj )
                    {
                        report.AddResult(tradingResult);
                    }
                }
            });

            return(report);
        }