Пример #1
0
        public StudioRegistryConnector(IConnector studioConnector)
        {
            EntityFactory = new StudioConnectorEntityFactory();

            MarketDataAdapter  = _adapter = new PassThroughMessageAdapter(new PassThroughSessionHolder(TransactionIdGenerator));
            TransactionAdapter = new PassThroughMessageAdapter(new PassThroughSessionHolder(TransactionIdGenerator));

            ApplyMessageProcessor(MessageDirections.In, true, true);
            ApplyMessageProcessor(MessageDirections.Out, true, true);

            _entityRegistry = ConfigManager.GetService <IStudioEntityRegistry>();
            _entityRegistry.Securities.Added += s => _adapter.SendOutMessage(s.ToMessage(GetSecurityId(s)));
            _entityRegistry.Portfolios.Added += p => _adapter.SendOutMessage(p.ToMessage());

            var cmdSvc = ConfigManager.GetService <IStudioCommandService>();

            //cmdSvc.Register<LookupSecuritiesCommand>(this, cmd => LookupSecurities(cmd.Criteria));
            cmdSvc.Register <RequestPortfoliosCommand>(this, false, cmd => Portfolios.ForEach(pf => new PortfolioCommand(pf, true).Process(this)));

            NewPortfolios += portfolios => portfolios.ForEach(pf => new PortfolioCommand(pf, true).Process(this));
            //NewPositions += positions => positions.ForEach(pos => new PositionCommand(pos, true).Process(this));

            // для корректной работы правил коннектор всегда должен быть реальным
            //NewSecurities += securities => securities.ForEach(s => s.Connector = studioConnector);
            NewPortfolios += portfolios => portfolios.ForEach(p => p.Connector = studioConnector);
        }
Пример #2
0
		public StudioRegistryConnector(IConnector studioConnector)
		{
			EntityFactory = new StudioConnectorEntityFactory();

			_adapter = new PassThroughMessageAdapter(TransactionIdGenerator);
			Adapter.InnerAdapters.Add(_adapter.ToChannel(this));

			_entityRegistry = ConfigManager.GetService<IStudioEntityRegistry>();
			_entityRegistry.Securities.Added += s => _adapter.SendOutMessage(s.ToMessage(GetSecurityId(s)));
			_entityRegistry.Portfolios.Added += p => _adapter.SendOutMessage(p.ToMessage());

			var cmdSvc = ConfigManager.GetService<IStudioCommandService>();

			//cmdSvc.Register<LookupSecuritiesCommand>(this, cmd => LookupSecurities(cmd.Criteria));
			cmdSvc.Register<RequestPortfoliosCommand>(this, false, cmd => Portfolios.ForEach(pf => new PortfolioCommand(pf, true).Process(this)));

			NewPortfolios += portfolios => portfolios.ForEach(pf => new PortfolioCommand(pf, true).Process(this));
			//NewPositions += positions => positions.ForEach(pos => new PositionCommand(pos, true).Process(this));

			// для корректной работы правил коннектор всегда должен быть реальным
			//NewSecurities += securities => securities.ForEach(s => s.Connector = studioConnector);
			NewPortfolios += portfolios => portfolios.ForEach(p => p.Connector = studioConnector);
		}