Example #1
0
        private void stServer_UpdateQuote(string symbol, DateTime datetime, double open, double high, double low, double close, double last, double volume, double size, double bid, double ask, double bidsize, double asksize, double open_int, double go_buy, double go_sell, double go_base, double go_base_backed, double high_limit, double low_limit, int trading_status, double volat, double theor_price)
        {
            SymbolSummary item =
                new SymbolSummary(symbol,
                                  datetime,
                                  open,
                                  high,
                                  low,
                                  close,
                                  last,
                                  volume,
                                  size,
                                  ask,
                                  bid,
                                  asksize,
                                  bidsize,
                                  open_int,
                                  go_buy,
                                  go_sell,
                                  high_limit,
                                  low_limit,
                                  (trading_status == 0) ? true : false);

            this.logger.Log(String.Format("{0:dd/MM/yyyy H:mm:ss.fff}, {1}, получен {2}",
                                          BrokerDateTime.Make(DateTime.Now),
                                          this.GetType().Name,
                                          item.ToString()));

            this.symbolsData.Get <HashSetOfNamedMutable <SymbolSummary> >().Add(item);
        }
Example #2
0
        public void SymbolSummary_constructor_test()
        {
            DateTime lastDealDate = DateTime.Now;

            SymbolSummary sSummary =
                new SymbolSummary("RTS-12.13_FT",
                                  lastDealDate,
                                  145000,
                                  146000,
                                  144000,
                                  144990,
                                  145800,
                                  250,
                                  50,
                                  145790,
                                  145780,
                                  30,
                                  40,
                                  1000000,
                                  8000,
                                  8100,
                                  151000,
                                  142000,
                                  true);

            Assert.IsInstanceOfType(sSummary, typeof(INamed));
            Assert.IsInstanceOfType(sSummary, typeof(IMutable <SymbolSummary>));

            Assert.AreEqual("RTS-12.13_FT", sSummary.Name);
            Assert.AreEqual(lastDealDate, sSummary.LastDealDate);
            Assert.AreEqual(145000, sSummary.Open);
            Assert.AreEqual(146000, sSummary.High);
            Assert.AreEqual(144000, sSummary.Low);
            Assert.AreEqual(144990, sSummary.Close);
            Assert.AreEqual(145800, sSummary.LastDealPrice);
            Assert.AreEqual(250, sSummary.Volume);
            Assert.AreEqual(50, sSummary.LastDealVolume);
            Assert.AreEqual(145790, sSummary.Offer);
            Assert.AreEqual(145780, sSummary.Bid);
            Assert.AreEqual(30, sSummary.OfferSize);
            Assert.AreEqual(40, sSummary.BidSize);
            Assert.AreEqual(1000000, sSummary.OpenVolume);
            Assert.AreEqual(8000, sSummary.BuyWarrantySum);
            Assert.AreEqual(8100, sSummary.SellWarrantySum);
            Assert.AreEqual(151000, sSummary.HighLimitPrice);
            Assert.AreEqual(142000, sSummary.LowLimitPrice);
            Assert.IsTrue(sSummary.IsTraded);
        }
Example #3
0
        public void SymbolSummary_ToString_test()
        {
            DateTime lastDealDate = DateTime.Now;

            SymbolSummary sSummary =
                new SymbolSummary("RTS-12.13_FT",
                                  lastDealDate,
                                  145000,
                                  146000,
                                  144000,
                                  144990,
                                  145800,
                                  250,
                                  50,
                                  145790,
                                  145780,
                                  30,
                                  40,
                                  1000000,
                                  8000,
                                  8100,
                                  151000,
                                  142000,
                                  true);

            string result = String.Format("SymbolSummary: {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17}",
                                          sSummary.Name,
                                          sSummary.LastDealDate,
                                          sSummary.Open,
                                          sSummary.High,
                                          sSummary.Low,
                                          sSummary.Close,
                                          sSummary.LastDealPrice,
                                          sSummary.Volume,
                                          sSummary.Offer,
                                          sSummary.Bid,
                                          sSummary.OfferSize,
                                          sSummary.BidSize,
                                          sSummary.OpenVolume,
                                          sSummary.BuyWarrantySum,
                                          sSummary.SellWarrantySum,
                                          sSummary.HighLimitPrice,
                                          sSummary.LowLimitPrice,
                                          sSummary.IsTraded);

            Assert.AreEqual(result, sSummary.ToString());
        }
Example #4
0
        public void SymbolsDataProvider_SymbolSummary_update_Arrived()
        {
            this.binder.Bind();
            Assert.AreEqual(0, this.symbolsDataContext.Get <IEnumerable <SymbolSummary> >().Count());

            this.stServer.EmulateUpdateQuoteArrival(
                "RTS-12.13_FT",
                new DateTime(2013, 12, 16),
                145000,
                146000,
                144000,
                144500,
                145500,
                300,
                400,
                145510,
                145520,
                100,
                200,
                500,
                600,
                700,
                800,
                900,
                150000,
                140000,
                1,
                1000,
                143000);

            Assert.AreEqual(1, this.symbolsDataContext.Get <IEnumerable <SymbolSummary> >().Count());

            this.stServer.EmulateUpdateQuoteArrival(
                "RTS-12.13_FT",
                new DateTime(2013, 12, 16),
                145000,
                146000,
                144000,
                144500,
                145590,
                300,
                400,
                145510,
                145520,
                100,
                200,
                500,
                600,
                700,
                800,
                900,
                150000,
                140000,
                1,
                1000,
                143000);

            Assert.AreEqual(1, this.symbolsDataContext.Get <IEnumerable <SymbolSummary> >().Count());

            SymbolSummary item = this.symbolsDataContext.Get <IEnumerable <SymbolSummary> >().First();

            Assert.AreEqual("RTS-12.13_FT", item.Name);
            Assert.AreEqual(145590, item.LastDealPrice);
            this.binder.Unbind();
        }