Example #1
0
        public StudioConnector()
        {
            EntityFactory = new StudioEntityFactory(this);

            _marketDataAdapter = new StudioMarketDataAdapter(TransactionIdGenerator);

            Adapter.InnerAdapters.Add(_marketDataAdapter.ToChannel(this, "MD"));

            CreateEmulationSessionHolder();

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

            cmdSvc.Register <LookupSecuritiesCommand>(this, false, cmd => LookupSecurities(cmd.Criteria));
            cmdSvc.Register <RequestTradesCommand>(this, false, cmd => new NewTradesCommand(Trades).Process(this));
            //cmdSvc.Register<RequestPortfoliosCommand>(this, cmd => Portfolios.ForEach(pf => new PortfolioCommand(pf, true).Process(this)));
            cmdSvc.Register <RequestPositionsCommand>(this, false, cmd => Positions.ForEach(pos => new PositionCommand(CurrentTime, pos, true).Process(this)));
            cmdSvc.Register <RequestMarketDataCommand>(this, false, cmd => AddExport(cmd.Security, cmd.Type));
            cmdSvc.Register <RefuseMarketDataCommand>(this, false, cmd => RemoveExport(cmd.Security, cmd.Type));

            //NewPortfolios += portfolios => portfolios.ForEach(pf => new PortfolioCommand(pf, true).Process(this));
            PortfoliosChanged      += portfolios => portfolios.ForEach(pf => new PortfolioCommand(pf, false).Process(this));
            NewPositions           += positions => positions.ForEach(pos => new PositionCommand(CurrentTime, pos, true).Process(this));
            PositionsChanged       += positions => positions.ForEach(pos => new PositionCommand(CurrentTime, pos, false).Process(this));
            NewTrades              += trades => new NewTradesCommand(trades).Process(this);
            NewNews                += news => new NewNewsCommand(news).Process(this);
            LookupSecuritiesResult += securities => new LookupSecuritiesResultCommand(securities).Process(this);
            //LookupPortfoliosResult += portfolios => new LookupPortfoliosResultCommand(portfolios).Process(this);

            UpdateSecurityLastQuotes = false;
            UpdateSecurityByLevel1   = false;
        }
Example #2
0
		public StudioConnector()
		{
			EntityFactory = new StorageEntityFactory(ConfigManager.GetService<IEntityRegistry>(), ConfigManager.GetService<IStorageRegistry>());

			_marketDataAdapter = new StudioMarketDataAdapter(TransactionIdGenerator);

			Adapter.InnerAdapters.Add(_marketDataAdapter);

			CreateEmulationSessionHolder();

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

			cmdSvc.Register<LookupSecuritiesCommand>(this, false, cmd => LookupSecurities(cmd.Criteria));
			cmdSvc.Register<RequestTradesCommand>(this, false, cmd => new NewTradesCommand(Trades).Process(this));
			//cmdSvc.Register<RequestPortfoliosCommand>(this, cmd => Portfolios.ForEach(pf => new PortfolioCommand(pf, true).Process(this)));
			cmdSvc.Register<RequestPositionsCommand>(this, false, cmd => Positions.ForEach(pos => new PositionCommand(CurrentTime, pos, true).Process(this)));
			cmdSvc.Register<RequestMarketDataCommand>(this, false, cmd => AddExport(cmd.Security, cmd.Type));
			cmdSvc.Register<RefuseMarketDataCommand>(this, false, cmd => RemoveExport(cmd.Security, cmd.Type));

			//NewPortfolios += portfolios => portfolios.ForEach(pf => new PortfolioCommand(pf, true).Process(this));
			PortfoliosChanged += portfolios => portfolios.ForEach(pf => new PortfolioCommand(pf, false).Process(this));
			NewPositions += positions => positions.ForEach(pos => new PositionCommand(CurrentTime, pos, true).Process(this));
			PositionsChanged += positions => positions.ForEach(pos => new PositionCommand(CurrentTime, pos, false).Process(this));
			NewTrades += trades => new NewTradesCommand(trades).Process(this);
			NewNews += news => new NewNewsCommand(news).Process(this);
			LookupSecuritiesResult += securities => new LookupSecuritiesResultCommand(securities).Process(this);
			//LookupPortfoliosResult += portfolios => new LookupPortfoliosResultCommand(portfolios).Process(this);

			UpdateSecurityLastQuotes = false;
			UpdateSecurityByLevel1 = false;
		}