Пример #1
0
        /// <summary>
        /// Get an instance of the data feed handler we're requesting for this work.
        /// </summary>
        /// <param name="algorithm">User algorithm to scan for securities</param>
        /// <param name="job">Algorithm Node Packet</param>
        /// <returns>Class matching IDataFeed Interface</returns>
        private static IDataFeed GetDataFeedHandler(IAlgorithm algorithm, AlgorithmNodePacket job)
        {
            var df = default(IDataFeed);

            switch (job.DataEndpoint)
            {
            //default:
            ////Backtesting:
            case DataFeedEndpoint.Backtesting:
                df = new BacktestingDataFeed(algorithm, (BacktestNodePacket)job);
                Log.Trace("Engine.GetDataFeedHandler(): Selected Backtesting Datafeed");
                break;

            //Operation from local files:
            case DataFeedEndpoint.FileSystem:
                df = new FileSystemDataFeed(algorithm, (BacktestNodePacket)job);
                Log.Trace("Engine.GetDataFeedHandler(): Selected FileSystem Datafeed");
                break;

            //Live Trading Data Source:
            case DataFeedEndpoint.LiveTrading:
                df = new PaperTradingDataFeed(algorithm, (LiveNodePacket)job);
                Log.Trace("Engine.GetDataFeedHandler(): Selected LiveTrading Datafeed");
                break;

            case DataFeedEndpoint.Test:
                var feed = new TestLiveTradingDataFeed(algorithm, (LiveNodePacket)job);
                df = feed;
                Log.Trace("Engine.GetDataFeedHandler(): Selected Test Datafeed at " + feed.FastForward + "x");
                break;
            }
            return(df);
        }
Пример #2
0
        /// <summary>
        /// Get an instance of the data feed handler we're requesting for this work.
        /// </summary>
        /// <param name="algorithm">User algorithm to scan for securities</param>
        /// <param name="job">Algorithm Node Packet</param>
        /// <returns>Class matching IDataFeed Interface</returns>
        private static IDataFeed GetDataFeedHandler(IAlgorithm algorithm, AlgorithmNodePacket job)
        {
            var df = default(IDataFeed);

            switch (job.DataEndpoint)
            {
            //default:
            ////Backtesting:
            case DataFeedEndpoint.Backtesting:
                df = new BacktestingDataFeed(algorithm, (BacktestNodePacket)job);
                Log.Trace("Engine.GetDataFeedHandler(): Selected Backtesting Datafeed");
                break;

            case DataFeedEndpoint.Database:
                df = new DatabaseDataFeed(algorithm, (BacktestNodePacket)job);
                Log.Trace("Engine.GetDataFeedHandler(): Selected Database Datafeed");
                break;

            //Operation from local files:
            case DataFeedEndpoint.FileSystem:
                df = new FileSystemDataFeed(algorithm, (BacktestNodePacket)job);
                Log.Trace("Engine.GetDataFeedHandler(): Selected FileSystem Datafeed");
                break;

            //Live Trading Data Source:
            case DataFeedEndpoint.LiveTrading:
                var ds = Composer.Instance.GetExportedValueByTypeName <IDataQueueHandler>(Config.Get("data-queue-handler", "LiveDataQueue"));
                df = new PaperTradingDataFeed(algorithm, ds, (LiveNodePacket)job);
                Log.Trace("Engine.GetDataFeedHandler(): Selected LiveTrading Datafeed");
                break;
            }
            return(df);
        }