private void beginTradingToolStripMenuItem_Click(object sender, EventArgs e) { watchToolStripMenuItem.Visible = true; toolStripMenuItem6.Visible = true; beginTradingToolStripMenuItem.Visible = false; marketVariableToolStripMenuItem.Text = "Market <<Open>>"; realTimeD = new M_RealTimeData(); //Add side menu Items ToolStripMenuItem[] items = new ToolStripMenuItem[realTimeD.company.Count]; for (int i = 0; i < items.Length; i++) { items[i] = new ToolStripMenuItem("a" + i); items[i].Text = realTimeD.company[i].companyName; items[i].Name = i + "_Company"; items[i].Tag = i; items[i].Click += new EventHandler(MenuClick); } ToolStripMenuItem[] itemss = new ToolStripMenuItem[realTimeD.company.Count]; for (int i = 0; i < itemss.Length; i++) { itemss[i] = new ToolStripMenuItem("a" + i); itemss[i].Text = realTimeD.company[i].companyName; itemss[i].Name = i + "_Company"; itemss[i].Tag = i; itemss[i].Click += new EventHandler(MenuClickPrice); } marketByOrderToolStripMenuItem.DropDownItems.AddRange(items); marketByPriceToolStripMenuItem.DropDownItems.AddRange(itemss); }
public void Update(M_RealTimeData data) { //clear table for (int i = 0; i < 10; i++) { for (int c = 0; c < 4; c++) { dataGridView1.Rows[i].Cells[c].Value = ""; } } //hold the number of entries at 10 int hold = data.company[companyIndex].pendingBuys.Count; int hold2 = data.company[companyIndex].pendingSales.Count; if (hold > 10) { hold = 10; } if (hold2 > 10) { hold2 = 10; } for (int i = 0; i < hold; i++) { dataGridView1.Rows[i].Cells[1].Value = data.company[companyIndex].pendingBuys[i].orderPrice; dataGridView1.Rows[i].Cells[0].Value = data.company[companyIndex].pendingBuys[i].orderSize; } for (int i = 0; i < hold2; i++) { dataGridView1.Rows[i].Cells[2].Value = data.company[companyIndex].pendingSales[i].orderPrice; dataGridView1.Rows[i].Cells[3].Value = data.company[companyIndex].pendingSales[i].orderSize; } }
public PlaceSellOrder(M_RealTimeData data) { InitializeComponent(); bidData = data; for (int i = 0; i < data.company.Count; i++) { companies.Items.Add(data.company[i].companyName); } companies.SelectedIndex = 0; }
public PlaceBid(M_RealTimeData data) { bidData = data; InitializeComponent(); for (int i = 0; i < data.company.Count; i++) { companiesList.Items.Add(data.company[i].companyName); // } companiesList.SelectedIndex = 0; }
public MarketOrderByDepth(int companyNum, M_RealTimeData data) { InitializeComponent(); companyIndex = companyNum; for (int i = 0; i < 10; i++) { dataGridView1.Rows.Add(); } dataGridView1.AllowUserToAddRows = false; Update(data); }
public StockStateSummary(M_RealTimeData data) { InitializeComponent(); for (int i = 0; i < data.company.Count; i++) { displayCompany[i] = data.company[i]; dataGridView1.Rows.Add(); dataGridView1.Rows[i].Cells[0].Value = "Test"; } dataGridView1.AllowUserToAddRows = false; Update(data); }
public void Update(M_RealTimeData data) { for (int i = 0; i < data.company.Count; i++) { dataGridView1.Rows[i].Cells[0].Value = data.company[i].companyName; dataGridView1.Rows[i].Cells[1].Value = data.company[i].Symbol; dataGridView1.Rows[i].Cells[2].Value = data.company[i].openPrice; dataGridView1.Rows[i].Cells[3].Value = data.company[i].lastPrice; dataGridView1.Rows[i].Cells[4].Value = data.company[i].netChange; dataGridView1.Rows[i].Cells[5].Value = data.company[i].bmp; dataGridView1.Rows[i].Cells[6].Value = Math.Abs(data.company[i].lastPrice - data.company[i].openPrice) / data.company[i].openPrice; dataGridView1.Rows[i].Cells[7].Value = data.company[i].volume; } }
public MarketDepthPrice(int companyNum, M_RealTimeData data) { InitializeComponent(); //Save Data and Company myData = data; companyIndex = companyNum; //Populate View Rows and make sure user can add anymore dataGridView1.Rows.Add(10); dataGridView1.AllowUserToAddRows = false; Update(data); }
public void Update(M_RealTimeData data) { //Reinitialize Buy and Sell and corresponding lists buyOrdTot = new List <M_BuyOrder>(); numOfBuy = new List <int>(); sellOrdTot = new List <M_SellOrder>(); numOfSell = new List <int>(); for (int i = 0; i < 10; i++) { for (int c = 0; c < 6; c++) { dataGridView1.Rows[i].Cells[c].Value = ""; } } bool newItem; //Buy //Loop through all orders of the given company index for (int i = 0; i < data.company[companyIndex].pendingBuys.Count; i++) { //Set new item true for each iteration through in case of a unallocated price newItem = true; for (int c = 0; c < buyOrdTot.Count; c++) { //Check for price match in existing buyOrd list if (data.company[companyIndex].pendingBuys[i].getPrice() == buyOrdTot[c].getPrice()) { //When match is found, increase the order size and add the volume numOfBuy[c] += 1; buyOrdTot[c].orderSize += data.company[companyIndex].pendingBuys[i].orderSize; //Change newItem variable because it is not a new price newItem = false; } } if (newItem == true) { //Since the price has not been matched create a new buyOrdTot and give it 1 instance buyOrdTot.Add(new M_BuyOrder(data.company[companyIndex].pendingBuys[i].orderSize, data.company[companyIndex].pendingBuys[i].orderPrice)); numOfBuy.Add(1); } } //Sell for (int i = 0; i < data.company[companyIndex].pendingSales.Count; i++) { newItem = true; for (int c = 0; c < sellOrdTot.Count; c++) { if (data.company[companyIndex].pendingSales[i].getPrice() == sellOrdTot[c].getPrice()) { numOfSell[c] += 1; sellOrdTot[c].orderSize += data.company[companyIndex].pendingSales[i].orderSize; newItem = false; } } if (newItem == true) { sellOrdTot.Add(new M_SellOrder(data.company[companyIndex].pendingSales[i].orderSize, data.company[companyIndex].pendingSales[i].orderPrice)); numOfSell.Add(1); } } //Populate Buy Columns for (int i = 0; i < buyOrdTot.Count; i++) { dataGridView1.Rows[i].Cells[0].Value = numOfBuy[i]; dataGridView1.Rows[i].Cells[1].Value = buyOrdTot[i].orderSize; dataGridView1.Rows[i].Cells[2].Value = buyOrdTot[i].orderPrice; } //Populate Sell Columns for (int i = 0; i < sellOrdTot.Count; i++) { dataGridView1.Rows[i].Cells[5].Value = numOfSell[i]; dataGridView1.Rows[i].Cells[4].Value = sellOrdTot[i].orderSize; dataGridView1.Rows[i].Cells[3].Value = sellOrdTot[i].orderPrice; } }