当前位置: 首页>>代码示例>>C#>>正文


C# ISender.SendMVA方法代码示例

本文整理汇总了C#中ISender.SendMVA方法的典型用法代码示例。如果您正苦于以下问题:C# ISender.SendMVA方法的具体用法?C# ISender.SendMVA怎么用?C# ISender.SendMVA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISender的用法示例。


在下文中一共展示了ISender.SendMVA方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        /// <summary>
        /// Application arguments:
        /// arg0: Selected Exchange. Has to be enum StockModel.Master.Exchange
        /// arg1: Data generator to use. Has to be IDataPublisher.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //Loading system startup data for all the exchanges
            List<Exchange> exchanges = new List<Exchange>();

            //defaults selected...
            selectedExchange = Exchange.FAKE_NASDAQ;
            dataGenerator = YahooDataGenerator.Instance;

            ResolveAppArgs(args);

            exchanges = Enum.GetValues(typeof(Exchange)).OfType<Exchange>().ToList();

            InMemoryObjects.LoadInMemoryObjects(exchanges);

            TimeSpan updateDuration = TimeSpan.FromMilliseconds(Constants.FAKE_DATA_GENERATE_PERIOD);

            //Start data generation - this will start fetching data for all symbols of current exchange
            //Later, need to change this to only subscribe to the specific symbol(s) selected.
            dataGenerator.StartDataGeneration(300, selectedExchange);

            sender = SenderFactory.GetSender(FeederQueueSystem.REDIS_CACHE);

            List<StockModel.Symbol> symbols = InMemoryObjects.ExchangeSymbolList.SingleOrDefault(x => x.Exchange == selectedExchange).Symbols;

            List<SymbolFeeds> generatedData = new List<SymbolFeeds>();
            List<StockModel.Symbol> symbolList = new List<StockModel.Symbol>();

            Action<double, string> addMovingAverage = new Action<double, string>((val,MVA_id) => {

                sender.SendMVA(val, MVA_id);

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Sent value {0} to redis", val);
                Console.ResetColor();
            });

            Parallel.ForEach(symbols, (symbol) =>
            {
                //subscribe
                dataGenerator.SubscribeFeed(symbol.Id, (Feed fd) =>
                {
                    sender.SendFeed(fd, selectedExchange.ToString());

                    Console.WriteLine(fd.ToString());
                });

                //add subscription for each aggregator configured
                //RXProcessing.AddAggregator(dataGenerator, new MovingAverage(),
                //    addMovingAverage
                //    , symbol.Id);
            });

            Console.Read();
        }
开发者ID:togglebrain,项目名称:stock-analytics,代码行数:61,代码来源:Program.cs


注:本文中的ISender.SendMVA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。