示例#1
0
        private void QuikConnectionMouseDoubleClick(object sender, RoutedEventArgs e)
        {
            if (_connector == null)
            {
                _connector = new Connector();

                if (QuikCheckBox.IsChecked == true)
                {
                    var quikTs = new LuaFixTransactionMessageAdapter(_connector.TransactionIdGenerator)
                    {
                        Login                = "******",
                        Password             = "******".To <SecureString>(),
                        Address              = "localhost:5001".To <EndPoint>(),
                        TargetCompId         = "StockSharpTS",
                        SenderCompId         = "quik",
                        ExchangeBoard        = ExchangeBoard.Forts,
                        Version              = FixVersions.Fix44,
                        RequestAllPortfolios = true,
                        MarketData           = FixMarketData.None,
                        UtcOffset            = TimeHelper.Moscow.BaseUtcOffset
                    };
                    var quikMd = new FixMessageAdapter(_connector.TransactionIdGenerator)
                    {
                        Login                = "******",
                        Password             = "******".To <SecureString>(),
                        Address              = "localhost:5001".To <EndPoint>(),
                        TargetCompId         = "StockSharpMD",
                        SenderCompId         = "quik",
                        ExchangeBoard        = ExchangeBoard.Forts,
                        Version              = FixVersions.Fix44,
                        RequestAllSecurities = true,
                        MarketData           = FixMarketData.MarketData,
                        UtcOffset            = TimeHelper.Moscow.BaseUtcOffset
                    };
                    _connector.Adapter.InnerAdapters[quikMd.ToChannel(_connector, "Quik MD")] = 1;
                    _connector.Adapter.InnerAdapters[quikTs.ToChannel(_connector, "Quik TS")] = 1;
                }

                if (SmartComCheckBox.IsChecked == true)
                {
                    var smartCom = new SmartComMessageAdapter(_connector.TransactionIdGenerator)
                    {
                        Login    = Login.Text,
                        Password = Password.Password.To <SecureString>(),
                        Address  = Address.SelectedAddress,
                    };
                    _connector.Adapter.InnerAdapters[smartCom.ToChannel(_connector, "SmartCOM")] = 0;
                }

                if (PlazaCheckBox.IsChecked == true)
                {
                    var pool = new PlazaConnectionPool();

                    _connector.Adapter.InnerAdapters[new PlazaTransactionMessageAdapter(_connector.TransactionIdGenerator, pool)
                                                     {
                                                         ConnectionPoolSettings =
                                                         {
                                                             IsCGate = true,
                                                         }
                                                     }.ToChannel(_connector, "Plaza TS")] = 0;
                    _connector.Adapter.InnerAdapters[new PlazaStreamMessageAdapter(_connector.TransactionIdGenerator, pool)
                                                     {
                                                         ConnectionPoolSettings =
                                                         {
                                                             IsCGate = true,
                                                         }
                                                     }.ToChannel(_connector, "Plaza MD")] = 0;
                }

                if (_connector.Adapter.InnerAdapters.Count == 0)
                {
                    MessageBox.Show(this, LocalizedStrings.Str2971);
                    return;
                }

                _securityProvider = new FilterableSecurityProvider(_connector);

                _connector.ConnectionError += error => this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959));
                _connector.Connect();
            }
            else
            {
                Disconnect();
            }
        }
示例#2
0
		private void QuikConnectionMouseDoubleClick(object sender, RoutedEventArgs e)
		{
			if (_connector == null)
			{
				_connector = new Connector();

				if (QuikCheckBox.IsChecked == true)
				{
					var quikTs = new LuaFixTransactionMessageAdapter(_connector.TransactionIdGenerator)
					{
						Login = "******",
						Password = "******".To<SecureString>(),
						Address = QuikTrader.DefaultLuaAddress,
						TargetCompId = "StockSharpTS",
						SenderCompId = "quik",
						ExchangeBoard = ExchangeBoard.Forts,
						Version = FixVersions.Fix44_Lua,
						RequestAllPortfolios = true,
						MarketData = FixMarketData.None,
						TimeZone = TimeHelper.Moscow
					};
					var quikMd = new FixMessageAdapter(_connector.TransactionIdGenerator)
					{
						Login = "******",
						Password = "******".To<SecureString>(),
						Address = QuikTrader.DefaultLuaAddress,
						TargetCompId = "StockSharpMD",
						SenderCompId = "quik",
						ExchangeBoard = ExchangeBoard.Forts,
						Version = FixVersions.Fix44_Lua,
						RequestAllSecurities = true,
						MarketData = FixMarketData.MarketData,
						TimeZone = TimeHelper.Moscow
					};
					quikMd.RemoveTransactionalSupport();

					_connector.Adapter.InnerAdapters[quikMd.ToChannel(_connector, "Quik MD")] = 1;
					_connector.Adapter.InnerAdapters[quikTs.ToChannel(_connector, "Quik TS")] = 1;
				}

				if (SmartComCheckBox.IsChecked == true)
				{
					var smartCom = new SmartComMessageAdapter(_connector.TransactionIdGenerator)
					{
						Login = Login.Text,
						Password = Password.Password.To<SecureString>(),
						Address = Address.SelectedAddress,
					};
					_connector.Adapter.InnerAdapters[smartCom.ToChannel(_connector, "SmartCOM")] = 0;
				}

				if (PlazaCheckBox.IsChecked == true)
				{
					var pool = new PlazaConnectionPool();

					_connector.Adapter.InnerAdapters[new PlazaTransactionMessageAdapter(_connector.TransactionIdGenerator, pool)
					{
						ConnectionPoolSettings =
						{
							IsCGate = true,
						}
					}.ToChannel(_connector, "Plaza TS")] = 0;
					_connector.Adapter.InnerAdapters[new PlazaStreamMessageAdapter(_connector.TransactionIdGenerator, pool)
					{
						ConnectionPoolSettings =
						{
							IsCGate = true,
						}
					}.ToChannel(_connector, "Plaza MD")] = 0;
				}

				if (_connector.Adapter.InnerAdapters.Count == 0)
				{
					MessageBox.Show(this, LocalizedStrings.Str2971);
					return;
				}

				_securityProvider = new FilterableSecurityProvider(_connector);

				_connector.ConnectionError += error => this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959));
				_connector.Connect();
			}
			else
			{
				Disconnect();
			}
		}