Exemple #1
0
        private async void Market_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Securities.Clear();
            Boards.Clear();

            Info    = "";
            History = new List <HistoryObject>();
            FirePropertyChanged(nameof(Info));
            FirePropertyChanged(nameof(History));

            try
            {
                foreach (var item in
                         await Task <IEnumerable <Item> > .Run(() =>
                {
                    return(new MarketSecuritiesListRequest(Engine.Value, Market.Value).Response.Securities.Data.Select(d =>
                                                                                                                       new Item
                    {
                        Name = $"{d["SECID"]}",
                        Value = d["SECID"],
                        Data = d
                    }).Distinct(new ItemEqvCmp()));
                }))
                {
                    Securities.Add(item);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemple #2
0
        void Refresh()
        {
            try
            {
                Engines.Clear();

                foreach (var item in new EnginesRequest().Response.Engines.Data.Select(d => new Item()
                {
                    Name = d["title"],
                    Value = d["name"],
                    Data = d
                }))
                {
                    Engines.Add(item);
                }


                Markets.Clear();
                Securities.Clear();
                Boards.Clear();

                Info    = "";
                History = new List <HistoryObject>();

                FirePropertyChanged(nameof(Info));
                FirePropertyChanged(nameof(History));
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error");
            }
        }
Exemple #3
0
        private void Engine_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                Markets.Clear();
                foreach (var item in new MarketsRequest(Engine.Value).Response.Markets.Data.Select(d =>
                                                                                                   new Item
                {
                    Name = d["title"],
                    Value = d["NAME"],
                    Data = d
                }
                                                                                                   ))
                {
                    Markets.Add(item);
                }

                Securities.Clear();
                Boards.Clear();

                Info    = "";
                History = new List <HistoryObject>();
                FirePropertyChanged(nameof(Info));
                FirePropertyChanged(nameof(History));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
        public void Stop()
        {
            IsStarted = false;
            _session.MarketDataChanged              -= MarketDataUpdate;
            _session.HistoricMarketDataReceived     -= SessionOnHistoricMarketDataReceived;
            _session.EventStreamSessionDisconnected -= NotifySessionDisconnect;
            _session.Logout(() => { }, FailureCallback);

            lock (Securities)
            {
                Securities.Clear();
                _securities.Clear();
            }

            lock (_originalHistoryRequestParameters)
                _originalHistoryRequestParameters.Clear();

            lock (_historyRequestHandlers)
                _historyRequestHandlers.Clear();

            lock (_subscribedSymbols)
                _subscribedSymbols.Clear();

            lock (_bidAskCache)
                _bidAskCache.Clear();

            try
            {
                _session.Stop();
                _session = null;
            }
            catch (Exception ex)
            {
                Logger.Error("LMAX stop exception.", ex);
            }
        }
 public override void Clear()
 {
     Fields.Clear();
     Securities.Clear();
 }