示例#1
0
        private void cbWatchlistItems_CheckedChanged(object sender, EventArgs e)
        {
            if (cbWatchlistItems.CheckState == CheckState.Checked)
            {
                // Subscribe to positions...
                if ((_watchlistMarkets != null) && (_watchlistMarkets.Count != 0))
                {
                    _watchlistItemSubscription = new WatchlistMarketSubscription(this);

                    string[] ue =
                        (from watchlistMarket in _watchlistMarkets
                         where watchlistMarket.streamingPricesAvailable
                         select watchlistMarket.epic)
                        .Distinct().ToArray();

                    if (ue.Length > 0)
                    {
                        _watchlistItemSubscriptionStk =
                            _igStreamApiClient.subscribeToMarketDetails(ue, _watchlistItemSubscription);
                    }
                    else
                    {
                        AppendActivityMessage("there are no streaming prices for these instruments");
                    }
                }
                else
                {
                    AppendActivityMessage("there are no Watchlist Items to subscribe too. Either server is not responding or there are no watchlist items");
                }
            }
            else
            {
                // Unsubscribe from watchlist items
                if ((_igStreamApiClient != null) && (_watchlistItemSubscriptionStk != null))
                {
                    _igStreamApiClient.UnsubscribeTableKey(_watchlistItemSubscriptionStk);
                }
            }
        }
示例#2
0
        private void cbWatchlistItems_CheckedChanged(object sender, EventArgs e)
        {
            if (cbWatchlistItems.CheckState == CheckState.Checked)
            {
                // Subscribe to positions...
                if ((_watchlistMarkets != null) && (_watchlistMarkets.Count != 0 ))
                {
                    _watchlistItemSubscription = new WatchlistMarketSubscription(this);

					string[] ue =
						  (from watchlistMarket in _watchlistMarkets
						   where watchlistMarket.streamingPricesAvailable
						   select watchlistMarket.epic)
							  .Distinct().ToArray();

	                if (ue.Length > 0)
	                {
		                _watchlistItemSubscriptionStk =
			                _igStreamApiClient.subscribeToMarketDetails(ue, _watchlistItemSubscription);
	                }
	                else
	                {
						AppendActivityMessage("there are no streaming prices for these instruments");
	                }
                }
                else
                {
                    AppendActivityMessage("there are no Watchlist Items to subscribe too. Either server is not responding or there are no watchlist items");
                }
            }
            else
            {
                // Unsubscribe from watchlist items
                if ((_igStreamApiClient != null) && (_watchlistItemSubscriptionStk != null))
                {
                    _igStreamApiClient.UnsubscribeTableKey(_watchlistItemSubscriptionStk);
                }
            }
        }