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


C# Exchange.ToString方法代码示例

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


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

示例1: ConnectTo

        public IConnection ConnectTo(Exchange exchange)
        {
            _log.Debug("Getting connection for exchange: " + exchange.ToString());
            IConnection connection = null;

            // first, see if we have a cached connection
            if (_connections.ContainsKey(exchange))
            {
                connection = _connections[exchange];

                if (!connection.IsOpen)
                {
                    _log.Info("Cached connection to RabbitMQ was closed: reconnecting");
                    connection = this.CreateConnection(exchange);
                }
            }
            else
            {
                _log.Debug("No connection to the exchange was cached: creating");
                connection = this.CreateConnection(exchange);

                // add the new connection to the cache
                _connections[exchange] = connection;
            }

            return connection;
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:27,代码来源:BaseConnectionFactory.cs

示例2: 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

示例3: GetSymbolForMarket

        public static List<StockModel.Symbol> GetSymbolForMarket(Exchange exchange)
        {
            // Method to get all the company names & their symbols and set their default value & Id
            int i = 1;

            Random random = new Random();
            List<StockModel.Symbol> symbols = new List<StockModel.Symbol>();
            string jsonString;
            string symbolFilePath = string.Empty;

            //exchange specific symbol file paths are configured
            symbolFilePath = WebConfigurationManager.AppSettings[exchange.ToString() + "_SymbolFilePath"];

            //exchange specific symbol file paths are not configured. Pick Defaults.
            if (string.IsNullOrEmpty(symbolFilePath))
            {
                symbolFilePath = WebConfigReader.Read("SymbolFilePath");
            }

            jsonString = System.IO.File.ReadAllText(symbolFilePath);

            JArray jsonArray = JsonConvert.DeserializeObject<JArray>(jsonString);

            foreach (JObject jsonObject in jsonArray)
            {
                StockModel.Symbol symbol = new StockModel.Symbol();
                foreach (var property in jsonObject)
                {
                    if (property.Key == "Name")
                    {
                        symbol.SymbolName = property.Value.ToString();
                    }
                    if (property.Key == "Symbol")
                    {
                        symbol.SymbolCode = property.Value.ToString();
                    }

                    symbol.DefaultVal = random.NextDouble() * 1000;
                    symbol.Id = i;
                }
                i = i + 1;
                symbols.Add(symbol);
            }

            return symbols;
        }
开发者ID:togglebrain,项目名称:stock-analytics,代码行数:46,代码来源:SymbolService.cs


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