Esempio n. 1
0
        public CStockClassMod CreateStockClass()
        {
            CStockClassMod sc = new CStockClassMod();

            sc.StockListBids = new Dictionary <int, List <CStockMod> >();
            sc.StockListAsks = new Dictionary <int, List <CStockMod> >();

            sc.StockListBids[0] = new List <CStockMod>();
            sc.StockListBids[1] = new List <CStockMod>();

            sc.StockListAsks[0] = new List <CStockMod>();
            sc.StockListAsks[1] = new List <CStockMod>();



            return(sc);
        }
Esempio n. 2
0
        public void Test()
        {
            int szDecimals = sizeof(decimal);
            int szLong     = sizeof(long);

            int szDouble = sizeof(double);
            int szFloat  = sizeof(float);

            // int szDateTime = DateTime



            sc = CreateStockClass();

            InitStockClass();

            var bytes = CUtilProto.SerializeProto(sc);
        }
Esempio n. 3
0
        public void Copy(string isin, CStockClassMod scDist)
        {
            //scDist.StockList[0].Clear();
            //scDist.StockList[1].Clear();

            lock (scDist.Locker)
            {
                if (scDist.StockListBids == null)
                {
                    scDist.StockListBids = new Dictionary <int, List <CStockMod> >();
                }
                if (scDist.StockListAsks == null)
                {
                    scDist.StockListAsks = new Dictionary <int, List <CStockMod> >();
                }
                scDist.Isin = isin;
                //TODO use buffer copy
                scDist.StockListBids.Clear();
                scDist.StockListAsks.Clear();



                foreach (var kvp in StockListBids)
                {
                    int precision = kvp.Key;

                    if (!scDist.StockListBids.ContainsKey(precision))
                    {
                        scDist.StockListBids[precision] = new List <CStockMod>();
                    }

                    foreach (CStockMod sc in StockListBids[precision])
                    {
                        scDist.StockListBids[precision].Add((CStockMod)sc.Copy());
                    }
                }

                foreach (var kvp in StockListAsks)
                {
                    int precision = kvp.Key;

                    if (!scDist.StockListAsks.ContainsKey(precision))
                    {
                        scDist.StockListAsks[precision] = new List <CStockMod>();
                    }


                    foreach (CStockMod sc in StockListAsks[precision])
                    {
                        scDist.StockListAsks[precision].Add((CStockMod)sc.Copy());
                    }
                }

                scDist.LstStockConf = new List <CStockConfMod>(LstStockConf);

                //    foreach (CStock sc in StockListAsks) scDist.StockListAsks[precision].Add((CStock)sc.Copy());

                // CopyOneStockList(this.StockListBids, ref scDist.StockListBids);
                // CopyOneStockList((sbyte)EnmDir.Up, ref scDist);
            }
        }