示例#1
0
        protected void AddSecurities(Securities sec)
        {
            if (!secDict.ContainsKey(sec.Symbol))
            {
                _log.Debug("订阅{0}股票价格", sec.Symbol);

                secDict.Add(sec.Symbol, sec);

                String path1       = String.Format("/user/{0}", ConstantsHelper.AKKA_PATH_MARKET_MANAGER);
                var    marketActor = Context.ActorSelection(path1);
                // 增加一个关注的股票
                MarketRequest request = new MarketRequest()
                {
                    Type = MarketRequest.RequestType.ADD_SECURITIES, Body = sec
                };
                marketActor.Tell(request);
                //var ret = marketActor.Ask<Object>(request, TimeSpan.FromSeconds(2));
                //ret.Wait();

                //
                String path     = String.Format("/user/{0}/{1}", ConstantsHelper.AKKA_PATH_MARKET_MANAGER, sec.Symbol);
                var    secActor = Context.ActorSelection(path);
                SecuritiesQuotationRequest req = new SecuritiesQuotationRequest()
                {
                    Type = SecuritiesQuotationRequest.RequestType.WATCH_QUOTEDATA,
                    Body = Desc.Id
                };
                secActor.Tell(req);
                symbolPriceActors.Add(sec.Symbol, secActor);
            }
        }
示例#2
0
        protected void AddSecurities(Securities sec)
        {
            secDict.Add(sec.Symbol, sec);

            String path     = String.Format("/user/{0}/{1}", ConstantsHelper.AKKA_PATH_MARKET_MANAGER, sec.Symbol);
            var    secActor = Context.ActorSelection(path);
            SecuritiesQuotationRequest req = new SecuritiesQuotationRequest()
            {
                Type = SecuritiesQuotationRequest.RequestType.WATCH_QUOTEDATA,
                Body = Desc.Id
            };

            secActor.Tell(req);
            symbolPriceActors.Add(sec.Symbol, secActor);
        }