Exemple #1
0
        //
        // ****             Serialize()            ****
        //
        private void Serialize()
        {
            // Create some books.
            StringBuilder msg = new StringBuilder();

            System.Random rand = new Random();
            for (int i = 0; i < 2; ++i)
            {
                InstrumentName name    = new InstrumentName(new Product("CME", "ED", ProductTypes.Spread), string.Format("#{0}", i + 1));
                double         minTick = 0.5;
                FillBookLifo   book    = new FillBookLifo(minTick, 12.50, name);
                for (int j = 0; j < 2; ++j)
                {
                    Fill aFill = Fill.Create();
                    aFill.Price        = rand.Next(20) * minTick;
                    aFill.Qty          = rand.Next(10) + 2;
                    aFill.LocalTime    = DateTime.Now.AddSeconds(-rand.NextDouble() * 100);
                    aFill.ExchangeTime = aFill.LocalTime;
                    book.Add(aFill);
                }
                m_FillBooks.Add(name, book);

                msg.AppendFormat("{0}", Stringifiable.Stringify(book));
            }// next i

            textBox1.Text = msg.ToString();
            this.Select();
        }// Serialize().
Exemple #2
0
        private void Test1()
        {
            InstrumentName name = new InstrumentName(new Product("CME", "GE", ProductTypes.Spread), "H2M2");
            FillBookLifo   book = new FillBookLifo(0.5, 12.50, name);

            List <Fill> aList = new List <Fill>();

            for (int i = 0; i < 2; ++i)
            {
                Fill aFill = Fill.Create();
                aFill.Qty          = i + 2;
                aFill.Price        = 1.0 + 0.5 * i;
                aFill.LocalTime    = DateTime.Now.AddHours(i * .25);
                aFill.ExchangeTime = aFill.LocalTime;
                aList.Add(aFill);
                //string s = SerializeToString(aFill).Replace('\n',' ');
                //textBox1.Text = textBox1.Text + s;
                book.Add(aFill);
            }
            textBox1.Text = SerializeToString(book);
        }
Exemple #3
0
 private void buttonDeSerialize_Click(object sender, EventArgs e)
 {
     string       s    = textBox1.Text;
     FillBookLifo book = SerializeFromString <FillBookLifo>(s);
     //int n = 0;
 }