private void marketByPriceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var     returnVal  = this.GetBuyOrders();
            var     stringjson = parse_server_response(returnVal);
            JObject jsonData   = JObject.Parse(stringjson);

            JArray  ja = (JArray)jsonData[sender.ToString()];
            Company cmp;

            //this is for all buy orders
            foreach (var company in this.Subject.getCompanies())
            {
                if (company.Name == sender.ToString())
                {
                    cmp = company;
                    cmp.clearBuyOrders();
                    foreach (JObject jo in ja)
                    {
                        //add the companies buy orders
                        cmp.addBuyOrder(Double.Parse(jo["price"].ToString()), Int32.Parse(jo["volume"].ToString()));
                    }
                }
            }

            var     returnedSellVal = this.GetSellOrders();
            var     sellStringjson  = parse_server_response(returnedSellVal);
            JObject jsonSellData    = JObject.Parse(sellStringjson);

            JArray jsa = (JArray)jsonSellData[sender.ToString()];

            //this is for all sell orders
            foreach (var c in this.Subject.getCompanies())
            {
                if (c.Name == sender.ToString())
                {
                    c.clearSellOrders();
                    foreach (JObject jo in jsa)
                    {
                        //add the companies sell orders
                        c.addSellOrder(Double.Parse(jo["price"].ToString()), Int32.Parse(jo["volume"].ToString()));
                    }
                }
            }



            MarketByPrice newMDIChild = new MarketByPrice(Subject, sender.ToString());

            // Set the parent form of the child window.

            newMDIChild.Text = "Market Depth By Price (" + sender.ToString() + ")";

            newMDIChild.MdiParent = this;
            // Display the new form.
            newMDIChild.Show();
        }
Exemplo n.º 2
0
        private void marketByPriceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MarketByPrice newMDIChild = new MarketByPrice(Subject, sender.ToString());

            // Set the parent form of the child window.

            newMDIChild.Text = "Market Depth By Price (" + sender.ToString() + ")";

            newMDIChild.MdiParent = this;
            // Display the new form.
            newMDIChild.Show();
        }