private void UnsubscribeFromPositions() { if ((igStreamApiClient != null) && (_l1PositionPricesTableKey != null) && (LoggedIn)) { igStreamApiClient.UnsubscribeTableKey(_l1PositionPricesTableKey); _l1PositionPricesTableKey = null; UpdatePositionMessage("PositionViewModel : Unsubscribing from Positions"); } }
public WatchlistsViewModel() { _watchlists = new ObservableCollection<IgPublicApiData.WatchlistModel>(); _watchlistMarkets = new ObservableCollection<IgPublicApiData.WatchlistMarketModel>(); // Initialise to first index in datagrid. WatchlistIndex = 0; WatchlistMarketIndex = 0; WireCommands(); _l1PricesSubscription = new L1PricesSubscription(this); _watchlistL1PricesSubscribedTableKey = new SubscribedTableKey(); _watchlistL1PricesSubscribedTableKey = null; }
public OrdersViewModel() { InitialiseViewModel(); _orders = new ObservableCollection<IgPublicApiData.OrderModel>(); WireCommands(); // Initialise LS subscriptions _l1OrderPricesSubscription = new L1OrderPricesSubscription(this); // initialise the LS SubscriptionTableKeys _orderPricesSubscriptionTableKey = new SubscribedTableKey(); // initialise to null _orderPricesSubscriptionTableKey = null; }
private void UnsubscribefromTradeSubscription() { if ((_tradeSubscriptionStk != null) && ( igStreamApiClient != null)) { igStreamApiClient.UnsubscribeTableKey(_tradeSubscriptionStk); _tradeSubscriptionStk = null; UpdateDebugMessage("Successfully unsubscribed from Trade Subscription"); } }
private void UnsubscribeFromAccountDetailsSubscription() { if ((_accountBalanceStk != null) && (igStreamApiClient != null)) { igStreamApiClient.UnsubscribeTableKey(_accountBalanceStk); _accountBalanceStk = null; UpdateDebugMessage("Successfully unsubscribed from Account Balance Subscription"); } }
// // Streaming Data ON/OFF... // private void cbPositions_CheckedChanged(object sender, EventArgs e) { if (cbPositions.CheckState == CheckState.Checked) { // Subscribe to positions... if ((_positions != null) && (_positions.Count > 0)) { // Now subscribe to live prices for these positions... _positionSubscription = new PositionSubscription(this); string[] uc = (from position in _positions where position.market.streamingPricesAvailable == true select position.market.epic) .Distinct().ToArray(); if (uc.Length > 0) { _positionSubscriptionStk = _igStreamApiClient.subscribeToMarketDetails( uc, _positionSubscription); } else { AppendActivityMessage("Streaming prices not enabled for these positions"); } } else { AppendActivityMessage("There are no Positions to subscribe too. Either server is not responding or there are no positions."); } } else { // Unsubscribe from positions... if ((_positionSubscriptionStk != null) && (_igStreamApiClient != null)) { _igStreamApiClient.UnsubscribeTableKey(_positionSubscriptionStk); } } }
private void btnLogout_Click(object sender, EventArgs e) { try { AppendActivityMessage("Logging out ..."); try { _igRestApiClient.logout(); } catch (Exception ex) { AppendActivityMessage(ex.Message); } EnableCommandButtons(false); if (_igStreamApiClient != null) { cbAccountSubscription.CheckState = CheckState.Unchecked; cbPositions.CheckState = CheckState.Unchecked; cbOrders.CheckState = CheckState.Unchecked; cbAccountSubscription.CheckState = CheckState.Unchecked; cbTradeSubscription.CheckState = CheckState.Unchecked; cbWatchlistItems.CheckState = CheckState.Unchecked; if (_tradeSubscriptionStk != null) { _igStreamApiClient.UnsubscribeTableKey(_tradeSubscriptionStk); _tradeSubscriptionStk = null; } if (_positionSubscriptionStk != null) { _igStreamApiClient.UnsubscribeTableKey(_positionSubscriptionStk); _positionSubscriptionStk = null; } if (_orderSubscriptionStk != null) { _igStreamApiClient.UnsubscribeTableKey(_orderSubscriptionStk); _orderSubscriptionStk = null; } if (_watchlistItemSubscriptionStk != null) { _igStreamApiClient.UnsubscribeTableKey(_watchlistItemSubscriptionStk); _watchlistItemSubscriptionStk = null; } if (_accountsStk != null) { _igStreamApiClient.UnsubscribeTableKey(_accountsStk); _accountsStk = null; } _igStreamApiClient.disconnect(); } cbPositions.Enabled = false; cbOrders.Enabled = false; cbWatchlistItems.Enabled = false; cbTradeSubscription.Enabled = false; cbAccountSubscription.Enabled = false; AppendActivityMessage("Logged out"); } catch (Exception ex) { AppendActivityMessage(ex.Message); } }
internal virtual void RequestItemsSubscr(VirtualTableManager table, SubscribedTableKey[] subscrKeys, BatchMonitor batch) { string[] tableCodes = new string[subscrKeys.Length]; for (int i = 0; i < subscrKeys.Length; i++) { tableCodes[i] = subscrKeys[i].KeyValue.ToString(); } this.Check(); try { this.serverTranslator.CallItemsRequest(this.serverInfo, tableCodes, table, batch); } catch (IOException exception) { throw new PushConnException(exception); } catch (WebException exception2) { throw new PushConnException(exception2); } this.Check(); }
internal virtual void DelSubscrs(SubscribedTableKey[] subscrKeys, BatchMonitor batch) { string[] tableCodes = new string[subscrKeys.Length]; for (int i = 0; i < subscrKeys.Length; i++) { tableCodes[i] = subscrKeys[i].KeyValue.ToString(); } this.Check(); try { this.serverTranslator.CallDelete(this.userId, this.serverInfo, tableCodes, batch); } catch (PushUserException exception) { protLogger.Debug("Refused delete request", exception); throw new PushServerException(9); } catch (IOException exception2) { throw new PushConnException(exception2); } catch (WebException exception3) { throw new PushConnException(exception3); } this.Check(); }
public virtual void ForceUnsubscribeTable(SubscribedTableKey tableKey) { ServerManager connManager = this.ConnManager; if (tableKey.KeyValue != -1) { SubscribedTableKey[] subscrKeys = new SubscribedTableKey[] { tableKey }; try { connManager.UnsubscrTables(subscrKeys, false); } catch (PhaseException) { throw new SubscrException("Connection closed"); } } }
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); } } }
private void UnsubscribeFromOrders() { if ((igStreamApiClient != null) && (_orderPricesSubscriptionTableKey != null) && (LoggedIn)) { igStreamApiClient.UnsubscribeTableKey(_orderPricesSubscriptionTableKey); _orderPricesSubscriptionTableKey = null; UpdateOrdersMessage("Unsubscribed from OrderPrices"); } }
public void SubscribeToL1OrderPrices(string[] orderSubs) { try { // Subscribe to L1 price updates for these orders... if (igStreamApiClient != null) { _orderPricesSubscriptionTableKey = igStreamApiClient.subscribeToMarketDetails(orderSubs, _l1OrderPricesSubscription); UpdateOrdersMessage("Subscribed Successfully to orders"); } } catch (Exception ex) { UpdateOrdersMessage("Could not subscribe to L1 Prices for orders" + ex.Message); } }
public DemoDotNetClientForm() { InitializeComponent(); _accountIds = new Dictionary<string, string>(); _accountsStk = new SubscribedTableKey(); EnableCommandButtons(false); _watchlists = new List<Watchlist>(); _watchlistMarkets = new List<WatchlistMarket>(); _orders = new List<WorkingOrder>(); _positions = new List<OpenPosition>(); cbPositions.Enabled = false; cbOrders.Enabled = false; cbWatchlistItems.Enabled = false; _igRestApiClient = new IgRestApiClient(); _igStreamApiClient = new IGStreamingApiClient(); _APIKey = "8d341413c2eae2c35bb5b47a594ef08ae18cb3b7"; // *** TODO ENTER YOUR API KEY HERE *** passwordTextbox.Text = "Kotik0483"; // *** TODO Enter your password here *** identifierTextbox.Text = "ksbitlsoftdemo"; // *** TODO Enter your user name here *** }
private void cbTradeSubscription_CheckedChanged(object sender, EventArgs e) { try { if (_igStreamApiClient != null) { if (cbTradeSubscription.CheckState == CheckState.Checked) { _tradeConfirmsSubscription = new TradeConfirmsSubscription(this); _tradeSubscriptionStk = _igStreamApiClient.subscribeToTradeSubscription(_currentAccount, _tradeConfirmsSubscription); AppendActivityMessage("TradeSubscription : Subscribe"); } else { if (_tradeSubscriptionStk != null) { _igStreamApiClient.UnsubscribeTableKey(_tradeSubscriptionStk); AppendActivityMessage("TradeSubscription : Unsubscribe"); } } } } catch (Exception ex) { AppendStreamingDataMessage(ex.Message); } }
private void cbAccountSubscription_CheckedChanged(object sender, EventArgs e) { if (cbAccountSubscription.CheckState == CheckState.Checked) { try { if (_currentAccount != null) { _accountBalanceSubscription = new AccountBalanceSubscription(this); if (_igStreamApiClient != null) { _accountsStk = _igStreamApiClient.subscribeToAccountDetailsKey(_currentAccount, _accountBalanceSubscription); AppendActivityMessage("AccountDetails : Successfully Subscribed"); } } } catch (Exception ex) { AppendStreamingDataMessage(ex.Message); } } else { if ((_accountsStk != null) && ( _igStreamApiClient != null)) { _igStreamApiClient.UnsubscribeTableKey(_accountsStk); AppendActivityMessage("AccountDetails : Unsubscribe"); } } }
public void SubscribeToAccountDetails() { try { if (CurrentAccountId != null) { _accountBalanceStk = new SubscribedTableKey(); _accountBalanceStk = igStreamApiClient.subscribeToAccountDetailsKey(CurrentAccountId, _accountBalanceSubscription); UpdateDebugMessage("Lightstreamer - Subscribing to Account Details"); } } catch (Exception ex) { UpdateDebugMessage("ApplicationViewModel - SubscribeToAccountDetails" + ex.Message); } }
public virtual void UnsubscribeTables(SubscribedTableKey[] tableKeys) { int num2; ServerManager connManager = this.ConnManager; ITableManager[] managerArray = connManager.DetachTables(tableKeys); int num = 0; for (num2 = 0; num2 < managerArray.Length; num2++) { if (managerArray[num2] != null) { managerArray[num2].NotifyUnsub(); num++; } } if (num == 0) { } SubscribedTableKey[] subscrKeys = new SubscribedTableKey[num]; int index = 0; for (num2 = 0; num2 < managerArray.Length; num2++) { if (managerArray[num2] != null) { subscrKeys[index] = tableKeys[num2]; index++; } } try { connManager.UnsubscrTables(subscrKeys, true); } catch (PhaseException) { throw new SubscrException("Connection closed"); } }
public void SubscribeToTradeSubscription() { try { if (CurrentAccountId != null) { _tradeSubscriptionStk = new SubscribedTableKey(); _tradeSubscriptionStk = igStreamApiClient.subscribeToTradeSubscription(CurrentAccountId, _tradeSubscription); UpdateDebugMessage("Lightstreamer - Subscribing to CONFIRMS, Working order updates and open position updates"); } } catch (Exception ex) { UpdateDebugMessage("ApplicationViewModel - SubscribeToTradeSubscription" + ex.Message); } }
private void cbOrders_CheckedChanged(object sender, EventArgs e) { try { if (cbOrders.CheckState == CheckState.Checked) { if ((_orders != null) && (_orders.Count > 0)) { _orderSubscription = new OrderSubscription(this); string[] ue = (from order in _orders where order.marketData.streamingPricesAvailable select order.marketData.epic) .Distinct().ToArray(); if (ue.Length > 0) { _orderSubscriptionStk = _igStreamApiClient.subscribeToMarketDetails( (from order in _orders where order.marketData.streamingPricesAvailable select order.marketData.epic) .Distinct().ToArray(), _orderSubscription); } else { AppendActivityMessage("These orders do not have streaming prices enabled"); } } else { AppendActivityMessage("there are no Orders to subscribe too. Either server is not responding or there are no orders."); } } else { // Unsubscribe from positions... if ((_orderSubscriptionStk != null) && (_igStreamApiClient != null)) { _igStreamApiClient.UnsubscribeTableKey(_orderSubscriptionStk); } } } catch (Exception ex) { AppendActivityMessage("Warning - problems subscribing to orders : " + ex.Message); } }
public virtual void UnsubscribeTable(SubscribedTableKey tableKey) { ServerManager connManager = this.ConnManager; if (tableKey.KeyValue != -1) { SubscribedTableKey[] subscrKeys = new SubscribedTableKey[] { tableKey }; ITableManager[] managerArray = connManager.DetachTables(subscrKeys); if (managerArray[0] == null) { try { connManager.UnsubscrTables(new SubscribedTableKey[0], true); } catch (PhaseException) { } throw new SubscrException("Table not found"); } managerArray[0].NotifyUnsub(); try { connManager.UnsubscrTables(subscrKeys, true); } catch (PhaseException) { throw new SubscrException("Connection closed"); } } }
void IAbstractStreamingClient.UnsubscribeTradeSubscription(SubscribedTableKey tableListener) { _tradingEventTable = null; }
void IAbstractStreamingClient.UnsubscribeTradeSubscription(SubscribedTableKey tableListener) { throw new ApplicationException("ActiveTick API is not for trading, only for market data"); }
public void SubscribeToBrowsePrices(string[] epics) { try { // Subscribe to L1 price updates for the instruments contained in this browse node... _browseSubscriptionTableKey = igStreamApiClient.subscribeToMarketDetails(epics, _l1BrowsePricesSubscription); UpdateMessage("Subscribed Successfully to instruments contained within this browse node."); } catch (Exception ex) { UpdateMessage("Could not subscribe to browse instruments : " + ex.Message); } }
internal virtual void RequestSubscr(ITableManager table, SubscribedTableKey subscrKey, BatchMonitor batch) { string tableCode = subscrKey.KeyValue.ToString(); this.Check(); try { this.serverTranslator.CallTableRequest(this.serverInfo, tableCode, table, batch); } catch (IOException exception) { throw new PushConnException(exception); } catch (WebException exception2) { throw new PushConnException(exception2); } this.Check(); }
public void UnsubscribeFromBrowsePrices() { if ((igStreamApiClient != null) && (_browseSubscriptionTableKey != null) && (LoggedIn)) { igStreamApiClient.UnsubscribeTableKey(_browseSubscriptionTableKey); _browseSubscriptionTableKey = null; UpdateMessage("Unsubscribed from Browse Node Prices"); } }
public void SubscribeToL1PositionPrices(string[] positionSubs) { try { if (igStreamApiClient != null) { _l1PositionPricesTableKey = igStreamApiClient.subscribeToMarketDetails(positionSubs, _l1PricesSubscription); UpdatePositionMessage("Successfully subscribed to positions"); } } catch (Exception ex) { UpdatePositionMessage("Problem subscribing to positions: " + ex.Message); } }
public BrowseViewModel() { InitialiseViewModel(); _browseNodes = new ObservableCollection<HierarchyNode>(); _browseMarkets = new ObservableCollection<IgPublicApiData.BrowseModel>(); NodeIndex = 0; // Initialise LS subscriptions _l1BrowsePricesSubscription = new L1BrowsePricesSubscription(this); // initialise the LS SubscriptionTableKeys _browseSubscriptionTableKey = new SubscribedTableKey(); _browseSubscriptionTableKey = null; WireCommands(); }
public PositionsViewModel() { InitialiseViewModel(); _positions = new ObservableCollection<IgPublicApiData.PositionModel>(); // Initialise LS subscriptions _l1PricesSubscription = new L1PricesSubscription(this); // initialise the LS SubscriptionTableKeys _l1PositionPricesTableKey = new SubscribedTableKey(); // Important to initialise to null. _l1PositionPricesTableKey = null; }
public void UnsubscribeTableKey(SubscribedTableKey stk) { try { if (lsClient != null) { lsClient.UnsubscribeTable(stk); } } catch (Exception) { } }