public override bool Equals(object obj)
        {
            MarketBookInformation other = obj as MarketBookInformation;

            if (other == null)
            {
                return(false);
            }

            bool runners0AreEqual = ExPricesRunner0.Equals(other.ExPricesRunner0);
            bool runners1AreEqual = ExPricesRunner1.Equals(other.ExPricesRunner1);

            return(runners0AreEqual && runners1AreEqual);
        }
Example #2
0
        public void UpdateMarket()
        {
            List <MarketInformation> marketBook = modelCore.GetMarketBook(new List <string> {
                MarketId
            });

            MarketBookInformation recordJustReceived = marketBook[0].Mbi.Last();

            recordJustReceived.MarketName = MarketName; //проброс MarketName в MarketBookInformation при добавлении новых рыночных данных

            //добавляем только в том случае, если полученные данные отличаются от уже полученных ранее
            if (Mbi.LastOrDefault() != recordJustReceived)
            {
                Mbi.Add(recordJustReceived);
                //MessageBox.Show("Дык!");
            }
        }
Example #3
0
        public MarketInformation()
        {
            _mbi = new ObservableCollection <MarketBookInformation>();

            MarketBookInformation mbi = new MarketBookInformation()
            {
                MarketName  = this.MarketName,
                Runner0Name = this.Runner0Name,
                Runner1Name = this.Runner1Name,

                ExPricesRunner0 = new ExchangePrices()
                {
                    AvailableToBack = new ObservableCollection <PriceSize> {
                        new PriceSize(), new PriceSize(), new PriceSize()
                    },
                    AvailableToLay = new ObservableCollection <PriceSize> {
                        new PriceSize(), new PriceSize(), new PriceSize()
                    }
                },

                ExPricesRunner1 = new ExchangePrices()
                {
                    AvailableToBack = new ObservableCollection <PriceSize> {
                        new PriceSize(), new PriceSize(), new PriceSize()
                    },
                    AvailableToLay = new ObservableCollection <PriceSize> {
                        new PriceSize(), new PriceSize(), new PriceSize()
                    }
                }
            };

            Mbi.Add(mbi);

            //обработчик изменений внутри Mdi
            _mbiChangeHandler     = (sender, e) => OnPropertyChanged("Mbi");
            _mbiChangeItemHandler = (sender, e) => OnPropertyChanged("Mbi");
        }
Example #4
0
        public List <MarketInformation> GetMarketBook(List <string> mIDs)
        {
            List <MarketInformation> result = new List <MarketInformation>();
            BetfairServerResponse <List <MarketBook> > receivedData = ListMarketBook(mIDs);

            List <MarketBook> marketbook = receivedData.Response;

            foreach (var mb in marketbook)
            {
                MarketBookInformation mbi = new MarketBookInformation()
                {
                    NumberOfRunners = mb.NumberOfRunners,
                    NumberOfWinners = mb.NumberOfWinners,
                    Status          = mb.Status,
                    ExPricesRunner0 = mb.Runners[0].ExchangePrices,
                    ExPricesRunner1 = mb.Runners[1].ExchangePrices,
                    LastByte        = receivedData.LastByte,
                    IsInplay        = mb.IsInplay,
                };

                result.Add(new MarketInformation()
                {
                    MarketId = mb.MarketId,
                    Mbi      = new ObservableCollection <MarketBookInformation> {
                        mbi
                    }
                });

                // TEST !!!
                //удаляем для рынка "123464" AvailableToBack[2] для тестовых нужд
                //if (mb.MarketId == "123464")
                //    mb.Runners[1].ExchangePrices.AvailableToBack.RemoveAt(2);
            }

            return(result);
        }